mortbopet / Ripes

A graphical processor simulator and assembly editor for the RISC-V ISA
https://ripes.me/
MIT License
2.57k stars 274 forks source link

Execution stop at call of 'atexit' #367

Open alanmasu opened 2 months ago

alanmasu commented 2 months ago

Hi, I've build the RISC-V toolchain whit NewLib as indicated in the official repository (cause I'll need it), so when I compiled a simple main whit a string copy implemented on, the simulator execute from _start to the call of atexit and then stops the execution without any error o message, and also without calling main.

Here is the code:

void copia_stringa(char source[], char dest[]);

int main(){
    char a [10] = "ciao";
    char b [10] = "";
    copia_stringa(a, b);
    return 0;
}

void copia_stringa(char source[], char dest[]){
    unsigned int i = 0;
    while(source[i] != '\0'){
        dest[i] = source[i];
    }
}

Here I put also the disassembled code (builded whit local tool-chain) and the object file. disass.txt main_elf.txt (change extension to .elf).

There is an issue on the simulator or is a tool-chain configuration issue??

My goal is to simulate the boot stage of the compiled code!

[EDIT] I also need to specify the linker script for allocating ELF sections in a memory map that's different from the default one, so here there is also the linker script: ld_script.txt

Thanks to who respond me, Alan Masutti