Hey there!
I just got my HiFive1 and right now I am reading the documentation in preparation to start developing for the board. I’ve come up with the following questions, which I have not been able to answer on my own.
This is a very simple program I’ve written, which is supposed to enable the blue led and turn it on:
.section .text
.globl _start
_start:
li t0, 0x10012000
li t1, 0x200000
sw t1, 0x08(t0)
sw t1, 0x0C(t0)
sw t1, 0x40(t0)
It assembles without errors using the riscv64-unknown-elf-as with no additional parameters.
-
The assembled file is rather big with 864 bytes. The instructions themselves should only take up 20 bytes, so where is all that other data coming from?
a.out: file format elf64-littleriscv Disassembly of section .text: 0000000000000000 <_start>: 0: 100122b7 lui t0,0x10012 4: 00200337 lui t1,0x200 8: 0062a423 sw t1,8(t0) # 10012008 <_start+0x10012008> c: 0062a623 sw t1,12(t0) 10: 0462a023 sw t1,64(t0)
-
Do I really need to specify the .text segment, if I am writing a privileged program?
-
When I try to upload to the board I get the following error message:
$RISCV_OPENOCD_PATH/bin/openocd -f freedom-e-sdk/bsp/sifive-hifive1/openocd.cfg -c "program ./a.out verify reset exit" Error: invalid ELF file, only 32bits files are supported
Is this an error on my side? And if yes, how would I go about fixing it?
-
Is there a specific memory address, where the program is loaded from the flash on bootup? I have not found a answer in the manual yet
Thanks in advance!