Based on the template for building applications for ARM Cortex-M microcontrollers
To build embedded programs using this template you'll need:
-
Rust toolchain.
-
rust-std
components (pre-compiledcore
crate) for the ARM Cortex-M targets. Run:
$ rustup target add thumbv7em-none-eabihf
$ cargo build --release
-
Start the JLinkGDBServer:
JLinkGDBServer -device cortex-m4 -if swd
-
Run the program with GDB:
gdb-multiarch target/thumbv7em-none-eabihf/release/aspeed-ddk
-
Enable semihosting in GDB:
target remote :2331 monitor semihosting IOClient 2 load continue
-
Generate Image for Programming
cargo build;cargo objcopy -- -O binary ast10x0.bin
-
Generate Image for Boot from UART
cargo build;cargo objcopy -- -O binary ast10x0.bin scripts/gen_uart_booting_image.py ast10x0.bin uart_ast10x0.bin
- git clone https://github.com/qemu/qemu
- Run the following commands to build qemu
mkdir build cd build ../qemu/configure --target-list=arm-linux-user,arm-softmmu,aarch64-softmmu,aarch64-linux-user,riscv32-softmmu --enable-docs --enable-slirp --enable-gcrypt make -j 4
- Run the image in QEMU using
ast1030-evb
machineqemu-system-arm -M ast1030-evb -nographic -kernel ~/work/rot/aspeed/aspeed-rust/target/thumbv7em-none-eabihf/debug/aspeed-ddk Hello, world! aspeed_ddk!