Skip to content

Commit 40aab32

Browse files
ioannisgnashif
authored andcommitted
Revert "kernel: init: activate FPU for main thread"
Activating K_FP_REGS flags introduces stack memory overhead for the main thread in Cortex-M architecture. Several ARM platforms experience main thread stack overflows when building with FPU_SHARING=y. Enabling FPU sharing in main thread should not be the default configuration. Users are welcome to enable FP sharing on the main thread in the application code, in main(). This reverts commit 8453a73. Signed-off-by: Ioannis Glaropoulos <[email protected]>
1 parent 2bf26ec commit 40aab32

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

kernel/init.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ static void init_idle_thread(int i)
241241
static char *prepare_multithreading(void)
242242
{
243243
char *stack_ptr;
244-
uint32_t opt;
245244

246245
/* _kernel.ready_q is all zeroes */
247246
z_sched_init();
@@ -258,18 +257,11 @@ static char *prepare_multithreading(void)
258257
*/
259258
_kernel.ready_q.cache = &z_main_thread;
260259
#endif
261-
262-
opt = K_ESSENTIAL;
263-
#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
264-
/* Enable FPU in main thread */
265-
opt |= K_FP_REGS;
266-
#endif
267-
268260
stack_ptr = z_setup_new_thread(&z_main_thread, z_main_stack,
269261
CONFIG_MAIN_STACK_SIZE, bg_thread_main,
270262
NULL, NULL, NULL,
271263
CONFIG_MAIN_THREAD_PRIORITY,
272-
opt, "main");
264+
K_ESSENTIAL, "main");
273265
z_mark_thread_as_started(&z_main_thread);
274266
z_ready_thread(&z_main_thread);
275267

0 commit comments

Comments
 (0)