Skip to content

Commit e205044

Browse files
committed
m-profile: Support picolibc startup mechanism
We don't need to use __cmsis_start when using picolibc; we can call main directly. Signed-off-by: Keith Packard <keithp@keithp.com>
1 parent 06d952b commit e205044

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

CMSIS/Core/Include/m-profile/cmsis_gcc_m.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
/* ######################### Startup and Lowlevel Init ######################## */
3333
#ifndef __PROGRAM_START
3434

35+
#ifdef __PICOLIBC__
36+
#include <picotls.h>
37+
#endif
38+
3539
/**
3640
\brief Initializes data and bss sections
3741
\details This default implementations initialized all data and additional bss
@@ -71,7 +75,19 @@ __STATIC_FORCEINLINE __NO_RETURN void __cmsis_start(void)
7175
}
7276
}
7377

78+
#ifdef __PICOLIBC__
79+
/* Space for errno and tcb */
80+
static int __tls_area[3];
81+
extern void *__tls[1];
82+
__tls[0] = __tls_area;
83+
84+
extern int main(void);
85+
(void) main();
86+
87+
for(;;);
88+
#else
7489
_start();
90+
#endif
7591
}
7692

7793
#define __PROGRAM_START __cmsis_start

0 commit comments

Comments
 (0)