Skip to content

Commit de3e25f

Browse files
stack pointer fixing
1 parent 2f22c3d commit de3e25f

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ nix-shell -p imagemagick --run "convert frame.ppm frame.png"
130130

131131
.\xpack-riscv-none-elf-gcc-15.2.0-1\bin\riscv-none-elf-gcc.exe -c -O0 -march=rv32i -mabi=ilp32 ./programs/hello.c -o ./programs/hello.o
132132

133-
.\xpack-riscv-none-elf-gcc-15.2.0-1\bin\riscv-none-elf-gcc.exe -march=rv32i -mabi=ilp32 -nostdlib "-Wl,--section-start=.text=0x0" -o ./programs/hello.elf ./programs/hello.o
133+
.\xpack-riscv-none-elf-gcc-15.2.0-1\bin\riscv-none-elf-gcc.exe -march=rv32i -mabi=ilp32 -nostdlib "-Wl,--section-start=.text=0x0,--entry=_start" -o ./programs/hello.elf ./programs/hello.o
134134

135135
.\xpack-riscv-none-elf-gcc-15.2.0-1\bin\riscv-none-elf-objcopy.exe -O binary ./programs/hello.elf ./programs/hello.bin
136136

programs/hello.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
__attribute__((naked)) void _start(void) {
2+
__asm__ volatile (
3+
"li sp, 0x8000\n" // top of 32KB RAM
4+
"call main\n"
5+
"loop: j loop\n"
6+
);
7+
}
8+
19
int main() {
210
volatile unsigned char* mem = (volatile unsigned char*)0x4000;
311
int counter = 0;

src/test/scala/RISCV/MainSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class MainSpec extends AnyFreeSpec with Matchers with ChiselSim {
3232
dut.clock.step(1)
3333

3434
dut.io.execute.poke(true.B)
35-
dut.clock.step(100)
35+
dut.clock.step(64)
3636
}
3737
}
3838

0 commit comments

Comments
 (0)