test.c 516 B

1234567891011121314151617181920212223242526
  1. /* A simple program for testing the CPU trace feature.
  2. * Doesn't matter what it does, as long as it runs for a sufficient amount of time.
  3. * The program is linked with the linker script of 2nd stage bootloader, and gets
  4. * run from the boot ROM.
  5. */
  6. int fib(int n)
  7. {
  8. if (n <= 1) {
  9. return n;
  10. }
  11. return fib(n - 1) + fib(n - 2);
  12. }
  13. void done()
  14. {
  15. /* serves as a breakpoint target for the debugger */
  16. }
  17. void entry(void)
  18. {
  19. for (int i = 0; i < 10; ++ i) {
  20. fib(10);
  21. }
  22. done();
  23. }