Skip to content

Embedded Project to test using the Rust Programming Language and QEMU emulator

Notifications You must be signed in to change notification settings

keith023/rust_hello

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Embedded Helloworld Program

This is a base hello world project using the Rust Programming Language to build a demo design to run on the QEMU. This project was based on the Rust Embedded documentation and book listed online at www.rust-lang.org

Tools

Tools Needed:

Tool Configuration

Prior to using the build tools, make sure to download the proper Rust Crates and ARM Targets shown below.

Adding the ARM target for this repo can be done using the following command for the ARM M3 Target:

rustup target add thumbv7m-none-eabi

Rust will need the bin-utils crate and llvm tools preview component. This can be done by running these commands:

cargo install cargo-binutils
rustup component add llvm-tools-preview

After installing QEMU above, you may need to add the QEMU install directory to your path. Make sure you can run the application in the terminal:

qemu-system-arm --version

Building the application

To build the application, the cargo tool can be used with the toml configuration files to create the binary. Just run the following command:

cargo build

This will build the helloworld.rs application and generate the binary in the target/thumbv7m-none-eabi/debug/ folder. You can verify the binary is correct by using the cargo obj-read:

cargo readobj --bin helloworldapp -- -file-headers

Which should report the binary is an ELF32 file for the ARM machine.

Running the application

To test the application, we can use QEMU to emulate the hardware enviroment and run the example design:

qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel target/thumbv7m-none-eabi/debug/helloworldapp

OR use the cargo run command:

cargo run

which uses the config.toml setup to run the same QEMU command.

This will run the helloworldapp built by the cargo build for the thumbv7m-non-eabi target on an emulated cortex m3 machine . The following should be printed to verify it worked:

"Hello D5 World!"

Example Run

About

Embedded Project to test using the Rust Programming Language and QEMU emulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages