Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: lm32: use semihosting for testing
Instead of the lm32-sys device, use semihosting to print to the host console and exit the test. Signed-off-by: Michael Walle <michael@walle.cc>
- Loading branch information
Showing
5 changed files
with
103 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.text | ||
.global _start, _write, _exit | ||
.global _tc_fail, _tc_pass | ||
|
||
_write: | ||
addi sp, sp, -4 | ||
sw (sp+4), r8 | ||
mvi r8, 5 | ||
scall | ||
lw r8, (sp+4) | ||
addi sp, sp, 4 | ||
ret | ||
|
||
_exit: | ||
mvi r8, 1 | ||
scall | ||
1: | ||
bi 1b | ||
|
||
_tc_pass: | ||
.data | ||
1: | ||
.ascii "OK\n" | ||
2: | ||
.text | ||
addi sp, sp, -16 | ||
sw (sp+4), ra | ||
sw (sp+8), r1 | ||
sw (sp+12), r2 | ||
sw (sp+16), r3 | ||
mvi r1, 1 | ||
mvhi r2, hi(1b) | ||
ori r2, r2, lo(1b) | ||
mvi r3, (2b - 1b) | ||
calli _write | ||
lw r3, (sp+16) | ||
lw r2, (sp+12) | ||
lw r1, (sp+8) | ||
lw ra, (sp+4) | ||
addi sp, sp, 16 | ||
ret | ||
|
||
_tc_fail: | ||
.data | ||
1: | ||
.ascii "FAILED\n" | ||
2: | ||
.text | ||
addi sp, sp, -16 | ||
sw (sp+4), ra | ||
sw (sp+8), r1 | ||
sw (sp+12), r2 | ||
sw (sp+16), r3 | ||
sw (sp+4), ra | ||
mvi r1, 1 | ||
mvhi r2, hi(1b) | ||
ori r2, r2, lo(1b) | ||
mvi r3, (2b - 1b) | ||
calli _write | ||
lw r3, (sp+16) | ||
lw r2, (sp+12) | ||
lw r1, (sp+8) | ||
lw ra, (sp+4) | ||
addi sp, sp, 16 | ||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters