diff --git a/arch/arm/src/cortexm3/up_initialstate.c b/arch/arm/src/cortexm3/up_initialstate.c index 9bf65bf57a..951ce1a95f 100644 --- a/arch/arm/src/cortexm3/up_initialstate.c +++ b/arch/arm/src/cortexm3/up_initialstate.c @@ -110,6 +110,16 @@ void up_initial_state(_TCB *tcb) xcp->regs[REG_PIC] = (uint32)tcb->dspace->region; } + + /* Make certain that bit 0 is set in the main entry address. This + * is only an issue when NXFLAT is enabled. NXFLAT doesn't know + * anything about thumb; the addresses that NXFLAT sets are based + * on file header info and won't have bit 0 set. + */ + +#ifdef CONFIG_NXFLAT + tcb->entry.main = (main_t)((uint32)tcb->entry.main | 1); +#endif #endif /* Enable or disable interrupts, based on user configuration */