From 2478a549b9f64c50310da41c861b8f86fdea2861 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Tue, 24 Nov 2020 00:38:09 -0700 Subject: Add new system for startup. Now instead of init() and main() being responsible for all initialization, individual modules can link in their own initialization routines. There are 7 levels for these initializiation routines. So far these are how the levels are defined level 0 - Here the world is dark. Nothing is initialized. This level is responsible for initializing the system clock. level 1 - The system clock has been configured, but nothing else. Not even global variables. This level is responsible for loading the data sections from flash and clearing the .bss section. level 2 - USART2 is enabled and set to be the main kernel logging vehicle. From this point on klogf(...) can be used. level 3 - The NVIC is reset to point to the flash. From this point on interrupts can be received. I expect this is where most core initialization routines will take place levels 4 to 7 - User initializiation levels. main - main() is called after all 8 initialization levels have executed, so in a sense main() is like a 9th initialization level, except that there is can be only one main() routine whereas there can be multiple initalization routines per level. --- 02-usart/include/arch/stm32l4xxx/peripherals/clock.h | 2 ++ 02-usart/include/arch/stm32l4xxx/peripherals/usart.h | 3 +++ 2 files changed, 5 insertions(+) (limited to '02-usart/include/arch') diff --git a/02-usart/include/arch/stm32l4xxx/peripherals/clock.h b/02-usart/include/arch/stm32l4xxx/peripherals/clock.h index 6e461de..6f628fd 100644 --- a/02-usart/include/arch/stm32l4xxx/peripherals/clock.h +++ b/02-usart/include/arch/stm32l4xxx/peripherals/clock.h @@ -123,4 +123,6 @@ int configure_pll( pllm_divisor_t pllm, /* PLL denominator. */ pll_src_t pllsrc /* PLL source */); +uint8_t get_clock_mhz(); + #endif /* CORE_CLOCK_H__ */ diff --git a/02-usart/include/arch/stm32l4xxx/peripherals/usart.h b/02-usart/include/arch/stm32l4xxx/peripherals/usart.h index e42e31e..a1542f4 100644 --- a/02-usart/include/arch/stm32l4xxx/peripherals/usart.h +++ b/02-usart/include/arch/stm32l4xxx/peripherals/usart.h @@ -3,6 +3,7 @@ #include #include +#include #include "kern/common.h" #include "arch/stm32l4xxx/peripherals/rcc.h" @@ -197,5 +198,7 @@ void usart_transmit_str_sync(__IO usart_t* usart, const char* str); void usart_printf(__IO usart_t* usart, const char* fmt, ...); +void usart_vprintf(__IO usart_t* usart, const char* fmt, va_list l); + #endif /* H__USART_ */ -- cgit