split PM3_CMD_DATA_SIZE_OLD out of PM3_CMD_DATA_SIZE

The OLD frame size was tied to the NG one, but the bootloader only speaks
OLD - growing PM3_CMD_DATA_SIZE would silently change sizeof(PacketCommandOLD)
and break flashing against every deployed bootrom in both directions.

Pin the OLD structs to their own constant and use it on every OLD path:
reply_old and the OLD receive branch on both sides, the bootrom, and the
flasher's write_block/send_finish_write_cmd, which memcpy into a
PacketCommandOLD using the NG size.

No behaviour change - both constants are 512 and armsrc .text is
byte-identical before and after.
This commit is contained in:
iceman1001 committed 2026-08-30 13:03:53 +02:00
1 parent 50c63690cd
commit 25d958e5e6
5 files changed
+25 -22

No files matched your search

+4 -4
View File
@@ -65,9 +65,9 @@ static int reply_old(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2,
txcmd.arg[1] = arg1;
txcmd.arg[2] = arg2;
// Add the (optional) content to the frame, with a maximum size of PM3_CMD_DATA_SIZE
// Add the (optional) content to the frame, with a maximum size of PM3_CMD_DATA_SIZE_OLD
if (data && len) {
len = MIN(len, PM3_CMD_DATA_SIZE);
len = MIN(len, PM3_CMD_DATA_SIZE_OLD);
for (size_t i = 0; i < len; i++) {
txcmd.d.asBytes[i] = ((uint8_t *)data)[i];
}
@@ -188,8 +188,8 @@ static void UsbPacketReceived(uint8_t *packet) {
}
if (isok) {
for (size_t pos = 0; pos < count; pos += PM3_CMD_DATA_SIZE) {
size_t len = MIN((count - pos), PM3_CMD_DATA_SIZE);
for (size_t pos = 0; pos < count; pos += PM3_CMD_DATA_SIZE_OLD) {
size_t len = MIN((count - pos), PM3_CMD_DATA_SIZE_OLD);
isok = (0 == reply_old(CMD_READ_MEM_DOWNLOADED, pos, len, 0, &base[offset + pos], len));
if (!isok) {
break;