namniart

Jun 15, 2018 - Rust on MSP430, Part 2

Continuing the previous post about Rust on the MSP430

I found that it looks like I should use the MSP430 compiler from TI instead of the version from the Ubuntu repository, so I downloaded TI’s MSP430 compiler. This required signing up for a TI account (I already had one) and agreeing to some fairly substaintal export restrictions (I’m a US citizen so not a big deal for me, but probably a big deal for people outside of the US).

The TI compiler installed into ~/ti/msp430-gcc, so I edited my bashrc to add the bin directory within the install to my path: export PATH=$PATH:$HOME/ti/msp430-gcc/bin. TI’s compiler includes an executable named msp430-elf-gcc, so I also removed my previous hack to make msp430-gcc into msp430-elc-gcc.

Running xargo rustc --target=msp430-none-elf --release succeeded!

It doesn’t seem like that compiled the msp430-quickstart project; the target directory in the project exists, but there aren’t any binaries in it. I think there’s something else that I need to do to finish the compilation process. I think xargo rustc only built a rust cross-compiler for the MSP430; I think I still need to find a way to invoke that compiler to build the project.

Looking at a more complex project, the AT2XT, they have their source code in the src directory, so I copied examples/blinky.rs to src/main.rs (not sure if the name is important or not). Now, doing xargo build --target=msp430-none-elf --release seems to make more progress and fails with:

   Compiling msp430-rt v0.1.2
error[E0522]: definition of an unknown language item: `panic_fmt`
 --> /home/austin/.cargo/registry/src/github.com-1ecc6299db9ec823/msp430-rt-0.1.2/src/lang_items.rs:3:1
  |
3 | #[lang = "panic_fmt"]
  | ^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `panic_fmt`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0522`.
error: Could not compile `msp430-rt`.
warning: build failed, waiting for other jobs to finish...
error: build failed

This looks like the msp430-rt crate is using something that doesn’t exist in the nightly version of Rust. I’ll have to check their bug tracker to see if there are any other reports of this.

There are not currently any issues on the msp430-rt repo on github, but there was an announcement about changing panic_fmt to panic_implementation two weeks ago. I suspect this is the issue, and msp430-rt hasn’t caught up yet.

I filed a bug report on msp430-rt about this, so that the next person who encounters the same issue has a bit more information: https://github.com/pftbest/msp430-rt/issues/2

That’s it for the day. See y’all next time.

Home