From b86d7fc308e2168105f064813645511385de8ff2 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 26 Mar 2025 13:52:24 -0700 Subject: [PATCH] Renesas RX minor fixes and documentation updates. Fix for malformed GNUC macro causing clock to not be setup properly when building with RX-GCC compiler. Fix warnings with using `%zu` on older GCC. --- docs/Targets.md | 20 ++++++++++---------- hal/renesas-rx.c | 2 +- tools/keytools/keygen.c | 8 ++++---- tools/lms/lms_common.h | 12 ++++++------ tools/xmss/xmss_common.h | 12 ++++++------ 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/docs/Targets.md b/docs/Targets.md index 0a50cd9c..a8db49c3 100644 --- a/docs/Targets.md +++ b/docs/Targets.md @@ -2614,24 +2614,22 @@ Note: This also works on Mac OS, but `objcopy` does not exist. Install with `bre See instructions in [IDE/pico-sdk/rp2350/README.md](/IDE/pico-sdk/rp2350/README.md) + ## Renesas RX65N Tested on the: -* RX65N-2MB-Starter-Kit-Plus +* RX65N-2MB-Starter-Kit-Plus (RSK+) * RX65N Target Board (RTK5RX65N0C00000BR) (includes onboard E2 Lite emulator) -Both include an E2 Lite Emulator. - ### Renesas Console Console output is supported with `DEBUG_UART=1`. -RSK+: +* RSK+: This board includes a USB to Serial port that uses SCI8 and PJ1/PJ2. This is the wolfBoot HAL default for RX65N. -RX65N target board: - +* RX65N target board: Can route UART Serial output to PC3 via PMOD1-IO0 at Pin 9. This requires an external TTL UART to USB adapter. You will need to set `CFLAGS_EXTRA+="-DDEBUG_UART_SCI=3"` in .config. @@ -2689,7 +2687,12 @@ Default Onboard Flash Memory Layout (2MB) (32KB sector): ### Renesas Data Endianess -To switch RX parts to big endian data use: +To switch RX parts to big endian data use the Renesas Flashing Tool: + +Download the Renesas Flashing Tool: https://www.renesas.com/us/en/software-tool/renesas-flash-programmer-programming-gui +Download the Renesas E2 Lite Linux Driver: https://www.renesas.com/us/en/document/swo/e2-emulator-e2-emulator-lite-linux-driver?r=488806 + +Default location on Windows: `C:\Program Files (x86)\Renesas Electronics\Programming Tools\Renesas Flash Programmer V3.14`. ```sh # Big Endian @@ -2724,9 +2727,6 @@ TSIP: To enable TSIP use `make PKA=1`. See [docs/Renesas.md](docs/Renesas.md) fo ### Flashing Renesas RX65N -Download the Renesas Flashing Tool: https://www.renesas.com/us/en/software-tool/renesas-flash-programmer-programming-gui -Download the Renesas E2 Lite Linux Driver: https://www.renesas.com/us/en/document/swo/e2-emulator-e2-emulator-lite-linux-driver?r=488806 - Default Flash ID Code: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF Flash Using: diff --git a/hal/renesas-rx.c b/hal/renesas-rx.c index 35e8a5a7..393d2231 100644 --- a/hal/renesas-rx.c +++ b/hal/renesas-rx.c @@ -377,7 +377,7 @@ void hal_init(void) #endif /* For CCRX, mcu_clock_setup() in resetprg.c will set up clocks. */ -#if defined(_GNUC_) +#if defined(__GNUC__) hal_clk_init(); #endif diff --git a/tools/keytools/keygen.c b/tools/keytools/keygen.c index 98632519..cf720426 100644 --- a/tools/keytools/keygen.c +++ b/tools/keytools/keygen.c @@ -519,8 +519,8 @@ void keystore_add(uint32_t ktype, uint8_t *key, uint32_t sz, const char *keyfile sl.pubkey_size = get_pubkey_size(ktype); if (sl.pubkey_size > sizeof(sl.pubkey)){ - printf("error: %s pubkey larger than keystore: %d > %zu\n", - KName[ktype], sl.pubkey_size, sizeof(sl.pubkey)); + printf("error: %s pubkey larger than keystore: %d > %d\n", + KName[ktype], sl.pubkey_size, (int)sizeof(sl.pubkey)); exit(1); } @@ -844,7 +844,7 @@ static void keygen_lms(const char *priv_fname, uint32_t id_mask) if (pub_len != sizeof(lms_pub)) { fprintf(stderr, "error: wc_LmsKey_ExportPubRaw returned pub_len=%d\n" \ - ", expected %zu\n", pub_len, sizeof(lms_pub)); + ", expected %d\n", pub_len, (int)sizeof(lms_pub)); exit(1); } @@ -943,7 +943,7 @@ static void keygen_xmss(const char *priv_fname, uint32_t id_mask) if (pub_len != sizeof(xmss_pub)) { fprintf(stderr, "error: wc_XmssKey_ExportPubRaw returned pub_len=%d\n" \ - ", expected %zu\n", pub_len, sizeof(xmss_pub)); + ", expected %d\n", pub_len, (int)sizeof(xmss_pub)); exit(1); } diff --git a/tools/lms/lms_common.h b/tools/lms/lms_common.h index ba7ba35b..7e70014d 100644 --- a/tools/lms/lms_common.h +++ b/tools/lms/lms_common.h @@ -56,8 +56,8 @@ static int lms_write_key(const byte * priv, word32 privSz, void * context) n_write = fwrite(priv, 1, privSz, file); if (n_write != privSz) { - fprintf(stderr, "error: wrote %zu, expected %d: %d\n", n_write, privSz, - ferror(file)); + fprintf(stderr, "error: wrote %d, expected %d: %d\n", + (int)n_write, privSz, ferror(file)); return WC_LMS_RC_WRITE_FAIL; } @@ -80,8 +80,8 @@ static int lms_write_key(const byte * priv, word32 privSz, void * context) n_read = fread(buff, 1, n_write, file); if (n_read != n_write) { - fprintf(stderr, "error: read %zu, expected %zu: %d\n", n_read, n_write, - ferror(file)); + fprintf(stderr, "error: read %d, expected %d: %d\n", + (int)n_read, (int)n_write, ferror(file)); return WC_LMS_RC_WRITE_FAIL; } @@ -122,8 +122,8 @@ static int lms_read_key(byte * priv, word32 privSz, void * context) n_read = fread(priv, 1, privSz, file); if (n_read != privSz) { - fprintf(stderr, "error: read %zu, expected %d: %d\n", n_read, privSz, - ferror(file)); + fprintf(stderr, "error: read %d, expected %d: %d\n", + (int)n_read, privSz, ferror(file)); return WC_LMS_RC_READ_FAIL; } diff --git a/tools/xmss/xmss_common.h b/tools/xmss/xmss_common.h index 66e8a305..62ec3a27 100644 --- a/tools/xmss/xmss_common.h +++ b/tools/xmss/xmss_common.h @@ -56,8 +56,8 @@ static enum wc_XmssRc xmss_write_key(const byte * priv, word32 privSz, void * co n_write = fwrite(priv, 1, privSz, file); if (n_write != privSz) { - fprintf(stderr, "error: wrote %zu, expected %d: %d\n", n_write, privSz, - ferror(file)); + fprintf(stderr, "error: wrote %d, expected %d: %d\n", + (int)n_write, privSz, ferror(file)); return WC_XMSS_RC_WRITE_FAIL; } @@ -86,8 +86,8 @@ static enum wc_XmssRc xmss_write_key(const byte * priv, word32 privSz, void * co n_read = fread(buff, 1, n_write, file); if (n_read != n_write) { - fprintf(stderr, "error: read %zu, expected %zu: %d\n", n_read, n_write, - ferror(file)); + fprintf(stderr, "error: read %d, expected %d: %d\n", + (int)n_read, (int)n_write, ferror(file)); free(buff); return WC_XMSS_RC_WRITE_FAIL; } @@ -132,8 +132,8 @@ static enum wc_XmssRc xmss_read_key(byte * priv, word32 privSz, void * context) n_read = fread(priv, 1, privSz, file); if (n_read != privSz) { - fprintf(stderr, "error: read %zu, expected %d: %d\n", n_read, privSz, - ferror(file)); + fprintf(stderr, "error: read %d, expected %d: %d\n", + (int)n_read, privSz, ferror(file)); return WC_XMSS_RC_READ_FAIL; }