Dear Rust community,
My goal is to add a tier 3 target option which compiles Rust code for the RTEMS real-time OS (see www.rtems.org/).
So far I managed to add a target spec which allows compiling and linking an RTEMS binary, with
!#[no_std] set for a certain Board Support Package (BSP).
I also read through the development process for adding new targets via Github PRs.
Before I start the PR process with the tier 3 template, I would just like to ask a few question to finish the first version.
The standard RTEMS cross-compiler (i.e.
arm-rtems6-gcc) is only built once, but can generate the object code for many different BSPs with different architecture flags. The processor dependent ABI flags for each BSP are stored in corresponding a pkg-config file.
In my example spec I just hardcoded the BSP specific flags for now, but for a useful setup I would like to have something like the following workflow:
- Set the name of the concrete BSP via an environment variable (e.g. RTEMS_BSP).
- Start the compilation of the user application with cargo
- Read the pkg-config information for the BSP
- Add the flags for
-mfloat-abi, etc. and the BSP include paths to the target options from this information
- Compile the user application
Is this a viable option? I guess this would mean that the core/std library would need to be build with the user program (before the architecture flags are not known)? Is it possible to read pkg-config information from inside the spec file? Reading the environment variable should be possible via std::env, but the pkg-config crate looks like an external dependency.
Any other suggestions would also be greatly appreciated.
PS: I also wasn't sure which communication channel would be the right one. Feel free to point me to a more appropriate channel.