2
0

head.S 821 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "sys.h"
  2. #include "picorv32.h"
  3. // The linker ensures that section .init is first
  4. .section ".init.reset","ax"
  5. .globl _reset
  6. _reset:
  7. rdtime t0 // Record timer at reset
  8. li sp,STACK_TOP // Cheaper than using la sp,___stack_top
  9. .option push
  10. .option norelax // Can't make gp references to set up gp...
  11. la gp, __global_pointer$
  12. .option pop
  13. addqxi gp,gp,0 // Set gp for interrupt code too
  14. sw t0, time_zero, t1
  15. j _start
  16. .type _reset, @function
  17. .size _reset, . - _reset
  18. .pushsection ".sdata","a"
  19. .balign 4
  20. .globl time_zero
  21. time_zero:
  22. .long 0
  23. .type time_zero, @object
  24. .size time_zero, . - time_zero
  25. .popsection
  26. .section ".stack","aw",@nobits
  27. .balign 4
  28. .globl ___stack_bottom
  29. ___stack:
  30. .space STACK_SIZE
  31. .type ___stack, @object
  32. .size ___stack, STACK_SIZE
  33. .globl ___stack_top
  34. ___stack_top: