123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #include "sys.h"
- #include "picorv32.h"
- #define GP_IS_ZERO 1
-
- // The linker ensures that section .init is first
- .section ".init.reset","ax"
- .globl _reset
- _reset:
- rdtime s0 // Record timer at reset
- j __start
- .type _reset, @function
- .size _reset, . - _reset
- .section ".init","ax"
- .globl __start
- __start:
- li sp,STACK_TOP // Cheaper than using la sp,___stack_top
- not t0,zero
- maskirq zero,t0,zero
- #if !GP_IS_ZERO
- .option push
- .option norelax // Can't make gp references to set up gp...
- la gp, __global_pointer$
- .option pop
- #else
- // Zero gp (linker will usually replace with the zero reg)
- li gp,0
- #endif
- addqxi gp,gp,0 // Set gp for interrupt code too
- la a0,__BSS_START__
- li a1,0
- la a2,__BSS_LEN__
- jal memset
- sw s0, time_zero, t0
- j main
- .type __start, @function
- .size __start, . - __start
- .pushsection ".sbss","a"
- .balign 4
- .globl time_zero
- time_zero:
- .space 4
- .type time_zero, @object
- .size time_zero, . - time_zero
- .popsection
- .section ".stack","aw",@nobits
- .balign 4
- .globl ___stack_bottom
- ___stack:
- .space STACK_SIZE
- .type ___stack, @object
- .size ___stack, STACK_SIZE
- .globl ___stack_top
- ___stack_top:
|