aboutsummaryrefslogtreecommitdiff
path: root/src/kern/log.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2021-10-26 00:04:44 -0600
committerJosh Rahm <joshuarahm@gmail.com>2021-10-26 00:04:44 -0600
commitdbbe83bd8882fe18e26f6305a1f425145bfea8db (patch)
treea18e100a31ec6330fd906b4f82820703b3894f26 /src/kern/log.c
parent04da2a442392c5bf3dcf4ca4611f42af7b35e596 (diff)
downloadstm32l4-dbbe83bd8882fe18e26f6305a1f425145bfea8db.tar.gz
stm32l4-dbbe83bd8882fe18e26f6305a1f425145bfea8db.tar.bz2
stm32l4-dbbe83bd8882fe18e26f6305a1f425145bfea8db.zip
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!
Diffstat (limited to 'src/kern/log.c')
-rw-r--r--src/kern/log.c4
1 files changed, 3 insertions, 1 deletions
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, ...)