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

+7 -4
View File
@@ -26,13 +26,16 @@
#define USART_SLOW_LINK
#define PM3_CMD_DATA_SIZE 512
// OLD frames are pinned at 512 independently of PM3_CMD_DATA_SIZE:
// the bootloader only speaks OLD
#define PM3_CMD_DATA_SIZE_OLD 512
typedef struct {
uint64_t cmd;
uint64_t arg[3];
union {
uint8_t asBytes[PM3_CMD_DATA_SIZE];
uint32_t asDwords[PM3_CMD_DATA_SIZE / 4];
uint8_t asBytes[PM3_CMD_DATA_SIZE_OLD];
uint32_t asDwords[PM3_CMD_DATA_SIZE_OLD / 4];
} d;
} PACKED PacketCommandOLD;
@@ -75,8 +78,8 @@ typedef struct {
uint64_t cmd;
uint64_t arg[3];
union {
uint8_t asBytes[PM3_CMD_DATA_SIZE];
uint32_t asDwords[PM3_CMD_DATA_SIZE / 4];
uint8_t asBytes[PM3_CMD_DATA_SIZE_OLD];
uint32_t asDwords[PM3_CMD_DATA_SIZE_OLD / 4];
} d;
} PACKED PacketResponseOLD;