misc: respect standard __ASSEMBLER__ define in CPU headers

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit f44b6c78e0bda7548ba90da9c5e376f8de84152f
Author: Aidan MacDonald <[email protected]>
Date:   Thu Mar 5 19:59:03 2026 +0000

    misc: respect standard __ASSEMBLER__ define in CPU headers
    
    The JZ47xx and S5L87xx processor families used their own
    special defines (__ASSEMBLY__ and ASM respectively) in
    their CPU headers to check if they were included from an
    assembly source file.
    
    For GCC the standard seems to be __ASSEMBLER__, so check
    for that instead and remove the non-standard symbols.
    Being more consistent across platforms makes it easier to
    include cpu.h from cross-platform files (eg. plugin.lds).
    
    Change-Id: I282930cad34e1a2ff18166f3b4338548b34f4a49

diff --git a/firmware/export/jz4740.h b/firmware/export/jz4740.h
index 9e46ce18c2..c963aac852 100644
--- a/firmware/export/jz4740.h
+++ b/firmware/export/jz4740.h
@@ -40,13 +40,13 @@
 #ifndef __JZ4740_H__
 #define __JZ4740_H__
 
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 
 #define REG8(addr)     (*(volatile unsigned char  *)(addr))
 #define REG16(addr)    (*(volatile unsigned short *)(addr))
 #define REG32(addr)    (*(volatile unsigned int   *)(addr))
 
-#endif /* !ASSEMBLY */
+#endif /* !__ASSEMBLER__ */
 
 /*************************************************************************
  *  Boot ROM Specification
@@ -2528,7 +2528,7 @@
 // Module Operation Definitions
 //
 //----------------------------------------------------------------------
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 
 /***************************************************************************
  * GPIO
@@ -4975,7 +4975,7 @@ do{                                 \
 }while(0)
 
 
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
 
 
 #ifndef _IPU_H_
@@ -4986,7 +4986,7 @@ do{                                 \
 #define IPU_V_BASE  0xB3080000
 #define IPU__SIZE   0x00001000
 
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 struct ipu_module
 {
     unsigned int reg_ctrl;             // 0x0
@@ -5023,7 +5023,7 @@ struct Ration2m
     float ratio;
     int n, m;
 };
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
 
 // Register offset
 #define  REG_CTRL           0x0
diff --git a/firmware/export/jz4760b.h b/firmware/export/jz4760b.h
index 5f83887b99..d56ffe69cd 100644
--- a/firmware/export/jz4760b.h
+++ b/firmware/export/jz4760b.h
@@ -37,7 +37,7 @@
 #ifndef __JZ4760B_H__
 #define __JZ4760B_H__
 
-#if defined(__ASSEMBLY__) || defined(__LANGUAGE_ASSEMBLY)
+#if defined(__ASSEMBLER__)
         #ifndef __MIPS_ASSEMBLER
                 #define __MIPS_ASSEMBLER
         #endif
diff --git a/firmware/export/mipsregs.h b/firmware/export/mipsregs.h
index 197f8eb992..30a59baa81 100644
--- a/firmware/export/mipsregs.h
+++ b/firmware/export/mipsregs.h
@@ -485,7 +485,7 @@
 #define CEB_KERNEL    2    /* Count events in kernel mode EXL = ERL = 0 */
 #define CEB_EXL        1    /* Count events with EXL = 1, ERL = 0 */
 
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 
 #define CAUSE_EXCCODE(x) ((CAUSEF_EXCCODE & (x->cp0_cause)) >> CAUSEB_EXCCODE)
 #define CAUSE_EPC(x) (x->cp0_epc + (((x->cp0_cause & CAUSEF_BD) >> CAUSEB_BD) << 2))
@@ -959,6 +959,6 @@ __BUILD_SET_C0(config,CP0_CONFIG)
 #define set_cp0_cause(x)    set_c0_cause(x)
 #define set_cp0_config(x)    set_c0_config(x)
      
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
 
 #endif /* _ASM_MIPSREGS_H */
diff --git a/firmware/export/s5l87xx.h b/firmware/export/s5l87xx.h
index 54c2fd9705..ee43d60ced 100644
--- a/firmware/export/s5l87xx.h
+++ b/firmware/export/s5l87xx.h
@@ -22,7 +22,7 @@
 #ifndef __S5L87XX_H__
 #define __S5L87XX_H__
 
-#ifndef ASM
+#ifndef __ASSEMBLER__
 #include <stdint.h>
 #endif
 
diff --git a/firmware/target/arm/mmu-arm.S b/firmware/target/arm/mmu-arm.S
index bb3bfa9815..85903ec798 100644
--- a/firmware/target/arm/mmu-arm.S
+++ b/firmware/target/arm/mmu-arm.S
@@ -18,7 +18,6 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
-#define ASM
 #include "config.h"
 #include "cpu.h"
 
diff --git a/firmware/target/arm/rk27xx/crt0.S b/firmware/target/arm/rk27xx/crt0.S
index 457d423e4c..de1a5c1b1f 100644
--- a/firmware/target/arm/rk27xx/crt0.S
+++ b/firmware/target/arm/rk27xx/crt0.S
@@ -19,7 +19,6 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
-#define ASM
 #include "config.h"
 #include "cpu.h"
 
diff --git a/firmware/target/arm/s5l8702/app.lds b/firmware/target/arm/s5l8702/app.lds
index fceb732e4f..fe1cfbfbeb 100644
--- a/firmware/target/arm/s5l8702/app.lds
+++ b/firmware/target/arm/s5l8702/app.lds
@@ -1,4 +1,4 @@
-#define ASM
+#define __ASSEMBLER__
 #include "config.h"
 #include "cpu.h"
 
diff --git a/firmware/target/arm/s5l8702/boot.lds b/firmware/target/arm/s5l8702/boot.lds
index 54a4d4d1ae..534e91b858 100644
--- a/firmware/target/arm/s5l8702/boot.lds
+++ b/firmware/target/arm/s5l8702/boot.lds
@@ -1,4 +1,4 @@
-#define ASM
+#define __ASSEMBLER__
 #include "config.h"
 #include "cpu.h"
 #include "crypto-s5l8702.h"     /* IM3HDR_SZ */
diff --git a/firmware/target/arm/s5l8702/crt0.S b/firmware/target/arm/s5l8702/crt0.S
index a3ffcdff53..4fbff28b58 100644
--- a/firmware/target/arm/s5l8702/crt0.S
+++ b/firmware/target/arm/s5l8702/crt0.S
@@ -19,7 +19,6 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
-#define ASM
 #include "config.h"
 #include "cpu.h"
 
diff --git a/firmware/target/arm/s5l8702/crypto-s5l8702.h b/firmware/target/arm/s5l8702/crypto-s5l8702.h
index e9f923589c..d32227c808 100644
--- a/firmware/target/arm/s5l8702/crypto-s5l8702.h
+++ b/firmware/target/arm/s5l8702/crypto-s5l8702.h
@@ -40,7 +40,7 @@
 #define SHA1_SZ     20  /* bytes */
 #define SIGN_SZ     16
 
-#ifndef ASM
+#ifndef __ASSEMBLER__
 #define IM3INFO_SZ      (sizeof(struct Im3Info))
 #define IM3INFOSIGN_SZ  (offsetof(struct Im3Info, info_sign))
 
@@ -92,6 +92,6 @@ void im3_sign(uint32_t keyidx, void* data, uint32_t size, void* sign);
 void im3_crypt(enum hwkeyaes_direction direction,
                             struct Im3Info *hinfo, void *fw_addr);
 
-#endif /* ASM */
+#endif /* !__ASSEMBLER__ */
 
 #endif /* __CRYPTO_S5L8702_H__ */
diff --git a/firmware/target/arm/s5l8702/lcd-asm-s5l8702.S b/firmware/target/arm/s5l8702/lcd-asm-s5l8702.S
index 1ed7c4e189..2bd591bcfb 100644
--- a/firmware/target/arm/s5l8702/lcd-asm-s5l8702.S
+++ b/firmware/target/arm/s5l8702/lcd-asm-s5l8702.S
@@ -50,7 +50,6 @@
 #define YUV2RGB_VERSION     VERSION_ARMV5TE_WST
 
 
-#define ASM
 #include "config.h"
 #include "cpu.h"
 
diff --git a/firmware/target/mips/ingenic_jz47xx/app.lds b/firmware/target/mips/ingenic_jz47xx/app.lds
index 701c9b4b58..a748dd78dd 100644
--- a/firmware/target/mips/ingenic_jz47xx/app.lds
+++ b/firmware/target/mips/ingenic_jz47xx/app.lds
@@ -1,5 +1,5 @@
+#define __ASSEMBLER__
 #include "config.h"
-#define __ASSEMBLY__
 #include "cpu.h"
 
 OUTPUT_FORMAT("elf32-littlemips")
diff --git a/utils/hwstub/stub/jz4760b/jz4760b.h b/utils/hwstub/stub/jz4760b/jz4760b.h
index 79a3d0eb29..2bfb91c7c1 100644
--- a/utils/hwstub/stub/jz4760b/jz4760b.h
+++ b/utils/hwstub/stub/jz4760b/jz4760b.h
@@ -15,7 +15,7 @@
 #ifndef __JZ4760B_H__
 #define __JZ4760B_H__
 
-#if defined(__ASSEMBLY__) || defined(__LANGUAGE_ASSEMBLY)
+#if defined(__ASSEMBLER__)
         #ifndef __MIPS_ASSEMBLER
                 #define __MIPS_ASSEMBLER
         #endif
diff --git a/utils/mks5lboot/dualboot/dualboot.lds b/utils/mks5lboot/dualboot/dualboot.lds
index cb92e2a286..afa8dcc28f 100644
--- a/utils/mks5lboot/dualboot/dualboot.lds
+++ b/utils/mks5lboot/dualboot/dualboot.lds
@@ -1,4 +1,4 @@
-#define ASM
+#define __ASSEMBLER__
 #include "config.h"
 #include "cpu.h"
 #include "mks5lboot.h"
diff --git a/utils/mks5lboot/mks5lboot.h b/utils/mks5lboot/mks5lboot.h
index 084bec61f9..4cb21ddcee 100644
--- a/utils/mks5lboot/mks5lboot.h
+++ b/utils/mks5lboot/mks5lboot.h
@@ -30,7 +30,7 @@
 #define BIN_OFFSET      (CERT_OFFSET + ((CERT_SIZE + 0x3) & ~ 0x3))
 #define MAX_PAYLOAD     (DFU_MAXSIZE - BIN_OFFSET)
 
-#ifndef ASM
+#ifndef __ASSEMBLER__
 #include <stddef.h>
 #include <stdint.h>
 
@@ -124,6 +124,6 @@ void ipoddfu_debug(int debug);
 #ifdef __cplusplus
 };
 #endif
-#endif /* ASM */
+#endif /* __ASSEMBLER__ */
 
 #endif /* __MK6GBOOT_H__ */
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.