wolfSSL / wolfBoot

wolfBoot is a portable, OS-agnostic, secure bootloader for microcontrollers, supporting firmware authentication and firmware update mechanisms.
https://www.wolfssl.com
GNU General Public License v3.0
365 stars 100 forks source link

i.MX RT10xx operator '*' has no right operand #438

Closed MulattoKid closed 7 months ago

MulattoKid commented 7 months ago

When compiling for i.MX RT10xx I get the following error

core/devices/MIMXRT1042/MIMXRT1042.h:32067:65: error: operator '*' has no right operand
32067 | #define LPUART1                                  ((LPUART_Type *)LPUART1_BASE)

I've not hit this problem before, as we've been running with a slightly custom wolfBoot version internally.

A solution would be to compare the actual base address as an integer instead of a pointer, i.e. using LPUART1_BASE instead of LPUART1.

dgarske commented 7 months ago

@bigbrett is going to review this.

Does this patch resolve the error? I can't tell what the specific wolfBoot error is, but I suspect it's this macro check.

diff --git a/hal/imx_rt.c b/hal/imx_rt.c
index 3c6e7398..7dd07076 100644
--- a/hal/imx_rt.c
+++ b/hal/imx_rt.c
@@ -715,7 +715,7 @@ void uart_init(void)
     lpuart_config_t config;
     uint32_t uartClkSrcFreq = 20000000U; /* 20 MHz */

-#if UART_BASEADDR == LPUART1
+#if (uintptr_t)UART_BASEADDR == (uintptr_t)LPUART1
     /* Configure the UART IO pins for LPUART1
      * Tested with RT1040, RT1050, RT1062 and RT1064
      */

Thanks, David Garske, wolfSSL

MulattoKid commented 7 months ago

Yes, it's UART_BASEADDR == LPUART1 that caused the issue. I handled it a bit differently in my PR, but your patch should work as well :)

dgarske commented 7 months ago

Fixed with PR #439.