Closed bjc closed 3 years ago
This is definitely an error in the core, but moving the startup files to the variants will lead to extreme duplication in the future as more variants are added (in a possibly automated way).
The STM32 core uses the same "include correct startup file" with
https://github.com/stm32duino/Arduino_Core_STM32/blob/master/cores/arduino/stm32/startup_stm32yyxx.S
but their startup files are outside the core in system/
so that they are not built. (https://github.com/stm32duino/Arduino_Core_STM32/tree/master/system/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc)
I much more of a fan of putting all startup files in a new GCC folder https://github.com/CommunityGD32Cores/ArduinoCore-GD32/tree/main/system/GD32F30x_firmware/CMSIS/GD/GD32F30x/Source, which is then added to the include path and can then be included. What do you think of that?
I'd thought of using system
as well, but couldn't think of a good path for it off the top of my head and variants
seemed to me to fit the bill, but I agree it will lead to duplication.
Since I still don't want to put anything in system/GD32F30x_firmware
, as that's the upstream library, what do you think about adding a new directory, say system/startup
?
Indeed ideally the startup files should be in the GigaDevice's supplied firmware library folder, but only ARM and IAR starup files are there right now. I'll definitely request that to be added.
And sure, until then we can use system/startup
.
Sorry about the delay, but here are the changes we've talked about.
Merged and expanded for PlatformIO in 214a1d3510c31c54a8cb02ddf3d140a3c3cbfa11, CI was retriggered and goes through.
When this code lived in the ‘core/gd32’ directory, all variants were being automatically compiled and linked in to the resulting ‘core.a’, which resulted in name collisions and symbols not resolving correctly for the target architecture unless you got lucky at link time.
Moving the startup code into ‘variants’ resolves this issue, as only the code matching the variant currently in use is compiled and linked in.