From d6f74b342ef5ea28d26644f4acd9d6bd9142f426 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 11 Feb 2026 14:02:58 +0100 Subject: [PATCH] Make sure RAMFUNC is not inlined, else it won't be in RAM. Some static RAMFUNC got inlined which means they weren't relocated in RAM. By forcing noinline on RAMFUNC, the following functions move to RAM: F .data 00000034 optimizedSniff F .data 00000148 skipSniff F .data 000002c8 ManchesterDecoding_Thinfilm But ManchesterDecoding_Thinfilm worked fine without being in RAM, so we remove its RAMFUNC attribute and it works as previously, and avoid eating some RAM bytes. In summary, impacted command is only: hf sniff --- armsrc/iso14443a.c | 2 +- include/common.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/armsrc/iso14443a.c b/armsrc/iso14443a.c index 0ece3c453..743092c8b 100644 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@ -695,7 +695,7 @@ RAMFUNC int ManchesterDecoding(uint8_t bit, uint16_t offset, uint32_t non_real_t // Thinfilm, Kovio mangles ISO14443A in the way that they don't use start bit nor parity bits. -static RAMFUNC int ManchesterDecoding_Thinfilm(uint8_t bit) { +static int ManchesterDecoding_Thinfilm(uint8_t bit) { if (Demod.len == Demod.output_len) { // Flush last parity bits diff --git a/include/common.h b/include/common.h index 05ff0a489..392f5aad1 100644 --- a/include/common.h +++ b/include/common.h @@ -92,7 +92,7 @@ extern bool g_tearoff_enabled; //#define RAMFUNC __attribute((long_call, section(".ramfunc"))) -#define RAMFUNC __attribute((long_call, section(".ramfunc"))) __attribute__((target("arm"))) +#define RAMFUNC __attribute((long_call, section(".ramfunc"))) __attribute__((target("arm"))) __attribute__((noinline)) #ifndef PM3_ROTR # define PM3_ROTR(x,n) (((uintmax_t)(x) >> (n)) | ((uintmax_t)(x) << ((sizeof(x) * 8) - (n))))