diff --git a/cpu/stm32/Makefile.include b/cpu/stm32/Makefile.include index 7259e63ba2..151696a9bd 100644 --- a/cpu/stm32/Makefile.include +++ b/cpu/stm32/Makefile.include @@ -13,13 +13,20 @@ ROM_LEN_K := $(shell echo $(ROM_LEN) | sed 's/K//') RAM_LEN_K := $(shell echo $(RAM_LEN) | sed 's/K//') ifneq (,$(filter w%,$(CPU_FAM))) - # adjust RAM_LEN and ROM_LEN according to CPU2 RAM_LEN and ROM_LEN - CPU2_RAM_LEN_K := $(shell echo $(CPU2_RAM_LEN) | sed 's/K//') - RAM_LEN := $(shell echo $$(( ($(RAM_LEN_K) - $(CPU2_RAM_LEN_K) ) * $(KB) ))) - - CPU2_ROM_LEN_K := $(shell echo $(CPU2_ROM_LEN) | sed 's/K//') - FLASHSIZE := $(shell echo $$(( ($(ROM_LEN_K) - $(CPU2_ROM_LEN_K) )* $(KB) )) ) - ROM_LEN := $(shell echo $$(( ($(ROM_LEN_K) - $(CPU2_ROM_LEN_K) ) ))K) + ifneq (,$(CPU2_RAM_LEN)) + # adjust RAM_LEN and ROM_LEN according to CPU2 RAM_LEN and ROM_LEN + CPU2_RAM_LEN_K := $(shell echo $(CPU2_RAM_LEN) | sed 's/K//') + RAM_LEN := $(shell echo $$(( ($(RAM_LEN_K) - $(CPU2_RAM_LEN_K) ) * $(KB) ))) + else + RAM_LEN := $(shell echo $$(( $(RAM_LEN_K) * $(KB) )) ) + endif + ifneq (,$(CPU2_ROM_LEN)) + CPU2_ROM_LEN_K := $(shell echo $(CPU2_ROM_LEN) | sed 's/K//') + FLASHSIZE := $(shell echo $$(( ($(ROM_LEN_K) - $(CPU2_ROM_LEN_K) )* $(KB) )) ) + ROM_LEN := $(shell echo $$(( ($(ROM_LEN_K) - $(CPU2_ROM_LEN_K) ) ))K) + else + FLASHSIZE := $(shell echo $$(( $(ROM_LEN_K) * $(KB) )) ) + endif else FLASHSIZE := $(shell echo $$(( $(ROM_LEN_K) * $(KB) )) ) RAM_LEN := $(shell echo $$(( $(RAM_LEN_K) * $(KB) )) ) diff --git a/cpu/stm32/periph/flashpage.c b/cpu/stm32/periph/flashpage.c index 2a56276457..4a559167a0 100644 --- a/cpu/stm32/periph/flashpage.c +++ b/cpu/stm32/periph/flashpage.c @@ -190,7 +190,8 @@ void flashpage_erase(unsigned page) assert(page < (int)FLASHPAGE_NUMOF); /* ensure there is no attempt to write to CPU2 protected area */ -#if defined(CPU_FAM_STM32WB) || defined(CPU_FAM_STM32WL) +#if defined(CPU_FAM_STM32WB) || (defined(CPU_FAM_STM32WL) && \ + !defined(CPU_LINE_STM32WLE5xx)) assert(page < (int)(FLASH->SFR & FLASH_SFR_SFSA)); #endif diff --git a/drivers/periph_common/flashpage.c b/drivers/periph_common/flashpage.c index cb8e8b1967..f9457c213f 100644 --- a/drivers/periph_common/flashpage.c +++ b/drivers/periph_common/flashpage.c @@ -33,7 +33,8 @@ void flashpage_read(unsigned page, void *data) { assert(page < FLASHPAGE_NUMOF); -#if defined(CPU_FAM_STM32WB) || defined(CPU_FAM_STM32WL) +#if defined(CPU_FAM_STM32WB) || (defined(CPU_FAM_STM32WL) && \ + !defined(CPU_LINE_STM32WLE5xx)) assert(page < (FLASH->SFR & FLASH_SFR_SFSA)); #endif @@ -44,7 +45,8 @@ int flashpage_verify(unsigned page, const void *data) { assert(page < (int)FLASHPAGE_NUMOF); -#if defined(CPU_FAM_STM32WB) || defined(CPU_FAM_STM32WL) +#if defined(CPU_FAM_STM32WB) || (defined(CPU_FAM_STM32WL) && \ + !defined(CPU_LINE_STM32WLE5xx)) assert(page < (int)(FLASH->SFR & FLASH_SFR_SFSA)); #endif