Skip to content

Commit 783ed7a

Browse files
Merge pull request #297 from janderholm/long_jump_main
Use la/jr pseudoinstructions for main function call
2 parents 785eb92 + d470afd commit 783ed7a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

riscv-rt/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Main function no longer needs to be close to _start. A linker script may copy
13+
all code to RAM and keep .init in flash/ROM.
14+
1015
## [v0.15.0] - 2025-06-10
1116

1217
### Added

riscv-rt/src/asm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ cfg_global_asm!(
217217
ld a1, 8 * 1(sp)
218218
ld a2, 8 * 2(sp)
219219
addi sp, sp, 8 * 4",
220-
"jal zero, main
220+
"la t0, main
221+
jr t0
221222
.cfi_endproc",
222223
);
223224

0 commit comments

Comments
 (0)