Files
proxmark3/armsrc
iceman1001andClaude Opus 5 (1M context) 43fe6c3eb8 fpga_compress: pick the LZ4 block size by consumer, not by file count
The 1 MB block branch exists for the ARM .data section: start.c's
uncompress_data_section() reads one 4-byte length and does one
LZ4_decompress_safe(), so .data has to arrive as a single block. It was
selected by 'num_infiles == 1', which is not what tells the two callers apart.

A build that skips LF, FeliCa and ISO15693 leaves FPGA_BITSTREAMS holding just
fpga_pm3_hf.bit, so the bitstream took that same branch and was packed as one
42 kB block. get_from_fpga_combined_stream() decompresses into a
FPGA_RING_BUFFER_BYTES buffer, 16 kB since 83c3f81b1:

  [#] inflate returned: -13247
  [#] reset_fpga_stream failed

Before 83c3f81b1 the copy was clamped with MIN(FPGA_RING_BUFFER_BYTES, ...)
whatever buffer_size said, so the blocks came out at 30 kB and the 30 kB ring
buffer still took them. That is why the commit looks like the cause - it only
removed the clamp that was covering for the wrong branch.

Add -s for the single block case and let the FPGA path always chop at
FPGA_RING_BUFFER_BYTES, however many bitstreams went in:

  4 bitstreams   169344 in -> 106933 out, byte identical to before
  1 bitstream     42172 in ->  28718 out, 3 blocks 13265/13206/2247,
                                          was 1 block of 27627
  .data  (-s)     14944 in ->   8786 out, byte identical to the
                                          obj/fullimage.data.bin.z in tree

Also hand the ring buffer back when reset_fpga_stream() fails. The early
return left it allocated for the rest of the session, which is the reporter's

  [#]   BigBuf_size............. 48116
  [#]   Available memory........ 31732

48116 - 31732 is 16384, exactly FPGA_RING_BUFFER_BYTES.

No CAPABILITIES_VERSION bump: fpga_all.bit.z is objcopy'd into the same
fullimage as the decompressor that reads it, so nothing here is client facing.

Reported and correctly diagnosed by @ewangsoft.

Fixes #3599

Co-Authored-By: Claude Opus 5 (1M context)
2026-09-13 08:14:43 +02:00
..
…
2026-08-19 15:32:39 +02:00
2026-09-05 18:09:46 +02:00
2026-09-05 22:31:52 +08:00
2026-09-12 20:35:35 +02:00
2026-08-28 13:10:24 +02:00
2026-08-28 13:10:24 +02:00
2026-09-04 06:21:20 +02:00
2025-12-21 02:58:56 -07:00
2025-12-21 00:34:11 -07:00
2026-03-24 14:21:54 +07:00
2026-09-01 17:57:31 +02:00
2026-09-01 17:57:31 +02:00
2024-05-14 12:32:57 +02:00
2026-08-29 17:42:29 +02:00
2023-08-08 23:03:34 -07:00
2025-03-16 01:05:55 -07:00
2026-08-19 15:32:39 +02:00
2025-03-21 11:25:31 +01:00
2026-03-29 09:38:09 +07:00
2026-08-29 15:13:34 +02:00
2023-08-08 23:38:26 -07:00
2026-08-28 22:35:08 +02:00
2026-06-12 18:31:57 +03:00
2026-08-19 15:32:39 +02:00
2026-06-12 18:31:57 +03:00
2026-07-15 16:39:15 +02:00
…
2026-08-19 15:32:39 +02:00
2023-08-09 00:03:48 -07:00
2026-09-01 17:57:31 +02:00
…
2026-09-04 15:21:19 +02:00
2024-11-21 19:23:03 +00:00
2026-09-08 16:07:15 +08:00
2026-08-29 17:42:29 +02:00
2026-08-29 15:00:03 +02:00
2026-08-19 15:32:39 +02:00
2026-08-19 15:32:39 +02:00
2026-08-19 15:32:39 +02:00
…
2026-09-12 20:35:35 +02:00
2026-08-29 16:03:00 +02:00
2026-08-19 15:32:39 +02:00
2026-08-19 15:32:39 +02:00
…
…
2024-05-14 10:10:44 +02:00
2025-03-18 08:11:06 +01:00
2025-03-25 10:12:16 +01:00
…
2026-08-28 13:10:24 +02:00
2026-09-01 13:34:02 +02:00
2026-09-01 13:34:02 +02:00
2026-09-01 13:34:02 +02:00
2026-09-08 16:04:45 +08:00
2026-09-05 22:31:52 +08:00
2026-09-01 13:34:02 +02:00
2026-04-13 09:35:02 +02:00
2026-08-19 15:32:39 +02:00
2025-12-21 04:26:44 -07:00
2025-01-14 18:01:09 -08:00
2025-01-14 18:01:09 -08:00
2026-08-19 15:32:39 +02:00
…
…
2026-09-01 13:34:23 +02:00
2025-04-21 23:17:47 +10:00
2026-09-01 13:32:49 +02:00
2026-09-01 13:32:49 +02:00
…
…
…
…