Getting started with the Baochip

The Baochip is a new RISC-V microcontroller by Andrew “bunnie” Huang, comparable to the Raspberry Pi RP2350. It's a SoC (System-on-Chip) with 2 MiB SRAM, 4 MiB RRAM and with the evaluation board priced at $9.50. What makes it special is that everything down to the silicon is mostly open source. It also comes in a package that, when you shine infrared light at it (at just the right angle) under a microscope, you're able to view the pattern of logic on the die itself!

The Baochip has a VexRiscv CPU running at 350 MHz, with an MMU (Memory Management Unit). That's quite unusual for a microcontroller, and it means it can boot Linux! It also has the BIO (Bao I/O co-processor), a cluster of four smaller RISC-V CPUs running at 700 MHz. They're kind of like Raspberry Pi's PIOs, but then actually open source.

I just got my Dabao evaluation boards (Baochip dev boards) a couple of days ago. Bunnie has shared a set of Getting Started slides that are helpful, but missing what I thought were key pieces to getting started. So here's what to do if you just want to get it up and running quickly.

Building and flashing Xous

First, make sure you have Rust installed, and if already installed run rustup update to make sure it's up to date. Then you need to get hold of Xous, the pure Rust operating system designed by bunnie and Sean “xobs” Cross that supports the Baochip-1x:

git clone --depth 1 https://github.com/betrusted-io/xous-core/
cd xous-core

The build idiom is cargo xtask <target>, so to build all the components you need for the Dabao board you run

cargo xtask dabao dabao-console

where dabao is a Xous environment and dabao-console is the app you're going to be running. If that compiles successfully, you should end up with three .uf2 files in xous-core/target/riscv32imac-unknown-xous-elf/release:

Copy those to the folder that mounts when you plug in the Dabao board – it should mount as a USB mass storage device called BAOCHIP. Then press the PROG button on the board to start Xous.

Connecting to the console

Now you can connect to it over USB, e.g.tio. (If you don't have tio, please install it as it's a great serial device I/O tool.) If you're on Linux you can check dmesg when you plug it in to get the exact mount, e.g. /dev/ttyACM1.

Once connected over USB using a serial device tool, pressing enter should display [console], so that you know what app is running. Typing help and pressing enter should show the available commands:

tio /dev/ttyACM1

[21:11:24.566] tio v3.9
[21:11:24.566] Press ctrl-t q to quit
[21:11:24.567] Connected to /dev/ttyACM1

[console]

[console] help Commands: echo, ver, i2cdetect, test, ws2812, touch, bio

If you only make changes to the app itself, not the bootloader or Xous, you'll only need to copy apps.uf2 over in future. If you got this far without any issues, why not follow the instructions to blink an LED! (Press down on the slide to see the details.)

By default the Dabao board will always wait on boot until you press the PROG button before it starts the loaded app. If you connect with a serial console and type bootwait disable it will always start up with the loaded app. You'll then need to hold the PROG button while plugging it in to get back to the mass storage loader.

Let me know in the comments if you run into any issues so that I can update the post.

References

Comment on this post