examples: Link HAL targets for startup file and linker script
While an application can provide its own startup file and linker script,
it can instead use default ones from an `mcu-driver-<vendor>` repository
by linking the corresponding `INTERFACE` target. In the examples that
come with the SDK, we use the default target
`mdh-arm-an547-mps3-startup` from
`mcu-driver-reference-platforms-for-arm` for Corstone-300.
The revisions of the `mcu-driver-reference-platforms-for-arm` repository
have been bumped to bring in the aforementioned targets.
Note: The `PRIVATE` keyword has been removed from
`target_link_libraries` of `iotsdk-example-freertos`, because an
executable is final and not linked by anything else anyway. This avoids
the need for `PRIVATE` when subsequently linking the target for startup
file and linker script, because CMake requires scope keywords to be used
or not used consistently.
Note: As before, TF-M and non-TF-M examples cannot be built together
because
* The CMSIS-RTX configuration depends on whether TrustZone is enabled
or not, controlled by the macro `DOMAIN_NS`. It is not possible to have
a single build of RTX that works in both cases.
* For now, they use the same target `mdh-arm-an547-mps3-startup` for
start up file and linker script but require different memory layouts
(controlled by the macros `DOMAIN_NS` and `BL2`). This limitation would
not exist if the TF-M example used the NS linker script from TF-M, but
some pre-main functions in `mcu-driver-hal` (e.g. `mbed_boot()`) need
special symbols (e.g. `__StackTop`) that are not provided by TF-M's NS
linker script. In the future, wrapping of `main()` (and other
"bootstrap" code) should be cleaned up from `mcu-driver-hal`.
Signed-off-by:
Lingkai Dong <lingkai.dong@arm.com>
Loading
Please register or sign in to comment