A simple project as a template for creating rust applications for the Pine64 "Pinenut" BL602 Wifi/Bluetooth SoC. PineNut Devkits with included USB-C interface are also known as "PineCones".
Thanks to all the existing documentation and repos of other rust projects used in the basis of this.
Install rust and cargo with rustup
Install other dependencies;
rustup install nightly-2022-12-25
rustup component add llvm-tools-preview --toolchain nightly-2022-12-25
rustup target add riscv32imac-unknown-none-elf
cargo install cargo-binutils
cargo install --git https://github.com/spacemeowx2/blflash cargo-blflash
These commands add the required toolchain targets along with binary flashing for easy development (No need for GUIs anymore 😉).
For a simple compilation which will create a bl602-template.bin
file ready for flashing
cargo objcopy --release -- -O binary bl602-template.bin
The preferred method is to use blflash
directly with cargo. (I recommend picking a baudrate across all projects and sticking to it)
# On windows:
cargo blflash --release --initial-baud-rate 1000000 --baud-rate 1000000 --port COM3
# On Linux:
cargo blflash --release --initial-baud-rate 1000000 --baud-rate 1000000 --port /dev/ttyUSB0
Note
If you're on linux, remember to have rw permission to your serial socket.
You can do this by adding your user to the correct group; e.g dialout