Add new 'hello world' demo program
This commit is contained in:
parent
2ba26fc7e6
commit
3c2f7518ec
1 changed files with 15 additions and 9 deletions
24
progmem.c
24
progmem.c
|
|
@ -5,16 +5,22 @@
|
|||
#define UART_STATUS *((volatile uint32_t *) 0x00020004)
|
||||
#define UART_DATA *((volatile int32_t *) 0x00020008)
|
||||
|
||||
int main() {
|
||||
UART_BAUD = FREQ / 9600;
|
||||
|
||||
for (;;) {
|
||||
int32_t c;
|
||||
do {
|
||||
c = UART_DATA;
|
||||
} while (c < 0);
|
||||
#define UART_STATUS_TX_READY 0x1
|
||||
#define UART_STATUS_RX_READY 0x2
|
||||
|
||||
static void uart_puts(const char *str) {
|
||||
char c;
|
||||
while ((c = *str++)) {
|
||||
while (!(UART_STATUS & UART_STATUS_TX_READY));
|
||||
UART_DATA = c;
|
||||
LEDS = c;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
UART_BAUD = FREQ / 9600;
|
||||
LEDS = 0xAA;
|
||||
|
||||
for (;;) {
|
||||
uart_puts("Hello, world!\r\n");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue