// Go!
UART0_CTL_R |= UART_CTL_UARTEN;
+ // Initialize our SysTick prescaler
+ systick_count = initial_systick_count;
+
+ // Initialize the SysTick module
+ NVIC_ST_RELOAD_R = 10000000; // produce 8Hz from 80MHz clock
+ NVIC_ST_CURRENT_R = 0;
+ NVIC_ST_CTRL_R |= 0x7;
+
// infinite loop
for (;;) {
asm("wfi");
data = (data + 1) & 0xFF;
UART0_DR_R = data;
}
+
+__attribute__((isr))
+void systick_isr() {
+ // Divide the SysTick timer by (initial_systick_count+1) since the
+ // system clock is running pretty fast
+ if (systick_count) {
+ systick_count--;
+ return;
+ }
+ systick_count = initial_systick_count;
+
+ // Send a character out the UART for simple testing
+ UART0_DR_R = 'F';
+}