hello.c 509 B

12345678910111213141516171819202122232425262728293031323334
  1. #include <stddef.h>
  2. #include <stdint.h>
  3. #include "io.h"
  4. void die(void)
  5. {
  6. while (1)
  7. ;
  8. }
  9. void _start(void)
  10. {
  11. static const char hello[] = "Hello, World!\r\n";
  12. const char *p;
  13. uint8_t led = 0;
  14. con_set_baudrate(115000);
  15. set_led(led = 0);
  16. for (p = hello; *p; p++)
  17. CONSOLE = *p;
  18. while ( 1 ) {
  19. for (int x = 0; x < 10000000; x++)
  20. /* nothing */;
  21. led = (led << 1) | ((~led >> 2) & 1);
  22. set_led(led);
  23. udelay(400000);
  24. CONSOLE = '*';
  25. }
  26. die();
  27. }