dsp: add bootloader

It works!!
This commit is contained in:
Paul Mathieu
2021-04-17 23:13:20 -07:00
parent a864ca3d7e
commit c12c28fb44
5 changed files with 133 additions and 2 deletions

35
dsp/hello.c Normal file
View File

@@ -0,0 +1,35 @@
#include "sys.h"
#define CYCLES_PER_MS 6666 // ish
void busy_sleep_1ms() {
for (int i = 0; i < CYCLES_PER_MS; ++i) {
// nothing
}
}
/** waits a general amount of time */
void busy_sleep(int ms) {
for (int i = 0; i < ms; ++i) {
busy_sleep_1ms();
}
}
int strlen(const char* str) {
int i = 0;
while(str[i] != '\0') {
i++;
}
return i;
}
void log(const char* stuff) {
uart_writen(uart0, stuff, strlen(stuff));
}
int main() {
while(1) {
log("Hello, world!\r\n");
busy_sleep(1000);
}
}