Rust for RTEMS [was: Re: Interested for GSoC 2023]

Karel Gardas karel at functional.vision
Mon Feb 27 11:00:05 UTC 2023


adjusting subject based on Jan request. Keeping whole Rust relevant 
comments in.

On 2/27/23 11:07, Jan.Sommer at dlr.de wrote:
> 
> 
>> -----Original Message-----
>> From: devel <devel-bounces at rtems.org> On Behalf Of Karel Gardas
>> Sent: Montag, 27. Februar 2023 09:16
>> To: joel at rtems.org; Vihas Makwana <makvihas at gmail.com>
>> Cc: rtems-devel at rtems.org <devel at rtems.org>
>> Subject: Re: Interested for GSoC 2023
>>
>> On 2/27/23 02:16, Joel Sherrill wrote:
>>> Another GCC related project could be Rust RTEMS Support but I don't
>>> know what that entails beyond turning it on and seeing what goes
>>> wrong. I tried to build it last year and got far enough to decide to
>>> wait before trying again.
>>
>> Not sure how far you went. The process is generally:
>>
>> (1) tune Rust compiler to cross-compile correctly for specific hardware/os
>> platform. So basically you get no_std capable compiler
>>
>> (2) review, patch and by using (1) cross-compile libc
>>
>> (3) using sources from (1) and (2) build full stage (std enabled) rustc.
>>
>> (4) tweak and tune tools (rustup/cargo etc.) whenever required to smooth
>> sharp edges for RTEMS.
>>
>> Here, I'm nearly finished with (1) for arm-rtems (e.g. cortex-aX not cortex-
>> mX).
>>
> 
> Hi Karel,
> 
> Very interesting work. I am currently trying to reach the same goal.
> The steps I came up with are a bit different:
> A.) Build working llvm toolchain for RTEMS (figure out all flags etc., maybe building RTEMS with llvm as a bonus)
> B.) Build rustc with the "RTEMS-llvm" as backend

Honestly I'm not so sure (A) and (B) are necessary for rustc port. Or 
perhaps I do not precisely follow what you mean, but IMHO what you need 
is to get ABI and linking with RTEMS binaries right. And this applies 
also to RTEMS being build by GCC toolchain. This is objective of my (1) 
work.

> C.) Start with no_std and then inch forward to building the stdlib
> 
> I work currently on step A (see my llvm experiments in the other thread) and started to look at the build stages for rustc.
> If you have any tips for the configuration from your step (1), it would be greatly appreciated.
> My hope is that with the results of step A I can reuse the libc from the standard rtems-gcc build environment as this is provided conveniently via rsb.

Not sure if I did not confused you with my (2) libc remark. I of course 
mean Rust's libc (that means rust code) to be build on top of 
RTEMS/Newlib/libbsd combination. It'll be interesting project especially 
if the requirement later would be to support both binary targets: e.g. 
RTEMS without libbsd (for smaller systems) and RTEMS with libbsd for 
full-blown configuration. Anyway, for now, I would start with libbsd as 
this should make project proceeding faster IMHO.

> I am really looking forward to seeing rust supported on RTEMS.

Me too!

Karel



More information about the devel mailing list