From dbbe83bd8882fe18e26f6305a1f425145bfea8db Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Tue, 26 Oct 2021 00:04:44 -0600 Subject: Fixed annoying bug with bootup when compiling with new GCC. The problem was the BSS segment was not aligned with size 4, thus the routine to clear the BSS segment was infinite looping, clobbering everything in it's wake until it ran off the memory edge and caused a hard fault. This commit does a couple of things. 1. Fixes the alignment issue in the linker script 2. Panics if the bss/data segments are not aligned properly 3. Makes the logging the _first_ thing to initialize. Much easier to debug that way! --- src/kern/log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/kern/log.c') diff --git a/src/kern/log.c b/src/kern/log.c index e9bd424..e6bbec6 100644 --- a/src/kern/log.c +++ b/src/kern/log.c @@ -12,12 +12,14 @@ void setup_usart2(uint32_t baud_rate); /** This module requires an initialization routine. This is a level2 routine, * so anything running at level3 or lower is guaranteed to have access * to the klong. */ -init2() +void initialize_logging() { setup_usart2(115200); regset(USART2.c_r1, usart_txeie, 1); regset(USART2.c_r1, usart_rxneie, 1); usart_set_enabled(&USART2, USART_ENABLE_TX | USART_ENABLE_RX); + + klogf("Logging has been initalized!\n"); } void klogf(const char* fmt, ...) -- cgit