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:
Kevin Thomas
2026-04-05 21:29:31 -04:00
parent 1b4dfb3af4
commit e6d8ab4850
6 changed files with 70 additions and 16 deletions

View File

@@ -31,6 +31,17 @@
extern int main(void);
/**
* @brief Initialize late peripherals (PWM and coprocessor).
* @retval None
*/
void _late_init(void)
{
pwm_release_reset();
pwm_init();
coprocessor_enable();
}
void __attribute__((naked, noreturn)) Reset_Handler(void)
{
__asm__ volatile (
@@ -40,9 +51,7 @@ void __attribute__((naked, noreturn)) Reset_Handler(void)
"bl reset_init_subsystem\n\t"
"bl uart_release_reset\n\t"
"bl uart_init\n\t"
"bl pwm_release_reset\n\t"
"bl pwm_init\n\t"
"bl coprocessor_enable\n\t"
"bl _late_init\n\t"
"b main\n\t"
);
}

View File

@@ -31,6 +31,17 @@
extern int main(void);
/**
* @brief Initialize late peripherals (servo and coprocessor).
* @retval None
*/
void _late_init(void)
{
servo_release_reset();
servo_init();
coprocessor_enable();
}
void __attribute__((naked, noreturn)) Reset_Handler(void)
{
__asm__ volatile (
@@ -40,9 +51,7 @@ void __attribute__((naked, noreturn)) Reset_Handler(void)
"bl reset_init_subsystem\n\t"
"bl uart_release_reset\n\t"
"bl uart_init\n\t"
"bl servo_release_reset\n\t"
"bl servo_init\n\t"
"bl coprocessor_enable\n\t"
"bl _late_init\n\t"
"b main\n\t"
);
}

View File

@@ -31,6 +31,16 @@
extern int main(void);
/**
* @brief Initialize late peripherals (SPI reset and coprocessor).
* @retval None
*/
void _late_init(void)
{
spi_release_reset();
coprocessor_enable();
}
void __attribute__((naked, noreturn)) Reset_Handler(void)
{
__asm__ volatile (
@@ -38,10 +48,9 @@ void __attribute__((naked, noreturn)) Reset_Handler(void)
"bl xosc_init\n\t"
"bl xosc_enable_peri_clk\n\t"
"bl reset_init_subsystem\n\t"
"bl spi_release_reset\n\t"
"bl uart_release_reset\n\t"
"bl uart_init\n\t"
"bl coprocessor_enable\n\t"
"bl _late_init\n\t"
"b main\n\t"
);
}

View File

@@ -31,6 +31,17 @@
extern int main(void);
/**
* @brief Initialize late peripherals (timer tick and coprocessor).
* @retval None
*/
void _late_init(void)
{
timer_release_reset();
timer_tick_init();
coprocessor_enable();
}
void __attribute__((naked, noreturn)) Reset_Handler(void)
{
__asm__ volatile (
@@ -40,9 +51,7 @@ void __attribute__((naked, noreturn)) Reset_Handler(void)
"bl reset_init_subsystem\n\t"
"bl uart_release_reset\n\t"
"bl uart_init\n\t"
"bl timer_release_reset\n\t"
"bl timer_tick_init\n\t"
"bl coprocessor_enable\n\t"
"bl _late_init\n\t"
"b main\n\t"
);
}

View File

@@ -31,6 +31,16 @@
extern int main(void);
/**
* @brief Initialize late peripherals (watchdog tick and coprocessor).
* @retval None
*/
void _late_init(void)
{
watchdog_tick_init();
coprocessor_enable();
}
void __attribute__((naked, noreturn)) Reset_Handler(void)
{
__asm__ volatile (
@@ -40,8 +50,7 @@ void __attribute__((naked, noreturn)) Reset_Handler(void)
"bl reset_init_subsystem\n\t"
"bl uart_release_reset\n\t"
"bl uart_init\n\t"
"bl watchdog_tick_init\n\t"
"bl coprocessor_enable\n\t"
"bl _late_init\n\t"
"b main\n\t"
);
}

View File

@@ -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"