From ba315d8d58c30a805417cc2d72724d454424a3f3 Mon Sep 17 00:00:00 2001 From: Nemanja Nedeljkovic Date: Wed, 19 Aug 2026 23:56:50 +0200 Subject: [PATCH] fix(pm5): suppress bogus [FPGA] version section on PM5 PM5's FPGA (Gowin GW1NR) bitstream is loaded at runtime via `hw fpga config` and is not compiled into the firmware; only the Xilinx fpga_pm3_hf.bit is pulled in (to generate g_fpga_version_information[]) which PM5 never runs. So the `[ FPGA ] fpga_pm3_hf.ncd image 2s30vq100` line described a bitstream unrelated to the actual device. - Firmware (appmain.c): omit the [FPGA] section from the version string on PM5 (#ifndef PM5), since there's no meaningful built-in FPGA version to report. - Client (cmdhw.c): skip the FPGA_TYPE "chip mismatch" check for PM5, which would otherwise trigger now that the section is gone. --- CHANGELOG.md | 1 + armsrc/appmain.c | 6 ++++++ client/src/cmdhw.c | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d39ca8474..ee0ce183b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Fixed `hw version` / `hw status` showing a bogus FPGA image (`fpga_pm3_hf.ncd image 2s30vq100`) on Proxmark5 (PM5/AT32): PM5's Gowin FPGA bitstream is loaded externally and not compiled in, so the built-in Xilinx version info is meaningless there; the `[ FPGA ]` section (and the client FPGA "chip mismatch" check) are now suppressed for PM5 (@nemanjan00) - Fixed `hw status` [Model] section reporting "PM3 GENERIC" firmware on Proxmark5 (PM5/AT32); it now reports `PM5` (@nemanjan00) - Added Proxmark5 (PM5/AT32) reporting in `hw version` / `hw status`: correct MCU (AT32F437), flash size and `PM5` target, instead of the AT91-decoded "Unknown / 32 KB / PM3 GENERIC". The device now also reports its on-chip flash size, appended to the `CMD_VERSION` reply in a backward-compatible way (@nemanjan00) - Fixed `hf mf dump` preserving readable sector trailer Key B data instead of overwriting it with values from the supplied key file (@oSPANNERo) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 889b17fba..d7b07e832 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -362,6 +362,11 @@ static void SendVersion(void) { strncat(VersionString, " Compiler... GCC "__VERSION__"\n", sizeof(VersionString) - strlen(VersionString) - 1); #endif +#ifndef PM5 + // PM5's FPGA (Gowin) bitstream is loaded at runtime via `hw fpga config` and is + // not compiled into the firmware, so there is no meaningful built-in FPGA + // version to report here. g_fpga_version_information[] describes the Xilinx + // bitstream that PM5 does not run, so omit the section entirely on PM5. strncat(VersionString, "\n [ "_YELLOW_("FPGA")" ] \n ", sizeof(VersionString) - strlen(VersionString) - 1); for (int i = 0; i < g_fpga_bitstream_num; i++) { @@ -370,6 +375,7 @@ static void SendVersion(void) { strncat(VersionString, "\n ", sizeof(VersionString) - strlen(VersionString) - 1); } } +#endif #ifdef WITH_COMPRESSION // Send Chip ID and used flash memory uint32_t text_and_rodata_section_size = (uint32_t)__data_src_start__ - (uint32_t)_flash_start; diff --git a/client/src/cmdhw.c b/client/src/cmdhw.c index 18b132d46..d2671d105 100644 --- a/client/src/cmdhw.c +++ b/client/src/cmdhw.c @@ -2268,7 +2268,9 @@ void pm3_version(bool verbose, bool oneliner) { } } PrintAndLogEx(NORMAL, payload->versionstr); - if (strstr(payload->versionstr, FPGA_TYPE) == NULL) { + // PM5 doesn't report a built-in FPGA version (Gowin bitstream is loaded + // externally), so skip the Xilinx FPGA_TYPE match check for it. + if (!IfPm5() && strstr(payload->versionstr, FPGA_TYPE) == NULL) { PrintAndLogEx(NORMAL, " FPGA firmware... %s", _RED_("chip mismatch")); }