Code: Select all
.text
MEMORY
{
ram (rwx) : ORIGIN = 0x00000000, LENGTH = 0x003E8000
}
STACK_SIZE = 0xFFFF;
SECTIONS
{
.text :
{
KEEP(*(.vector*))
*(.text*)
} > ram
.bss (NOLOAD) :
{
*(.bss*)
*(COMMON)
} > ram
.data :
{
*(.data*);
} > ram
.stack (NOLOAD) :
{
. = ALIGN(8);
. = . + STACK_SIZE;
. = ALIGN(8);
} > ram
__global_pointer$ =. + 0x10000;
}
< /code>
und meine aktuelle Init-Funktion: < /p>
extern "C"
{
void riscvcoreinitfunction()
{
asm volatile
(" .option push \t\n\
.option norelax \t\n\
1:auipc gp, %pcrel_hi(__global_pointer$) \t\n\
addi gp, gp, %pcrel_lo(1b) \t\n\
.option pop \t\n\
");
asm volatile("" ::: "memory");
main();
}
}
< /code>
Und das nenne ich G ++: < /p>
riscv64-unknown-elf/bin/riscv64-unknown-elf-g++ -nostartfiles -march=rv32i -mabi=ilp32 -T linkerscript.ld -o bin.elf
< /code>
Ich habe online ein Tutorial für die Implementierung von Newlib in meiner Plattform gefunden, aber es funktioniert nicht wirklich für mich und fehlt Details wie die Variablen, die ich in meinem LinkerScript benötige. Auch im Tutorial sind Dinge wie SBRK undefiniert, wo sie in meinem Programm aus irgendeinem Grund irgendwie eine Implementierung haben. (Wie kann ich sie bei Bedarf ersetzen?)
Kann mich jemand unterstützen, um Unterstützung für alle erforderlichen grundlegenden C/C ++ - Features und STL -Funktionen hinzuzufügen?