japaric / msp430-quickstart

WIP
Apache License 2.0
11 stars 5 forks source link

Getting Started on Building for MSP430 #4

Open ssnover opened 5 years ago

ssnover commented 5 years ago

Hello, I see that this repository is marked work in progress. I'm trying to get a Rust toolchain up and running to develop for TI's MSP430 Launchpad board with the MSP430G2553. I'm trying to build blinky.rs but without directions I'm stuck trying to piece some stuff together.

I've got a typical Rust project set up where I have Cargo.toml, Xargo.toml, and memory.x replicating the file in this repo and main.rs replicating blinky.rs. Finally, I have a file in .cargo/config with the following contents:

[target.msp430]
rustflags = ["-C", "link-arg=-Tmemory.x"]

[build]
target = "msp430"

When I run cargo build or xargo build I get identical results:

ssnover@styrka:~/develop/rust-embedded/blink-msp430$ xargo build
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -C link-arg=-Tmemory.x --target msp430 --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro` (exit code: 1)
--- stderr
error: Error loading target specification: Could not find specification for target "msp430"
  |
  = help: Use `--print target-list` for a list of built-in targets

I'm on nightly, however I'm not able to install the msp430 target: error: toolchain 'nightly-x86_64-unknown-linux-gnu' does not contain component 'rust-std' for target 'msp430'

Is there something I'm missing? I'd be happy to write something up once I've got it working to add to this repository for those following, but I'm a little stuck right now :smiley: I'm pretty new to Rust, with considerably more experience developing for embedded (I've just rewritten a couple algorithms homeworks in Rust to get a feel for it).

Thanks!

ktsiligkiris commented 3 years ago

Hi @ssnover,

I'm feeling my way around also around this TI launched and found your comment.

Checking the error message you had, I ran:

-<%>- rustc --print target-list | grep msp
msp430-none-elf

So you see the target is named msp430-none-elf