Hi,
I’m somewhat new this whole embedded game so apologies in advance if I’ve made some obvious mistakes here.
I’ve been playing around running in pure assembly on my hifive1 rev B and was trying to test running code from the ITIM. I’ve read the FE310-G002 manual and also tried to look at what the example-itim project does in the freedom-e-sdk, but I don’t think I’ve got it quite right.
I was hoping it would be a case of sticking a “.section .itim” in my file but there’s probably more I’m missing.
Here is my main assembly file:
.section .text
.global _start
_start:
.cfi_startproc
.cfi_undefined ra
# Global Pointer setup
.option push
.option norelax
la gp, __global_pointer$
.option pop
# Stack Pointer setup
la sp, __stack_pointer$
j _testie
.cfi_endproc
My other test file:
.section .itim
.global _testie
_testie:
addi t0, t0, 1
j _testie
my linker script:
OUTPUT_ARCH("riscv")
ENTRY(_start)
MEMORY
{
itim : ORIGIN = 0x8000000, LENGTH = 8K
ram : ORIGIN = 0x80000000, LENGTH = 16K
rom : ORIGIN = 0x20010000, LENGTH = 512M
}
SECTIONS
{
__stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
.text : {
*(.text*)
} > rom
.rodata : {
*(.rodata*)
} > rom
.itim : ALIGN(8) {
*(.itim*)
} > rom
.data : ALIGN(8) {
*(.data*)
. = ALIGN(8);
PROVIDE( __global_pointer$ = . + 0x800 );
} > ram AT > rom
.bss (NOLOAD): ALIGN(8) {
*(.bss*)
*(COMMON)
} > ram
.stack ORIGIN(ram) + LENGTH(ram) - __stack_size : ALIGN(16) {
PROVIDE( __stack_pointer$ = . );
} > ram
}
and these are the options I’m passing to the assembler/linker:
ARCH=rv32imac
ABI=ilp32
EMU=elf32lriscv
ARCHFLAGS=-march=rv32imac -mabi=ilp32
CFLAGS=$(ARCHFLAGS) -g -o0
LDFLAGS=-m $(EMU) -nostartfiles -nostdlib -Tlnk.lds
AS=riscv64-unknown-elf-as
LD=riscv64-unknown-elf-ld
Not sure if there’s anything else I can provide that will be of use