Skip to content

b-sh/ruos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intro

Just some experimental bare metal rust application targeting tricore architecture based boards.

UseCase:

  • rust for tricore

UseCase not in scope:

  • other frontend languages like clang etc. - will probably do in another repo just to develop/test and debug the llvm tricore integration corretness

Experimental

Idea:

  • Compiling rust code with no_std etc. (minimalistic application) with --emit-llvm
    • "rustc src/main_no_core.rs --emit=llvm-bc --target=tricore-unknown-none-elf"
    • or "rustc src/main_no_core.rs --emit=llvm-ir --target=tricore-unknown-none-elf"
  • Using bitcode to create elf objects for tricore based boards.
    • "llc main_no_core.bc --march=tricore"
    • or "llc main_no_core.ll --march=tricore"
    • creates Assmbler main_no_core.s file
  • Using cargo build for the whole build process
    • "cargo build -Z build-std=core"
  • Ultimate goal is to get some https://github.com/Infineon/AURIX_code_examples running

Exploring several things so direction might change very quick.

Current experiment:

  • minimalistic application build by cargo build for tricore target
    • dependencies custom rustc and llvm repo with tricore experimental state
    • build run "cargo build -Z build-std=core"
    • build fails at the moment
  • rust integration https://github.com/b-sh/rust/tree/bsh/tricore
    • to make the rust aware of the tricore target
    • if everything compiled just fine "rustc --print target-list" will show tricore-unknown-none-elf
  • llvm integration https://github.com/b-sh/llvm-project/tree/bsh/tricore - release/13.x
    • compiled using vagga configuration or just the normal instructions of LLVM
      • warning: it needs around 20GB space for DEBUG build
    • linked into rustc see details in Backend section
  • TODO whole vagga setup for the build process

Details

Frontend

Rust

# Just basing target description on someting similar
rustc +nightly -Z unstable-options --print target-spec-json --target riscv32i-unknown-none-elf >> tricore-unknown-none-elf.json
# And then modified to meet the backend requirements
# Build - this only works because there is a .cargo/config setting the default target
cargo +nightly build -Z build-std=core
# some other way cargo rustc -- --emit=llvm-bc

Using experimental tricore integration https://github.com/b-sh/rust/tree/bsh/tricore.

Backend

LLVM way of choice with backend support in several experimetal repos.

  • Need to make rust aware of custom LLVM otherwise
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --target tricore-unknown-none-elf --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
  --- stderr
  error: Could not create LLVM TargetMachine for triple: tricore: No available targets are compatible with triple "tricore"
# Includes one of the default files in src/bootstrap/defaults
profile = "codegen"
changelog-seen = 2

[target.x86_64-unknown-linux-gnu]
llvm-config = "/path/to/llvm-project/llvm/build/bin/llvm-config"
llvm-filecheck = "/path/to/llvm-project/llvm/build/bin/FileCheck"

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages