From 68ef270215b0b27598111f3ef0158bd2d9fe0dd9 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 2 Mar 2023 12:48:50 -0800 Subject: [PATCH] Demo/CORTEX_M3_MPS2_QEMU_GCC: Prepare startup.c for use with --gc-sections Ensure that the handler2_address_const location will be correctly aligned when compiled to a separate section. Add the 'used' attribute to isr_vector to ensure it will not be elided from the output. Signed-off-by: Keith Packard --- FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/init/startup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/init/startup.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/init/startup.c index 8f21c1b86b..0004f6baa6 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/init/startup.c +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/init/startup.c @@ -135,6 +135,7 @@ void Default_Handler2( void ) " ldr r1, [r0, #24] \n" " ldr r2, handler2_address_const \n" " bx r2 \n" + " nop \n" " handler2_address_const: .word prvGetRegistersFromStack \n" ); } @@ -167,7 +168,7 @@ void Default_Handler6( void ) } } -const uint32_t * isr_vector[] __attribute__( ( section( ".isr_vector" ) ) ) = +const uint32_t * isr_vector[] __attribute__( ( section( ".isr_vector" ) , used ) ) = { ( uint32_t * ) &_estack, ( uint32_t * ) &Reset_Handler, /* Reset -15 */