From 516ef68ba6e5d6bb8e1dace021c38ec5841e5f1e Mon Sep 17 00:00:00 2001 From: dxl <64101226@qq.com> Date: Sat, 1 Aug 2026 15:55:00 +0800 Subject: [PATCH] Fixed bug for RAMFUNC definition --- include/common.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/common.h b/include/common.h index b138fb953..4d68b066a 100644 --- a/include/common.h +++ b/include/common.h @@ -106,7 +106,14 @@ extern bool g_tearoff_enabled; //#define RAMFUNC __attribute((long_call, section(".ramfunc"))) +// PM5 is at32f435 of CM4 kernal, not at91sam7s arm7, so PM5 unsupported 'arm' old instruction sets. +// about diff see: https://community.arm.com/support-forums/f/architectures-and-processors-forum/5814/what-is-difference-between-arm7-and-arm-cortex-m-series +// if you use '__attribute__((target("arm")))' for CM4 kernal, will error when compile(error: target CPU does not support ARM mode) +#ifdef PM5 +#define RAMFUNC __attribute((section(".ramfunc"))) __attribute__((noinline)) +#else #define RAMFUNC __attribute((long_call, section(".ramfunc"))) __attribute__((target("arm"))) __attribute__((noinline)) +#endif #ifndef PM3_ROTR # define PM3_ROTR(x,n) (((uintmax_t)(x) >> (n)) | ((uintmax_t)(x) << ((sizeof(x) * 8) - (n))))