summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-12-16 22:03:06 +0700
committerhathach <[email protected]>2024-12-16 22:03:06 +0700
commit656772fc9defc73c32443259f866daadc657f23d (patch)
tree20b9a563e049ce7ca87446562e79c6ca0f20a3d8
parent380bfc0a6345f7295e2a5ff60c9712255f04a2dc (diff)
make sure g_bsp_rom_registers is not dropped by linker in cmake build.
always reserve 0x100 for option setting in linker to prevent possible bricked mcu
-rw-r--r--hw/bsp/ra/boards/portenta_c33/script/fsp.ld3
-rw-r--r--hw/bsp/ra/boards/ra4m1_ek/script/fsp.ld3
-rw-r--r--hw/bsp/ra/boards/ra4m3_ek/script/fsp.ld3
-rw-r--r--hw/bsp/ra/boards/ra6m1_ek/script/fsp.ld3
-rw-r--r--hw/bsp/ra/boards/ra6m5_ek/script/fsp.ld3
-rw-r--r--hw/bsp/ra/boards/ra8m1_ek/script/fsp.ld3
-rw-r--r--hw/bsp/ra/boards/uno_r4/script/fsp.ld3
-rw-r--r--hw/bsp/ra/family.cmake6
8 files changed, 26 insertions, 1 deletions
diff --git a/hw/bsp/ra/boards/portenta_c33/script/fsp.ld b/hw/bsp/ra/boards/portenta_c33/script/fsp.ld
index 627ffe4d9..605eef7d2 100644
--- a/hw/bsp/ra/boards/portenta_c33/script/fsp.ld
+++ b/hw/bsp/ra/boards/portenta_c33/script/fsp.ld
@@ -173,6 +173,9 @@ SECTIONS
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
KEEP(*(.rom_registers*))
+ /* Reserving 0x100 bytes of space for ROM registers. */
+ . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
+
/* Allocate flash write-boundary-aligned
* space for sce9 wrapped public keys for mcuboot if the module is used.
*/
diff --git a/hw/bsp/ra/boards/ra4m1_ek/script/fsp.ld b/hw/bsp/ra/boards/ra4m1_ek/script/fsp.ld
index 627ffe4d9..605eef7d2 100644
--- a/hw/bsp/ra/boards/ra4m1_ek/script/fsp.ld
+++ b/hw/bsp/ra/boards/ra4m1_ek/script/fsp.ld
@@ -173,6 +173,9 @@ SECTIONS
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
KEEP(*(.rom_registers*))
+ /* Reserving 0x100 bytes of space for ROM registers. */
+ . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
+
/* Allocate flash write-boundary-aligned
* space for sce9 wrapped public keys for mcuboot if the module is used.
*/
diff --git a/hw/bsp/ra/boards/ra4m3_ek/script/fsp.ld b/hw/bsp/ra/boards/ra4m3_ek/script/fsp.ld
index 627ffe4d9..605eef7d2 100644
--- a/hw/bsp/ra/boards/ra4m3_ek/script/fsp.ld
+++ b/hw/bsp/ra/boards/ra4m3_ek/script/fsp.ld
@@ -173,6 +173,9 @@ SECTIONS
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
KEEP(*(.rom_registers*))
+ /* Reserving 0x100 bytes of space for ROM registers. */
+ . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
+
/* Allocate flash write-boundary-aligned
* space for sce9 wrapped public keys for mcuboot if the module is used.
*/
diff --git a/hw/bsp/ra/boards/ra6m1_ek/script/fsp.ld b/hw/bsp/ra/boards/ra6m1_ek/script/fsp.ld
index 627ffe4d9..605eef7d2 100644
--- a/hw/bsp/ra/boards/ra6m1_ek/script/fsp.ld
+++ b/hw/bsp/ra/boards/ra6m1_ek/script/fsp.ld
@@ -173,6 +173,9 @@ SECTIONS
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
KEEP(*(.rom_registers*))
+ /* Reserving 0x100 bytes of space for ROM registers. */
+ . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
+
/* Allocate flash write-boundary-aligned
* space for sce9 wrapped public keys for mcuboot if the module is used.
*/
diff --git a/hw/bsp/ra/boards/ra6m5_ek/script/fsp.ld b/hw/bsp/ra/boards/ra6m5_ek/script/fsp.ld
index 627ffe4d9..605eef7d2 100644
--- a/hw/bsp/ra/boards/ra6m5_ek/script/fsp.ld
+++ b/hw/bsp/ra/boards/ra6m5_ek/script/fsp.ld
@@ -173,6 +173,9 @@ SECTIONS
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
KEEP(*(.rom_registers*))
+ /* Reserving 0x100 bytes of space for ROM registers. */
+ . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
+
/* Allocate flash write-boundary-aligned
* space for sce9 wrapped public keys for mcuboot if the module is used.
*/
diff --git a/hw/bsp/ra/boards/ra8m1_ek/script/fsp.ld b/hw/bsp/ra/boards/ra8m1_ek/script/fsp.ld
index 32cbf0b22..d7f78a915 100644
--- a/hw/bsp/ra/boards/ra8m1_ek/script/fsp.ld
+++ b/hw/bsp/ra/boards/ra8m1_ek/script/fsp.ld
@@ -177,6 +177,9 @@ SECTIONS
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
KEEP(*(.rom_registers*))
+ /* Reserving 0x100 bytes of space for ROM registers. */
+ . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
+
/* Allocate flash write-boundary-aligned
* space for sce9 wrapped public keys for mcuboot if the module is used.
*/
diff --git a/hw/bsp/ra/boards/uno_r4/script/fsp.ld b/hw/bsp/ra/boards/uno_r4/script/fsp.ld
index 627ffe4d9..605eef7d2 100644
--- a/hw/bsp/ra/boards/uno_r4/script/fsp.ld
+++ b/hw/bsp/ra/boards/uno_r4/script/fsp.ld
@@ -173,6 +173,9 @@ SECTIONS
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
KEEP(*(.rom_registers*))
+ /* Reserving 0x100 bytes of space for ROM registers. */
+ . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
+
/* Allocate flash write-boundary-aligned
* space for sce9 wrapped public keys for mcuboot if the module is used.
*/
diff --git a/hw/bsp/ra/family.cmake b/hw/bsp/ra/family.cmake
index 9eca93b4d..d4d795ae5 100644
--- a/hw/bsp/ra/family.cmake
+++ b/hw/bsp/ra/family.cmake
@@ -54,7 +54,6 @@ function(add_board_target BOARD_TARGET)
${FSP_RA}/src/bsp/mcu/all/bsp_io.c
${FSP_RA}/src/bsp/mcu/all/bsp_irq.c
${FSP_RA}/src/bsp/mcu/all/bsp_register_protection.c
- ${FSP_RA}/src/bsp/mcu/all/bsp_rom_registers.c
${FSP_RA}/src/bsp/mcu/all/bsp_sbrk.c
${FSP_RA}/src/bsp/mcu/all/bsp_security.c
${FSP_RA}/src/r_ioport/r_ioport.c
@@ -125,12 +124,17 @@ function(family_configure_example TARGET RTOS)
# BSP
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
+ # Explicitly added bsp_rom_registers here, otherwise MCU can be bricked if g_bsp_rom_registers is dropped by linker
+ ${FSP_RA}/src/bsp/mcu/all/bsp_rom_registers.c
)
target_include_directories(${TARGET} PUBLIC
# family, hw, board
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../
)
+ target_compile_options(${TARGET} PUBLIC
+ -Wno-error=undef
+ )
# # RA has custom freertos port
# if (NOT TARGET freertos_kernel_port)