Last active
October 11, 2017 22:38
-
-
Save evancox10/bdd0154374ccc1c33fb0a64f889c54ad to your computer and use it in GitHub Desktop.
Spike Bare Metal Example (Not working)
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
OUTPUT_ARCH( "riscv" ) | |
ENTRY( _start ) | |
SECTIONS | |
{ | |
/* text: test code section */ | |
. = 0x200; | |
.text : { *(.text) } | |
/* data: Initialized data segment */ | |
.data : { *(.data) } | |
/* End of uninitalized data segement */ | |
_end = .; | |
} |
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
test.elf: file format elf32-littleriscv | |
test.elf | |
architecture: riscv:rv32, flags 0x00000112: | |
EXEC_P, HAS_SYMS, D_PAGED | |
start address 0x00000200 | |
Program Header: | |
LOAD off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12 | |
filesz 0x00000218 memsz 0x00000218 flags r-x | |
Sections: | |
Idx Name Size VMA LMA File off Algn | |
0 .text 00000018 00000200 00000200 00000200 2**2 | |
CONTENTS, ALLOC, LOAD, READONLY, CODE | |
SYMBOL TABLE: | |
00000200 l d .text 00000000 .text | |
00000200 g .text 00000000 _start | |
00000218 g .text 00000000 _end | |
Contents of section .text: | |
0200 b7a0a299 938050fd 37413061 13012111 ......P.7A0a..!. | |
0210 b3011100 6f000000 ....o... | |
Disassembly of section .text: | |
00000200 <_start>: | |
200: 99a2a0b7 lui ra,0x99a2a | |
204: fd508093 addi ra,ra,-43 # 99a29fd5 <_end+0x99a29dbd> | |
208: 61304137 lui sp,0x61304 | |
20c: 11210113 addi sp,sp,274 # 61304112 <_end+0x61303efa> | |
210: 001101b3 add gp,sp,ra | |
214: 0000006f j 214 <_start+0x14> |
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
.text | |
.globl _start | |
_start: | |
LUI x1 , 629290 | |
ADDI x1 , x1 , -43 | |
LUI x2 , 398084 | |
ADDI x2 , x2 , 274 | |
ADD x3, x2, x1 | |
1: | |
J 1b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment