mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-08-15 23:50:23 +02:00
refactor: enforce 8-line Reset_Handler limit across CBM drivers
Extract _late_init() wrappers in 0x04, 0x05, 0x0b, 0x0d, 0x0e, 0x0f to keep Reset_Handler within the max 8 code-line standard.
This commit is contained in:
@@ -50,7 +50,7 @@ extern uint32_t __data_end;
|
||||
* @brief Copy initialized data and RAM-resident code from flash to RAM.
|
||||
* @retval None
|
||||
*/
|
||||
void data_copy_init(void)
|
||||
static void _data_copy_init(void)
|
||||
{
|
||||
uint32_t *src = &__data_lma;
|
||||
uint32_t *dst = &__data_start;
|
||||
@@ -58,11 +58,20 @@ void data_copy_init(void)
|
||||
*dst++ = *src++;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize stack pointers and copy .data section to RAM.
|
||||
* @retval None
|
||||
*/
|
||||
void ram_init(void)
|
||||
{
|
||||
stack_init();
|
||||
_data_copy_init();
|
||||
}
|
||||
|
||||
void __attribute__((naked, noreturn)) Reset_Handler(void)
|
||||
{
|
||||
__asm__ volatile (
|
||||
"bl stack_init\n\t"
|
||||
"bl data_copy_init\n\t"
|
||||
"bl ram_init\n\t"
|
||||
"bl xosc_init\n\t"
|
||||
"bl xosc_enable_peri_clk\n\t"
|
||||
"bl reset_init_subsystem\n\t"
|
||||
|
||||
Reference in New Issue
Block a user