Skip to content

Commit 0f7183f

Browse files
committed
Retarget - main - invoke serial init
Some toolchains might not call open() for stdio handle prior main, which breaks usage: ``` void app_start(int, char**) { Serial pc(tx, rx); pc.baud(115200); printf("sss \n"); //open stdio might happen here } ```
1 parent de80b3f commit 0f7183f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

source/retarget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ extern "C" void __iar_argc_argv() {
493493
// the user should set up their application in app_start
494494
extern void app_start(int, char**);
495495
extern "C" int main(void) {
496+
// init serial if it has not been invoked prior main
497+
init_serial();
496498
minar::Scheduler::postCallback(
497499
mbed::util::FunctionPointer2<void, int, char**>(&app_start).bind(0, NULL)
498500
);

0 commit comments

Comments
 (0)