platformio / builder-framework-mbed

ARM mbed build script for PlatformIO Build System
http://platformio.org/frameworks/mbed
Apache License 2.0
4 stars 17 forks source link

Allow platform to override linker script #10

Closed tsaarni closed 6 years ago

tsaarni commented 6 years ago

I'm in the progress of adding support for generic STM32F030F4 boards (cheap ones from ebay). These are not supported by mbed-os upstream but it seems the only major difference to NUCLEO_F030R8 is the RAM and flash memory sizes. After modifying the linker script I can successfully upload and run code on the board.

I noticed that platform-ststm32/ldscripts contain some custom linker scripts. It does not seem to be possible to utilize these within builder-framework-mbed. In this patch I add the possibility to use these ldscripts instead of the default scripts from mbed-os.

However, I'm unsure of couple of things that I'd like to check with you:

  1. Do you in general see that mbed-os ldscripts should be overrided, or should I try to push generic board support to mbed-os project instead?

  2. Many boards in platform-ststm32/boards/* define ldscript but apparently they have not been used in mbed builds so far. Is there a risk that this patch will break those builds now as there is a possibility that platform-ststm32/ldscript/* gets used in a build that previously used mbed-os script? I could modify the patch to prioritize mbed-os script insntead of the one defined in ldscript.

ivankravets commented 6 years ago

See http://docs.platformio.org/en/latest/projectconf/section_env_build.html#build-flags You can pass a custom LD script with -Wl,-T/path/to/ld_script.ld. You can also use Built-In variables http://docs.platformio.org/en/latest/projectconf/section_env_build.html#built-in-variables

Thanks for the PR!

tsaarni commented 6 years ago

This overrides LD script at users own project only, so do you mean that generic STM32F030F4 board support should NOT be added to platformio itself?

Thanks for considering.

ivankravets commented 6 years ago

Personally, I don't like this ldscripts common folder between different frameworks. I would avoid it.