Commit Graph
7 Commits
Author SHA1 Message Date
iceman1001andClaude Opus 5.5 f1d42086c2 hw status, mem info: transfer speed and memory size in KB/MB
"Transfer Speed PM3 -> Client... 1111313 bytes/s" and
"Memory size... 2048 Kb ( 32 pages * 64k )" (Kb is kilobit) now read
"1.06 MB/s" and "2.00 MB ( 32 pages * 64 KB )".

sprint_bytes() in common/commonutil.c formats a byte count in binary
units ("512 bytes", "136.7 KB", "1.07 MB") for the firmware (armsrc
printf.h sprintf) and the client alike.

Built PM5 (OS + bootrom), RDV4 with FLASH, client gcc; clang shows no
new warnings. Checked on PM5: USB 1.04 MB/s, WiFi 137.5 KB/s, 2.00 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 15:52:06 +07:00
Philippe Teuwen 634edd11fd make style 2026-09-16 19:00:50 +02:00
iceman1001andClaude Opus 5 (1M context) 9a8e179266 fix spiffs downloads >= 64K, and stop losing flash errors
CMD_SPIFFS_DOWNLOAD read the whole file into BigBuf first.  BigBuf_calloc()
takes a uint16_t while the size is a uint32_t, so a 64K file allocated zero
bytes and anything larger wrapped to a short buffer the file was then read
straight past the end of.  rdv40_spiffs_read_stream() opens the file once and
hands out one frame at a time, so the size never reaches the allocator, and the
SPIFFS path now honours start_index.  Verified with an 80K round trip: upload,
download, byte identical.

The same BigBuf_calloc(filesize) wrap was in copy_in_spiffs(); it now copies in
SPIFFS_WRITE_CHUNK_SIZE chunks.

Separately, every flash failure was invisible.  SPIFFS_CHECK_RES() only treats a
negative result as an error and the HAL hooks returned 128/129/130, so SPIFFS
saw success.  The erase path was worst: Flash_Erase4k() only reports that the
command was sent, both Flash_CheckBusy() results were discarded, and
'return (SPIFFS_OK == erased)' yields 1 on failure.  A flash dump from a device
that hit this showed one block written without being erased - its object index
header held '0x14000 & 0x10000', and the filename ANDed away to empty.  Erases
are now read back and retried, and the HAL returns real SPIFFS error codes.

Flash_Write() returned len unconditionally even after a rejected page, which
also defeated the 'res == payload->len' check in CMD_FLASHMEM_WRITE.

Feedback, so none of this is silent again: CMD_SPIFFS_WRITE answers with the
SPIFFS result, the client aborts on the first refusal and names the byte it
stopped at, dl_it() checks the terminator status, and both transfer directions
print inline progress.

Co-Authored-By: Claude Opus 5 (1M context)
2026-09-12 14:58:08 +02:00
iceman1001 35c098d489 make style 2026-08-29 17:42:29 +02:00
Philippe Teuwen 827fce4839 Use ARRAYLEN when possible 2026-08-19 15:51:54 +02:00
Philippe Teuwen 5518e6af77 Fix Flash_UniqueID 2026-08-19 15:51:54 +02:00
dxl 36f1c7e44c Make common_arm to hardware abstraction layer. 2026-08-19 15:32:39 +02:00