hello.c 561 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <stddef.h>
  2. #include <stdint.h>
  3. #define IODEVB(d,r) (*(volatile uint8_t *)(0xfffffc00+((d) << 6)+((r) << 2)))
  4. #define LED IODEVB(0,0)
  5. #define CONSOLE IODEVB(1,0)
  6. void die(void)
  7. {
  8. while (1)
  9. ;
  10. }
  11. void _start(void)
  12. {
  13. static const char hello[] = "Hello, World!\r\n";
  14. const char *p;
  15. uint8_t led = 0;
  16. while ( 1 )
  17. LED = led++;
  18. #if 0
  19. LED = led = 0;
  20. for (p = hello; *p; p++)
  21. CONSOLE = *p;
  22. while ( 1 ) {
  23. for (int x = 0; x < 1000000; x++)
  24. /* nothing */;
  25. LED = ++led;
  26. }
  27. #endif
  28. die();
  29. }