11# RP2040 Firmware for Sonata Board
22
3+ ## Usage
4+
5+ ### Copying Bitstreams/Firmware
6+
7+ Once plugged in, the Sonata board should enumerate as a USB mass storage device. Bitstreams
8+ and Sonata firmware can both be programmed by copying their respective files to the mass
9+ storage device. Bitstreams and firmware must be in UF2 format with a maximum block size
10+ of 256 bytes and device IDs of ` 0x6ce29e6b ` and ` 0x6ce29e60 ` , respectively. Only the data
11+ portion of the UF2 block is written to flash.
12+
13+ Note that the FPGA is currently erased during both firmware and bitstream programming,
14+ then reprogrammed afterwards.
15+
16+ ### Flash Slots
17+
18+ Bitstream and firmware both have 3 flash slots, which can be selected via the 3 position
19+ Bitstream select switch by the USB port on the device. This controls both where
20+ bitstream/firmware are written to when programming, as well as where bitstreams
21+ are loaded from on device boot.
22+
23+ ### Logging/Options
24+
25+ Important things such as firmware version, which slots have bitstreams/firmware, etc.
26+ is logged in LOG.TXT. Various options, such as programming speed and whether or not
27+ to write bitstreams to flash can be modified in OPTIONS.TXT.
28+
29+ ### Reprogramming/Updating Sonata
30+
31+ The Sonata's firmware can be erased by holding down SW9 while plugging in the USB, after
32+ which the board should enumerate as a different USB mass storage device. New firmware is
33+ avilable in UF2 format and can be programmed by copying the UF2 file into the drive, similar
34+ to how bitstream and firmware programming works on the Sonata board.
35+
336## Getting started
437
538### Linux Setup
@@ -30,6 +63,18 @@ cd build
3063PICO_SDK_PATH=/path-to/pico-sdk cmake ..
3164make # or ninja if on Windows
3265```
66+ ## Logging
67+
68+ Different logging levels are available and can be selected with ` -DDEBUG_LEVEL=N ` where ` N ` is
69+ between 1 and 5. The levels available are:
70+
71+ 1 . Critical
72+ 1 . Error
73+ 1 . Warning
74+ 1 . Info
75+ 1 . Debug
76+
77+ with Info (4) being the default. Logs are written to ` LOG.txt ` .
3378
3479## Debugging
3580
@@ -50,6 +95,13 @@ cd build
5095arm-none-eabi-gdb usb_msc/usb_msc.elf -ex " target extended-remote localhost:3333" -ex " load" -ex " monitor reset init"
5196```
5297
98+ ## Testing
99+
100+ Some basic tests can be run by creating testing firmware with cmake: ` -DTESTING_BUILD=ON ` ,
101+ then running either ` tests/test_linux.py ` or ` tests/test_windows.py ` , depending on your platform.
102+
103+ Tests should be run after a fresh boot and nothing should be uploaded to the Sonata before running the tests.
104+
53105## Notes
54106
55107### Windows Quirks
0 commit comments