From b36ab845ab732876bc33b8b82ebfa5dd291b558e Mon Sep 17 00:00:00 2001 From: Jeremy Salwen Date: Mon, 29 Jul 2024 00:32:12 -0400 Subject: [PATCH] Fix startup assembly bugs in 500b Root cause: 1. .s files are not processed by the preprocessor, since they are passed directly to the assembler. Only .S files are processed by gcc, which uses the preprocessor before sending to the assembler. Thus the #includes in startup_stdm32f.s had no effect. 2. The proxy_inc/**/*.s files were accidentally *not* filtered from the sources like the .c files in the same directory. Thus the startup code for both boards was unconditionally included. 3. The two bugs cancelled each other out for the 500b, resulting in the correct startup code being built. However, it was incorrectly including the 500b's startup code in the non-500b build. --- stm32/ros_usbnode/platformio.ini | 1 + .../stm32f1/{startup_stm32f1xx.s => startup_stm32f1xx.S} | 0 .../stm32f4/{startup_stm32f4xx.s => startup_stm32f4xx.S} | 0 stm32/ros_usbnode/src/startup_stm32f.S | 5 +++++ stm32/ros_usbnode/src/startup_stm32f.s | 5 ----- 5 files changed, 6 insertions(+), 5 deletions(-) rename stm32/ros_usbnode/src/proxy_inc/stm32f1/{startup_stm32f1xx.s => startup_stm32f1xx.S} (100%) rename stm32/ros_usbnode/src/proxy_inc/stm32f4/{startup_stm32f4xx.s => startup_stm32f4xx.S} (100%) create mode 100644 stm32/ros_usbnode/src/startup_stm32f.S delete mode 100644 stm32/ros_usbnode/src/startup_stm32f.s diff --git a/stm32/ros_usbnode/platformio.ini b/stm32/ros_usbnode/platformio.ini index 6eaff3c1..8a319ae7 100644 --- a/stm32/ros_usbnode/platformio.ini +++ b/stm32/ros_usbnode/platformio.ini @@ -19,6 +19,7 @@ build_src_filter = -<.git/> -<.svn/> - + - [env:Yardforce500] board = genericSTM32F103VC diff --git a/stm32/ros_usbnode/src/proxy_inc/stm32f1/startup_stm32f1xx.s b/stm32/ros_usbnode/src/proxy_inc/stm32f1/startup_stm32f1xx.S similarity index 100% rename from stm32/ros_usbnode/src/proxy_inc/stm32f1/startup_stm32f1xx.s rename to stm32/ros_usbnode/src/proxy_inc/stm32f1/startup_stm32f1xx.S diff --git a/stm32/ros_usbnode/src/proxy_inc/stm32f4/startup_stm32f4xx.s b/stm32/ros_usbnode/src/proxy_inc/stm32f4/startup_stm32f4xx.S similarity index 100% rename from stm32/ros_usbnode/src/proxy_inc/stm32f4/startup_stm32f4xx.s rename to stm32/ros_usbnode/src/proxy_inc/stm32f4/startup_stm32f4xx.S diff --git a/stm32/ros_usbnode/src/startup_stm32f.S b/stm32/ros_usbnode/src/startup_stm32f.S new file mode 100644 index 00000000..9db75d55 --- /dev/null +++ b/stm32/ros_usbnode/src/startup_stm32f.S @@ -0,0 +1,5 @@ +#if BOARD_YARDFORCE500_VARIANT_ORIG +#include "proxy_inc/stm32f1/startup_stm32f1xx.S" +#elif BOARD_YARDFORCE500_VARIANT_B +#include "proxy_inc/stm32f4/startup_stm32f4xx.S" +#endif diff --git a/stm32/ros_usbnode/src/startup_stm32f.s b/stm32/ros_usbnode/src/startup_stm32f.s deleted file mode 100644 index bd07c757..00000000 --- a/stm32/ros_usbnode/src/startup_stm32f.s +++ /dev/null @@ -1,5 +0,0 @@ -#if BOARD_YARDFORCE500_VARIANT_ORIG -#include "proxy_inc/stm32f1/startup_stm32f1xx.s" -#elif BOARD_YARDFORCE500_VARIANT_B -#include "proxy_inc/stm32f4/startup_stm32f4xx.s" -#endif