6 years, 7 months ago.

Question about custom targets

Hi,

I'm working with mbed code that was developed with mbed 2.0 and the build process uses exported Makefiles for GCC ARM toolchain.

After several device revisions and a recent platform port, managing all the flags and Makefiles is becoming quite a task! So I'm trying to port our build process over to mbed CLI so it's all automatically managed.

However, I have a few questions about how customizable the build process for mbed is.

In the release form, the main application must be merged with a bootloader to facilitate in-field firmware upgrades. To accomplish this, we use two linker scripts, one for the bootloader (starting at address 0 for example) and then one for the application (starting at 1KB for example) so they can be merged without conflict.

I'm not sure how mbed CLI handles multiple linker scripts. Could I set up custom targets in the following folder structure:

-> TARGET_CUSTOM

- - - -> TARGET_CUSTOM_BOOTLOADER

- - - -> TARGET_CUSTOM_APPLICATION

Each subfolder would have the corresponding linker script. Would mbed CLI know to pull that linker script instead of one from another directory? How else could one accomplish this?

I know there's the ability to use binary hooks after a build has completed to perform some other functions (like merging hex files, etc). I'm very interested in getting this set up so I can get back to writing C/C++ instead of fixing Makefiles!

1 Answer

6 years, 6 months ago.

Hi George, I'm speaking with my fellow team members about your question and I'll get back to you shortly!

Edit: Hi again, here's what I've found:

  • Mbed OS doesn't currently support building 2 applications within the same project, so a way to overcome that is to create 2 projects, each with their own copy of Mbed OS.
  • Rather than modifying the linker scripts, you can use the "unmanaged bootloader" build method: https://docs.mbed.com/docs/mbed-os-handbook/en/latest/advanced/bootloader/#unmanaged-bootloader
    • There are two configuration options available for changing the link location: target.mbed_app_start and target.mbed_app_size

Thank you,

- Jenny, team Mbed