Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile a .c program and load it into instruction memory #2

Open
Unike267 opened this issue Nov 17, 2023 · 1 comment
Open

Compile a .c program and load it into instruction memory #2

Unike267 opened this issue Nov 17, 2023 · 1 comment
Assignees
Labels

Comments

@Unike267
Copy link
Owner

Unike267 commented Nov 17, 2023

Context:

To load a .C program to NEORV32 first we must compile it.
There are many alternatives to make this.

Custom GCC location:

Steps:

  • First, download GCC custom with RISC-V toolchain from the following repository.

  • Then, located in the folder where the program we want to compile is located together with the Makefile, execute:

PATH="/home/usainz/Descargas/riscv32-unknown-elf.gcc-12.1.0/bin/:$PATH" make install

The command PATH="/../:$PATH" instructs the system where to search for a program to run.
In this case, the custom GCC binary executables are indicated.
Therefore, the compilation is going to be done through this custom GCC.
The command make is used to automate the build process through the Makefile.
The command install is a target of the command make.
In this case install target will compile, generate and install VHDL IMEM boot image (for application, no header) both in the local folder and in neorv32/rtl/core.

@Unike267 Unike267 self-assigned this Nov 17, 2023
@Unike267
Copy link
Owner Author

Unike267 commented Mar 8, 2024

Container

Other Alternative is through a container:

In this case you don't need to download any RISC-V toolchain or C compiler.
You just need a engine to pull and run containers.
Such as podman or docker.

You can find the container with all the tools to compile a .C program for the NEORV32 in the following location:

ghcr.io/stnolting/neorv32/sim

Pull the image and run the following code:

podman run --rm -itv $(pwd):/wrk:Z -w /wrk stnolting/neorv32/sim  make -C sw/example/{ANY_SW_FOLDER} clean_all MARCH=rv32imac_zicsr_zifencei info all

In this case podman is used but it would be equivalent for docker.

Also, you can find a RISC-V docker official image for debian from dockerhub:

riscv64/debian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant