Compile rust for the moxie virtual instruction set

I have an HSM which is running Moxie. The vendor of the HSM provides a C library that can be compiled for Moxie, which results in an .elf file that can then be loaded onto the ship and executed. The HSM itself has about 64MB of RAM and 4MB of flash storage.

I would like to be able to write rust programs that get executed on the HSM and hence I am looking for a way to compile rust source for Moxie. Ideally it would be possible to interface with the C library at the same time and include it in the compilation step.

Any help on this would be appreciated.

This page describes it works for the current version of the HSM. Effectively there is an operating system called BOLOS which abstracts over the HSM and allows users to run applications on top of that operating system.

I am not completely clear yet how this will work for the newer versions. My assumption is that instead of deploying an application I will build something akin to the operating system and deploy that.

first step would be LLVM support for the architecture

for the rest it makes sense to look at the process for RISC-V, for example here’s a list of steps for adapting rust to a new architecture: https://www.reddit.com/r/rust/comments/949p0e/rustc_support_for_the_riscv_isa/e3k0421/