Question about non-XIP boot


Tidy(ChunHua) Jiang <tidyjiang@...>
 

Hi All,

I'm reading the boot code for cortex-m, but confused about something,
please help me.

Before jumping to C code:

void _PrepC(void)
{
relocate_vector_table();
enable_floating_point();
_bss_zero();
_data_copy();
_Cstart();
CODE_UNREACHABLE;
}

---------------------------------------------------------

#ifdef CONFIG_XIP
static inline void relocate_vector_table(void) { /* do nothing */ }
#else
static inline void relocate_vector_table(void)
{
/* vector table is already in SRAM, just point to it */
_scs_relocate_vector_table((void *)CONFIG_SRAM_BASE_ADDRESS);
}
#endif

-----------------------------------------------------------

In non-XIP mode, from my view, before relocate vector table to RAM, we
should copy the data from flash to RAM. But above code firstly relocates
and then copy data, why ?

Thx & Rgds.

Join devel@lists.zephyrproject.org to automatically receive all group messages.