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

Let cargo handle the compilation of RISC-V assembly #56

Merged
merged 6 commits into from
Jul 31, 2023
Merged

Conversation

onsdagens
Copy link
Collaborator

@onsdagens onsdagens commented Jul 30, 2023

This adds a binary crate courtesy of @perlindgren which allows us to use cargo to compile the provided RISC-V assembly.

The solution is really funky, via Commands we copy the source file and linker script into the ./riscv_asm binary crate, compile it with cargo build --release , then move the compilation results back into ./ .

The binary crate consists of basically global_asm!(include_str!("<ASM_SOURCE_FILE_PATH>")), and a rustc flag to use the linker script.

I tried making it Windows compatible, but am unable to test it, so would appreciate some help there.

@perlindgren
Copy link
Owner

During compilation the asm.s and memory.x is copied to the riscv_asm folder and run there to generate the binary to execute. This is behavior is currently hardcoded, we can think of improving this procedure when the RISC simulator is compiled as a standalone binary.

Copy link
Owner

@perlindgren perlindgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, no errors, let's merge.

@perlindgren perlindgren merged commit 18403cf into master Jul 31, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants