diff options
author | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2024-05-21 14:02:29 +0200 |
---|---|---|
committer | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2024-05-21 14:02:29 +0200 |
commit | 99a50ce584cd29bcef7ed31cb9d933d0ae2e61ee (patch) | |
tree | 0d7f953848be9435e060e53063276a399359913b /prog | |
parent | cb0be9e2039569ee7d18657e8f675d1f8369b407 (diff) | |
download | riscv_cpu-99a50ce584cd29bcef7ed31cb9d933d0ae2e61ee.tar.gz riscv_cpu-99a50ce584cd29bcef7ed31cb9d933d0ae2e61ee.zip |
test prog
Diffstat (limited to 'prog')
-rw-r--r-- | prog/src/startup.c | 4 | ||||
-rw-r--r-- | prog/src/test_prog.s (renamed from prog/src/prog.s.tst) | 19 |
2 files changed, 8 insertions, 15 deletions
diff --git a/prog/src/startup.c b/prog/src/startup.c index c09f221..2ed3253 100644 --- a/prog/src/startup.c +++ b/prog/src/startup.c @@ -7,10 +7,14 @@ extern unsigned int _estack; // end of .stack section (stack top) void main(void); // main function declaration +// extern void test_prog(void); + void _start(void) __attribute__((section(".text.startup"), naked)); // entry point, cpu starts executing from here void _start(void) { + // test_prog(); + unsigned int *src, *dst; // copy .data section from ROM to RAM diff --git a/prog/src/prog.s.tst b/prog/src/test_prog.s index ec227a9..caa6d8c 100644 --- a/prog/src/prog.s.tst +++ b/prog/src/test_prog.s @@ -1,17 +1,6 @@ .section .text .globl test_prog - -/* - addi t0, zero, 31 -reset_loop: - addi t6, zero, 0 -loop: - addi t6, t6, 1 - beq t6, t0, reset_loop - j loop -*/ - test_prog: li t0, 0xFFFFFFFF li t1, 0x33333333 @@ -44,11 +33,11 @@ branch_eq_ret: j branch_ne_nt branch_ne_ret: - addi sp, sp, -16 # Adjust stack pointer to make space for ra and s0 - sw ra, 0(sp) # Save ra to the stack + addi sp, sp, -16 + sw ra, 0(sp) call func - lw ra, 0(sp) # Load ra from the stack - addi sp, sp, 16 # Restore stack pointer + lw ra, 0(sp) + addi sp, sp, 16 li t0, 0x00100000 sw t1, 0(t0) |