Skip to content

Commit 656772f

Browse files
committed
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
1 parent 380bfc0 commit 656772f

File tree

8 files changed

+26
-1
lines changed

8 files changed

+26
-1
lines changed

hw/bsp/ra/boards/portenta_c33/script/fsp.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ SECTIONS
173173
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
174174
KEEP(*(.rom_registers*))
175175

176+
/* Reserving 0x100 bytes of space for ROM registers. */
177+
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
178+
176179
/* Allocate flash write-boundary-aligned
177180
* space for sce9 wrapped public keys for mcuboot if the module is used.
178181
*/

hw/bsp/ra/boards/ra4m1_ek/script/fsp.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ SECTIONS
173173
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
174174
KEEP(*(.rom_registers*))
175175

176+
/* Reserving 0x100 bytes of space for ROM registers. */
177+
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
178+
176179
/* Allocate flash write-boundary-aligned
177180
* space for sce9 wrapped public keys for mcuboot if the module is used.
178181
*/

hw/bsp/ra/boards/ra4m3_ek/script/fsp.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ SECTIONS
173173
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
174174
KEEP(*(.rom_registers*))
175175

176+
/* Reserving 0x100 bytes of space for ROM registers. */
177+
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
178+
176179
/* Allocate flash write-boundary-aligned
177180
* space for sce9 wrapped public keys for mcuboot if the module is used.
178181
*/

hw/bsp/ra/boards/ra6m1_ek/script/fsp.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ SECTIONS
173173
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
174174
KEEP(*(.rom_registers*))
175175

176+
/* Reserving 0x100 bytes of space for ROM registers. */
177+
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
178+
176179
/* Allocate flash write-boundary-aligned
177180
* space for sce9 wrapped public keys for mcuboot if the module is used.
178181
*/

hw/bsp/ra/boards/ra6m5_ek/script/fsp.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ SECTIONS
173173
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
174174
KEEP(*(.rom_registers*))
175175

176+
/* Reserving 0x100 bytes of space for ROM registers. */
177+
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
178+
176179
/* Allocate flash write-boundary-aligned
177180
* space for sce9 wrapped public keys for mcuboot if the module is used.
178181
*/

hw/bsp/ra/boards/ra8m1_ek/script/fsp.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ SECTIONS
177177
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
178178
KEEP(*(.rom_registers*))
179179

180+
/* Reserving 0x100 bytes of space for ROM registers. */
181+
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
182+
180183
/* Allocate flash write-boundary-aligned
181184
* space for sce9 wrapped public keys for mcuboot if the module is used.
182185
*/

hw/bsp/ra/boards/uno_r4/script/fsp.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ SECTIONS
173173
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
174174
KEEP(*(.rom_registers*))
175175

176+
/* Reserving 0x100 bytes of space for ROM registers. */
177+
. = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
178+
176179
/* Allocate flash write-boundary-aligned
177180
* space for sce9 wrapped public keys for mcuboot if the module is used.
178181
*/

hw/bsp/ra/family.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ function(add_board_target BOARD_TARGET)
5454
${FSP_RA}/src/bsp/mcu/all/bsp_io.c
5555
${FSP_RA}/src/bsp/mcu/all/bsp_irq.c
5656
${FSP_RA}/src/bsp/mcu/all/bsp_register_protection.c
57-
${FSP_RA}/src/bsp/mcu/all/bsp_rom_registers.c
5857
${FSP_RA}/src/bsp/mcu/all/bsp_sbrk.c
5958
${FSP_RA}/src/bsp/mcu/all/bsp_security.c
6059
${FSP_RA}/src/r_ioport/r_ioport.c
@@ -125,12 +124,17 @@ function(family_configure_example TARGET RTOS)
125124
# BSP
126125
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
127126
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
127+
# Explicitly added bsp_rom_registers here, otherwise MCU can be bricked if g_bsp_rom_registers is dropped by linker
128+
${FSP_RA}/src/bsp/mcu/all/bsp_rom_registers.c
128129
)
129130
target_include_directories(${TARGET} PUBLIC
130131
# family, hw, board
131132
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
132133
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../
133134
)
135+
target_compile_options(${TARGET} PUBLIC
136+
-Wno-error=undef
137+
)
134138

135139
# # RA has custom freertos port
136140
# if (NOT TARGET freertos_kernel_port)

0 commit comments

Comments
 (0)