Article: Debug Rust on PineCone BL602 with VSCode and GDB
#1
Here's how we build and debug Embedded Rust Firmware for PineCone BL602... With VSCode and GDB

Debug Rust on PineCone BL602 with VSCode and GDB
#2
@lupyuen Thank you for your article (I got the notification via RSS), very excited to start playing with mine Smile

Some questions (if you don't mind):

1. Is the USB only for power? Does the device not allow for flashing via USB? I kind of hoped there would be a USB to serial flashing process.

2. How mature is the Rust library now? Is it functioning and if so, is it using binary blobs?

3. What is the compelling argument for using Rust over C for the stack?
#3
(12-14-2020, 08:42 AM)barray Wrote: 1. Is the USB only for power? Does the device not allow for flashing via USB? I kind of hoped there would be a USB to serial flashing process.

2. How mature is the Rust library now? Is it functioning and if so, is it using binary blobs?

3. What is the compelling argument for using Rust over C for the stack?

So glad to have you onboard PineCone and RISC-V! :-)

1.  The USB port is connected to PineCone's UART port. That's how we flash firmware over USB (and UART). Debugging is not supported over USB. More details here

The UART flashing protocol is non-standard, that's why I chose to use a JTAG Debugger instead. It just works better with Rust, GDB and VSCode. :-)

2.  Many features are still missing in the Rust libraries for BL602, e.g. I2C, SPI. Check the docs here

BLE and WiFi are still not supported in the Rust BL602 libraries. We need to reverse engineer the blobs then get them working with Rust. 

3.  About C vs Rust: Yep it's perfectly fine to use C! :-) I'll be porting Mynewt OS to PineCone, which is mostly C anyway.

Rust seems friendlier for folks who are new to embedded coding. But it can get unnecessarily complex.

I wrote about Rust because the Sipeed Community has ported it to BL602. And it has GDB config files that actually work for flashing and debugging PineCone. So we can adapt them for our C projects as well.
#4
@lupyuen Thanks for the reply Smile

> Debugging is not supported over USB.

If it's two way serial, surely you could at least print some debug messages over the UART? Much better than nothing?

> BLE and WiFi are still not supported in the Rust BL602 libraries. We need to reverse engineer the blobs then get them working with Rust.

Ah yes, so you're in the same boat. Might be best to team up with the C guys for the stack and later port it to rust or something. Or bind the C stack to the Rust firmware...

> I'll be porting Mynewt OS to PineCone, which is mostly C anyway.

This is interesting... I was actually considering the possibility that this could end up being the processor for the PineTime watch down the road. I really think the PineTime could do with another core just to service the I/O and keep the whole thing responsive.
#5
(12-14-2020, 08:33 PM)barray Wrote: If it's two way serial, surely you could at least print some debug messages over the UART? Much better than nothing?

Yep the USB port works perfectly fine for printing debugging messages :-)

My idea of debugging is Breakpoints + Code Stepping + Variable Inspection.

Check out what a JTAG Debugger can do with PineCone and VSCode...

https://youtu.be/b9f2vxYahHY


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Article] RISC-V Emulator for Pine64 Oz64 SBC lupyuen 2 932 07-07-2024, 04:19 AM
Last Post: lupyuen
  [Article] Rust Apps on Ox64 BL808 RISC-V SBC and Apache NuttX RTOS lupyuen 2 1,099 07-06-2024, 06:51 PM
Last Post: lupyuen
  [Article] Coding Ox64 BL808 SBC the Drag-n-Drop Way lupyuen 3 1,555 04-02-2024, 07:38 AM
Last Post: Noahstorey
  [Article] QuickJS JavaScript Engine on a Real-Time Operating System (Ox64 + NuttX) lupyuen 0 926 02-17-2024, 07:24 PM
Last Post: lupyuen
  [Article] Emulate Ox64 BL808 in the Web Browser: Experiments with TinyEMU lupyuen 3 1,518 02-17-2024, 06:53 PM
Last Post: tllim
  [Article] Automated Testing with Ox64 BL808 Emulator (Apache NuttX RTOS) lupyuen 0 801 02-16-2024, 06:54 PM
Last Post: lupyuen
  [Article] Nim on a Real-Time Operating System: Apache NuttX RTOS + Ox64 BL808 SBC lupyuen 2 1,256 01-05-2024, 12:27 AM
Last Post: lupyuen
  [Article] $8 RISC-V SBC on a Real-Time Operating System: Ox64 + NuttX lupyuen 0 869 12-17-2023, 02:27 AM
Last Post: lupyuen
  [Article] Fixed the UART Interrupt and Platform-Level Interrupt Controller (Ox64) lupyuen 0 837 12-09-2023, 05:24 PM
Last Post: lupyuen
  [Article] RISC-V Ox64 BL808: UART Interrupt and Platform-Level Interrupt Controller lupyuen 1 1,085 12-03-2023, 04:24 AM
Last Post: WhiteHexagon

Forum Jump:


Users browsing this thread: 4 Guest(s)