Commit Graph
65 Commits
Author SHA1 Message Date
iceman1001andClaude Opus 5.5 3deae3d904 fix PrintAndLogEx format string mismatches
Found by building with a printf format attribute on PrintAndLogEx.

User visible:
- hw version: GENERIC device/firmware name was passed as an unused arg
  and never printed
- hf saflok selftest: PRIx32 lacked '%', printed a literal 'x'
- hf mfp: key index value was never printed
- hf waveshare: output filename was never printed

Also: size_t/int64_t/uint64_t specifiers (%zu, PRId64, PRIX64), int
macros printed with %zu, ' ' flag on %u, unused arg in flash_prepare,
and non-literal strings passed as the format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 18:20:15 +07:00
Gabriele GristinaandClaude Opus 5.5 49e444b773 client: flash animation only on a terminal, exit 1 on failure
Since cd5906674 the flash animation runs whatever stdout is, and a
redirected flash of fullimage.elf wrote a 7 MB log.

flash_pm3() replaced a flash error with the result of
flash_stop_flashing(), always PM3_SUCCESS, so a failed flash ended with
"All done". main() exited 0 after --flash, --dumpmem and
--reboot-to-bootloader whatever happened. dumpmem printed its negative
error code with %u.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 22:15:28 +01:00
iceman1001 2e2598bca9 style 2026-09-27 21:15:18 +02:00
WillandCursor 8150c2af77 BWM: add ability to flash over wifi
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-26 12:23:47 -04:00
Philippe Teuwen 634edd11fd make style 2026-09-16 19:00:50 +02:00
iceman1001 592977c217 armsrc: zero the command payload when a packet arrives, not on every idle poll
The main loop cleared the whole PacketCommandNG payload before every call to
receive_ng(), so a device sitting idle memset PM3_CMD_DATA_SIZE bytes on each
pass of the loop whether anything was arriving or not. The zeroing belongs
inside receive_ng_internal(), once the preamble has been read and a packet is
known to be coming in, and that is where it is now.

It has to be before either branch fills the payload, because neither fills all
of it: an NG command writes only its own length, and an old style one only
PM3_CMD_DATA_SIZE_OLD. Whatever is not written has to start at zero.

Moving it also covers two callers that never had it. appmain.c has a second
receive_ng() that drains the buffer on a mode switch, and iclass.c has one that
picks up EML_MEMSET commands while waiting for RF. Both declare their
PacketCommandNG without initialising it, and the iclass one then reads a struct
out of the payload -- so a command shorter than that struct was reading stack
garbage beyond its length. That is fixed as a side effect.

Builds for RDV4 and PM5.

Thanks to @Msprg et al
2026-09-16 02:14:48 +02:00
iceman1001 25d958e5e6 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.
2026-08-30 13:03:53 +02:00
iceman1001 35c098d489 make style 2026-08-29 17:42:29 +02:00
iceman1001 1ee41ecf95 fix leftover oldargs 2026-08-29 17:06:24 +02:00
Philippe Teuwen 73cc583b0e Flash: skip warning when the bootrom gets updated 2026-08-23 01:28:47 +02:00
Philippe Teuwen f82ac61e78 Prompt the user when flash_suggest_update_bootloader()
pm3line_init() delayed to not install signal handlers on other usages than interactive client
2026-08-19 15:51:54 +02:00
dxl cbc56f720d Abstract the flash.c to avoid hard coding that makes it impossible to cross platforms. 2026-08-19 15:51:18 +02:00
iceman1001 6411ba1ee4 add 2026-07-30 17:06:36 +02:00
iceman1001 cd59066743 remove old logo when flashing 2026-07-30 07:52:38 +02:00
iceman1001 2c6e607110 style 2026-07-15 16:39:15 +02:00
Philippe Teuwen d078e8a62b make style 2026-05-21 20:54:44 +02:00
iceman1001 cbb572afad style 2026-05-11 14:36:17 +02:00
Philippe Teuwen c00e4801b7 make style 2026-02-06 13:43:41 +01:00
Philippe Teuwen fd88967443 make style 2025-10-14 09:50:59 +02:00
Oleg Moiseenko 944a80d217 make style 2025-09-21 16:41:30 +03:00
iceman1001 7717dfc04d text 2025-07-06 20:12:13 +02:00
iceman1001 7e2aa07b27 revamped 2025-06-30 14:29:24 +02:00
iceman1001 ad292e8810 unify test - step 2 2025-03-25 10:17:42 +01:00
iceman1001 ba8a68f37c fixes entering bootload messages to be less scary 2024-09-10 14:29:47 +02:00
douniwan5788 233c229db0 fix: enter_bootloader on macOS 2024-08-22 02:02:52 +08:00
Philippe Teuwen 957db7cb53 flash: fix & simplify post-logo filling 2024-08-17 21:26:32 +02:00
Philippe Teuwen 67ebe71f58 flash: logo even when ansi is off 2024-08-17 21:12:54 +02:00
ikarus cc5df3447c Fix communication timing (delay) after PM3 detection. 2023-12-29 21:20:47 +01:00
wh201906 81888e01a2 Add hw bootloader
Reboot to the bootloader mode in the client
2023-12-13 21:41:17 +08:00
Philippe Teuwen d97f417ee6 Fix clang warnings on increasing alignment requirements 2023-09-07 21:00:07 +02:00
iceman1001 90d1fed1fa coverity somehow believes we read a long string from a file and the data isnt null terminated (i.e. last char is 0x00) so let see if a ugly + 1 will do the trick 2023-07-24 15:14:17 +02:00
iceman1001 300d274d43 coverity migth consider this to be better 2023-07-24 00:14:56 +02:00
iceman1001 e252668866 style 2023-04-23 11:32:59 +02:00
Self Not Found 1f7d3d85a7 Fix the steps when updating from old version
When updating from a old version on Windows, the `pm3-flash-all` always
fails even after updating the bootloader. This is because it detects 
the hardware by the serial number "ICEMAN", which only appears after 
flashing the fullimage.
2022-12-22 12:24:20 +08:00
iceman1001 1faca20f5e textual when flashing 2022-07-10 14:41:09 +02:00
Nemanja Nedeljkovic 86f0f2cc75 cleanup 2022-07-05 18:12:49 +02:00
nemanjan00 0d41ed0bba --reboot-to-bootloader 2022-07-05 16:15:05 +02:00
iceman1001 a7f69b5f13 style 2022-02-27 16:32:42 +01:00
iceman1001 b776c98422 fix copy pasta 2022-02-26 17:40:24 +01:00
Iceman 1c6abece54 Merge branch 'master' into sha 2022-02-25 11:42:20 +01:00
Philippe Teuwen 21089fc346 flasher: skip msg about --force when --force is used 2022-02-25 00:37:54 +01:00
Philippe Teuwen da908315b0 flasher: add option --force rather than interactive prompt 2022-02-25 00:35:30 +01:00
iceman1001 2879b23a1c unify text 2022-02-24 17:38:01 +01:00
Philippe Teuwen 6ead44933a Flasher: factorize and prompt also wehn we can't check the version 2022-02-17 01:43:41 +01:00
Philippe Teuwen 3cbf64c894 Flasher: display and check bootloader elf as well 2022-02-17 01:43:41 +01:00
Philippe Teuwen bfffea6e6c Flasher: show the detailed firmware version 2022-02-17 01:43:41 +01:00
Philippe Teuwen 5997f23139 flasher: ask confirmation if fw mismatch, fix segfault on abort 2022-02-17 01:43:41 +01:00
Philippe Teuwen 72f7bc762d Flasher: read the firmware file in one go 2022-02-17 01:43:41 +01:00
Philippe Teuwen 2a705d3a44 make style 2022-02-17 01:43:41 +01:00
Philippe Teuwen 0ed0735709 flasher: parse ELF to check version_information and do ELF checks before looking for a proxmark3 2022-02-17 01:43:41 +01:00