Skip to content

Build C code for xous operating system #469

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

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

xobs
Copy link
Contributor

@xobs xobs commented Jun 9, 2022

Xous is a new Tier 3 target:

$ rustc +nightly --print target-list | rg xous
riscv32imac-unknown-xous-elf
$

Xous has no C library at all, and relies on compiler-builtins to provide most floating-point math functions. These patches enable C code on this platform.

Note that cc-rs still needs to be updated to support riscv32imac-unknown-xous-elf -- for now any packages will need to set the CC environment variable to point to a valid C compiler.

The "xous" operating system is enturely Rust-based, meaning it has no
libc. Therefore, it relies on `compiler-builtins` for all intrinsics.

Unfortunately, there are not yet Rust equivalents for all C functions.
For example, triganometric functions are still missing. In the meantime,
enable C replacements for these functions so that Rust programs compiled
for Xous can call these functions.

Signed-off-by: Sean Cross <[email protected]>
This adds support for Xous, enabling users to call math functions on
primitives such as `cos()`.

Signed-off-by: Sean Cross <[email protected]>
@Amanieu Amanieu merged commit d79fa6e into rust-lang:master Jun 9, 2022
@Amanieu
Copy link
Member

Amanieu commented Jun 9, 2022

Let me know if you need me to publish a new version of the crate.

@xobs xobs deleted the xous-0.1.74 branch June 10, 2022 03:31
@xobs
Copy link
Contributor Author

xobs commented Jun 10, 2022

Yes, please. A new version would be much appreciated!

@Amanieu
Copy link
Member

Amanieu commented Jun 12, 2022

I published a new release.

tgross35 added a commit to tgross35/compiler-builtins that referenced this pull request Feb 24, 2025
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