Bronzebeard: A minimal ecosystem for bare-metal RISC-V development

Hey folks,

I wanted to share a small RISC-V assembler project that I’ve been working on. I’ve found it useful for diving deep into how hobbyist RISC-V chips (such as the Longan Nano and Wio Lite) work at the lowest level. I figure that if it’s useful to me then it may also be useful to others.

Bronzebeard is a collection of tools for writing RISC-V assembly and working with hobbyist development devices. It is designed for programs that will run on bare metal with no reliance on operating systems, frameworks, SDKs, or pre-existing software of any kind. The assembler currently supports RV32IM.

Much of modern software has accrued vast amounts of bulk and complexity throughout the years. Can useful software be developed without relying on any of it? That’s the question that this project seeks to answer. I believe that the rise of RISC-V provides a great opportunity to explore different methods of program development. Installing a full operating system doesn’t have to be a prerequisite to building something useful.

Bronzebeard and its tools are implemented purely in Python. A simple, standalone assembler is the centerpiece. It has been written in order to be free from large, complex toolchains. This keeps the project portable, minimal, and easy to understand. At the moment, Bronzebeard only targets the Longan Nano and the Wio Lite. However, there are plans to broaden support to also include HiFive1 Rev B.

Hi,
the bb.out cannot be uploded to longan nano. On typig command bronzebeard-dfu 28e9:0189 bb.out the terminal outputs the following messages. i am using windows 10.
code assembles OK with bb.out. Is there an option to convert bb.out to hex file so that i can use the platformio dfu tool to upload.
regards
Sajeev

Hey Sajeev,

Thanks for giving my assembler a try! Given that you are using Windows, have you followed the setup instructions for getting DFU working on Windows? Dealing with USB devices on Windows can be a bit of a pain.

Secondly, when you mention hex output, are you referring to the Intel HEX format? The assembler doesn’t currently support that as an output option but it could be something I add in the future.

Best,
Andrew D.

Dear Sir,
Thank you for the reply.

  1. I tried every thing mentioned in the site to set up DFU in windows but failed but it throws langid error or device not found error. In dfu mode the Zadig lists the longan under its device id but bronzebeard doesnt uplload the bb.out.
    2)Yes sir. I was referring to Intel HEX format. If there was IntelHex output ,the code could be uploaded by gigadevice DFU tool which can be downloaded from their site.
    3)The bronzebeard is a very good light weight tool ,would have been better if windows allowed DFU upload or there was an option to output IntelHex and .BIN formats. The dfu works fine on Ubuntu but I am too ignorant to maintain a linux VM machine(just a hobbyist). A debugging option would be a jewel in the crown.
    I will be watching your github page on a weekly basis to see that these updates are available.I hope that you get time to add these goodies to the current program.
    Thanks nad regards
    Sajeev

Hey Sajeev,

i just finished adding a CLI flag to output an additional file in the Intel HEX format. You must provide an offset for where the HEX file should be written to the device’s ROM. The output file will be named whatever name was provided for -o / --output with an additional .hex extension.

Longan Nano example:

bronzebeard --hex-offset 0x08000000 examples/longan_nano_led.asm

You’ll need to update to the latest version of bronzebeard to see this flag (0.1.17). Let me know if this works for you!

Best,
Andrew D.

Dear Sir,
Thank you very much for creating the Intel HEX output option to BRONZEBEARD. I tried as you instructed and worked like a charm. A file named bb (OUT format) and another file with bb,out (IntelHEX) format was output in my base directory. I used the Longan Nano DFU tool “GD32 Dfu Tool_V3.8.2.9056” which recognized the .HEX file to program the chip in DFU mode. The tool is available for download at GIGAdevices website.

  1. in windows command prompt create virtual environment by typing - python3 -m venv tutorial-env
  2. activated the virtual environment with command - tutorial-env\Scripts\activate.bat
  3. downloaded latest bronzebeard 0.01.17 by typing - pip install bronzebeard
  4. Placed mandlebrot.asm & gd32vf103.asm(include) files on desktop
  5. typed bronzebeard command - bronzebeard --hex-offset 0x08000000 Desktop/mandelbrot.asm
  6. found the bb. OUT file and bb.out. HEX file in the command prompt folder
  7. Cycle the boot button and reset button of Longan nano to enter DFU mode
  8. Used the “GD32 Dfu Tool_V3.8.2.9056” tool to navigate to the command prompt folder , select bb.out.HEX and burn chip.
  9. The Mandelbrot displayed on the LCD.
    Happy programming RISCV assembly with BRONZEBEARD on windows10
    DFU tool available on GigaDevice

A thousand thanks for this tool

Regards
Sajeev