extremely "cpu bring-up" c

static volatile long *DEBUG_PUTC = (volatile long *) 0x12345678;

void __attribute__((noinline)) debug_puts(const char *s) {
    while (*s != '\0') {
        *DEBUG_PUTC = *s++;
    }
}

void __attribute__((section(".entry"))) main() {
    *DEBUG_PUTC = '1';
    *DEBUG_PUTC = '\n';
    debug_puts("hello, world!\n");
    *DEBUG_PUTC = '2';
    *DEBUG_PUTC = '\n';
    debug_puts("from c code :3\n");
    *DEBUG_PUTC = '3';
    *DEBUG_PUTC = '\n';

    while (1) {}
}
syntax highlighting by codehost

You must log in to comment.

in reply to @bark's post: