Skip to content

Commit 2f42f50

Browse files
Marcus ChangSeppo Takalo
Marcus Chang
authored and
Seppo Takalo
committed
Provide alternate entry point for bootloader instead of main
Alternate entry point can be used for porting Mbed Bootloader to native SDK builds, effectively turning it into a library.
1 parent 4b5c597 commit 2f42f50

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

mbed_lib.json

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
"value": 3,
2323
"macro_name": "MAX_BOOT_RETRIES"
2424
},
25+
"nonstandard-entrypoint": {
26+
"help": "Set to 1 to turn the Mbed Bootloader application into a library that can be ported to other platforms.",
27+
"value": null,
28+
"macro_name": "MBED_BOOTLOADER_NONSTANDARD_ENTRYPOINT"
29+
},
2530
"show-serial-output": {
2631
"help": "Show boot status and progress on serial output. Disable output to save space on headless devices.",
2732
"value": 1,

source/main.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ const arm_uc_installer_details_t bootloader = {
4040
.layout = BOOTLOADER_STORAGE_LAYOUT
4141
};
4242

43+
#if defined(MBED_BOOTLOADER_NONSTANDARD_ENTRYPOINT)
44+
extern "C"
45+
int mbed_bootloader_entrypoint(void)
46+
#else
4347
int main(void)
48+
#endif
4449
{
4550
// this forces the linker to keep bootloader object now that it's not
4651
// printed anymore

0 commit comments

Comments
 (0)