sys: init MCK early so that it fails even faster

pull/1/head
Felix Kopp 4 years ago
parent 99a51a5dd2
commit 194038882a
No known key found for this signature in database
GPG Key ID: C478BA0A85F75728

@ -23,9 +23,13 @@ extern uint32_t _eheap; /* heap end */
/* implementation in init/main.c */
void do_bootstrap(void);
/* implementation in sys.c */
void sys_init();
void irq_reset(void)
__naked void irq_reset(void)
{
sys_init();
memmove(
&_srelocate,
&_etext,

@ -2,7 +2,13 @@
/* See the end of this file for copyright, licensing, and warranty information. */
#include <arch/hardware.h>
#include <ardix/spinlock.h>
#include <ardix/io.h>
#include <ardix/printk.h>
#include <ardix/sched.h>
#include <ardix/serial.h>
#include <stdint.h>
#include <stddef.h>
@ -21,30 +27,28 @@
*/
void do_bootstrap(void)
{
bool on = true;
uint32_t state = (1 << 27);
uint32_t count = 0;
unsigned int print_count = 0;
sys_init();
REG_PIOB_OER = 1 << 27;
REG_PIOB_PER = 1 << 27;
REG_PIOB_CODR = 1 << 27;
sched_init();
io_init();
REG_PIOB_OER |= state;
REG_PIOB_PER |= state;
/* we'll only let the LED flash for now */
printk("hello, world\n");
while (true) {
if (count++ != 100000)
if (count++ != 1000000)
continue;
if (on) {
REG_PIOB_SODR |= state;
on = false;
} else {
REG_PIOB_CODR |= state;
on = true;
}
print_count++;
if (print_count % 2)
REG_PIOB_CODR = 1 << 27;
else
REG_PIOB_SODR = 1 << 27;
printk("endless loop iteration #%u\n", print_count);
count = 0;
}

Loading…
Cancel
Save