We are using Mbed-OS 6.14 with Mbed-CLI2 and CMake to port a bootloader for our custom target.
In “target_overrides” we are simply using “target.restrict_size”: “0x20000” to basically use the managed bootloader. However, when we are compiling the bootloader application, it seems as though the POST_APPLICATION_ADDR macro is not being defined.
@ladislas thanks a lot for the reply and also for additional info. I think it will then also be more prudent for us to still use mbed-cli 1 until 2 is a bit more stable.
I tried to define those additional compiler flags via our top-level CMakeLists.txt, but it did not seem to make any difference. Is the order/location of those defines important in the CMakeLists.txt?
For simplicity, I completely skipped using the ENABLE_BOOTLOADER flag mechanism (like below) to just see if I get those defines. However, if I check mbed_config.cmake in the “cmake_build” directory, I would expect the defines to be there, but they are not.
I have to admit, being fairly new to CMake, all of this is still rather confusing and tbh we don’t have the time to go into the belly of the beast to figure this out. We’d have to wait until mbed-cli2 is apparently more stable.
We managed to get everything compiled and running using mbed-cli 1.
Are there any major reasons not to use mbed-cli2 with mbed-os 6.14 or should we then rather use earlier versions of mbed-os 6 (below 6.5), which are still fully supported by mbed-cli 1 ?
I don’t think so, but you’ll soon fine that CMake really is an improvement and the time invested in “learning” this new tool is really worth it. CMake is used by a whole lot of different projects, so this knowledge is not “just for mbed”.
It should be possible with CMake too, but I currently put them into mbed_app.json:
"config": {
"mbed_app_start": {
"help": "Workaround as target.mbed_app_start is not supported",
"value": "0x08000000",
"macro_name": "MBED_APP_START"
},
"mbed_app_size": {
"help": "Workaround as target.mbed_app_size is not supported",
"value": "0x20000",
"macro_name": "MBED_APP_SIZE"
}
}
They end up in MBED_CONFIG_DEFINITIONS in mbed_config.cmake, so appending to that variable in the main CMake file should also work. This definitely needs to be implemented properly.