NuttX reserves a 1 KiB region at offset 0x400 of the BL602 flash image,
tagged with the magic "BLRFPARA", for Bouffalo RF parameters (TX power
tables, crystal calibration, temperature compensation). The official
Bouffallo flashing tool fills this region from a device tree before
writing the image, but blflash does not. Images flashed with blflash
therefore run with empty RF parameters, which makes the Wi-Fi radio
degraded and largely non-functional: reception is weak and erratic, the
transmitter cannot complete an association, and AP mode is invisible to
other devices.
See https://github.com/apache/nuttx/issues/4336 for background.
This adds RF parameter patching to blflash so that a single tool can
flash a fully functional NuttX image:
- New rfparam module:
- A focused DTS parser covering the constructs used by the
machine-generated Bouffalo factory parameter files (nested nodes,
quoted strings, <u32> word lists, [hex byte] arrays, comments,
skipped /include/ lines). …
Replace serial 0.4 with serialport 4 to fix baud rate on modern glibc
The flashing tool failed to connect to the BL602 bootrom on systems
with glibc 2.42 or later. The handshake timed out, because the port
never ran at the requested speed.
Root cause:
glibc 2.42 changed the termios speed API. Speeds are now numeric
values, and the Bxxx code constants (for example B115200 = 0o10002)
are no longer accepted. glibc added new symbol versions for
cfsetispeed/cfsetospeed with these new rules.
The serial 0.4 crate (with termios 0.2) calls these functions without
a symbol version, so it binds to the new default. But it passes the
old-style octal code constant. New glibc treats that value as a
literal speed of 4098 baud and silently ignores the request. The
port stays at a wrong speed, the bootrom auto-baud never locks on,
and every handshake attempt fails.
The serial 0.4 crate is also unmaintained, so this problem would not
get fixed upstream.
Solution:
Replace serial 0.4 with its maintained successor, serialport 4.10.
On Linux, serialport sets the baud rat…