This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 935a0462173f9b114d6a1f45a8ffa61da7e86eee
Author: hujun5 <[email protected]>
AuthorDate: Wed Dec 17 09:23:25 2025 +0800

    arm: remove common sctlr MACRO in arm.h
    
    remove common sctlr MACRO in arm.h
    
    Signed-off-by: hujun5 <[email protected]>
---
 arch/arm/src/arm/arm.h             | 26 -------------------
 arch/arm/src/arm/arm_head.S        | 52 +++++++++++++++++++-------------------
 arch/arm/src/arm_a_r/sctlr.h       |  5 +++-
 arch/arm/src/dm320/dm320_restart.S |  5 ++--
 4 files changed, 33 insertions(+), 55 deletions(-)

diff --git a/arch/arm/src/arm/arm.h b/arch/arm/src/arm/arm.h
index ff9b8d7f934..a15cae1ba6a 100644
--- a/arch/arm/src/arm/arm.h
+++ b/arch/arm/src/arm/arm.h
@@ -60,32 +60,6 @@
 #define PSR_Z_BIT       0x40000000 /* Bit 30: Zero */
 #define PSR_N_BIT       0x80000000 /* Bit 31: Negative/Less than */
 
-/* CR1 bits (CP#15 CR1) */
-
-#define CR_M            0x00000001 /* MMU enable                          */
-#define CR_A            0x00000002 /* Alignment abort enable              */
-#define CR_C            0x00000004 /* Dcache enable                       */
-#define CR_W            0x00000008 /* Write buffer enable                 */
-#define CR_P            0x00000010 /* 32-bit exception handler            */
-#define CR_D            0x00000020 /* 32-bit data address range           */
-#define CR_L            0x00000040 /* Implementation defined              */
-#define CR_B            0x00000080 /* Big endian                          */
-#define CR_S            0x00000100 /* System MMU protection               */
-#define CR_R            0x00000200 /* ROM MMU protection                  */
-#define CR_F            0x00000400 /* Implementation defined              */
-#define CR_Z            0x00000800 /* Implementation defined              */
-#define CR_I            0x00001000 /* Icache enable                       */
-#define CR_V            0x00002000 /* Vectors relocated to 0xffff0000     */
-#define CR_RR           0x00004000 /* Round Robin cache replacement       */
-#define CR_L4           0x00008000 /* LDR pc can set T bit                */
-#define CR_DT           0x00010000
-#define CR_IT           0x00040000
-#define CR_ST           0x00080000
-#define CR_FI           0x00200000 /* Fast interrupt (lower latency mode) */
-#define CR_U            0x00400000 /* Unaligned access operation          */
-#define CR_XP           0x00800000 /* Extended page tables                */
-#define CR_VE           0x01000000 /* Vectored interrupts                 */
-
 /****************************************************************************
  * Public Data
  ****************************************************************************/
diff --git a/arch/arm/src/arm/arm_head.S b/arch/arm/src/arm/arm_head.S
index a9e2cb9408d..98363d44f89 100644
--- a/arch/arm/src/arm/arm_head.S
+++ b/arch/arm/src/arm/arm_head.S
@@ -352,61 +352,61 @@ __start:
 
        /* Clear bits (see arm.h)
         *
-        * CR_R - ROM MMU protection
-        * CR_F - Implementation defined
-        * CR_Z - Implementation defined
+        * SCTLR_R - ROM MMU protection
+        * SCTLR_SW - Implementation defined
+        * SCTLR_Z - Implementation defined
         *
-        * CR_A - Alignment abort enable
-        * CR_C - Dcache enable
-        * CR_W - Write buffer enable
+        * SCTLR_A - Alignment abort enable
+        * SCTLR_C - Dcache enable
+        * SCTLR_W - Write buffer enable
         *
-        * CR_I - Icache enable
+        * SCTLR_I - Icache enable
         */
 
-       bic             r0, r0, #(CR_R|CR_F|CR_Z)
-       bic             r0, r0, #(CR_A|CR_C|CR_W)
-       bic             r0, r0, #(CR_I)
+       bic             r0, r0, #(SCTLR_R|SCTLR_SW|SCTLR_Z)
+       bic             r0, r0, #(SCTLR_A|SCTLR_C|SCTLR_W)
+       bic             r0, r0, #(SCTLR_I)
 
        /* Set bits (see arm.h)
         *
-        * CR_M - MMU enable
-        * CR_P - 32-bit exception handler
-        * CR_D - 32-bit data address range
+        * SCTLR_M - MMU enable
+        * SCTLR_P - 32-bit exception handler
+        * SCTLR_CCP15BEN - 32-bit data address range
         */
 
-       orr             r0, r0, #(CR_M|CR_P|CR_D)
+       orr             r0, r0, #(SCTLR_M|SCTLR_P|SCTLR_CCP15BEN)
 
        /* In most architectures, vectors are relocated to 0xffff0000.
         * -- but not all
         *
-        * CR_S - System MMU protection
-        * CR_V - Vectors relocated to 0xffff0000
+        * SCTLR_S - System MMU protection
+        * SCTLR_V - Vectors relocated to 0xffff0000
         */
 
 #ifndef CONFIG_ARCH_LOWVECTORS
-       orr             r0, r0, #(CR_S|CR_V)
+       orr             r0, r0, #(SCTLR_S|SCTLR_V)
 #else
-       orr             r0, r0, #(CR_S)
+       orr             r0, r0, #(SCTLR_S)
 #endif
-       /* CR_RR - Round Robin cache replacement */
+       /* SCTLR_RR - Round Robin cache replacement */
 
 #ifdef CONFIG_ARM_CACHE_ROUND_ROBIN
-       orr             r0, r0, #(CR_RR)
+       orr             r0, r0, #(SCTLR_RR)
 #endif
-       /* CR_C - Dcache enable */
+       /* SCTLR_C - Dcache enable */
 
 #ifndef CONFIG_ARM_DCACHE_DISABLE
-       orr             r0, r0, #(CR_C)
+       orr             r0, r0, #(SCTLR_C)
 #endif
-       /* CR_C - Dcache enable */
+       /* SCTLR_C - Dcache enable */
 
 #ifndef CONFIG_ARM_ICACHE_DISABLE
-       orr             r0, r0, #(CR_I)
+       orr             r0, r0, #(SCTLR_I)
 #endif
-       /* CR_A - Alignment abort enable */
+       /* SCTLR_A - Alignment abort enable */
 
 #ifdef CONFIG_ARM_ALIGNMENT_TRAP
-       orr             r0, r0, #(CR_A)
+       orr             r0, r0, #(SCTLR_A)
 #endif
        mcr             p15, 0, r0, c1, c0, 0           /* write control reg */
 
diff --git a/arch/arm/src/arm_a_r/sctlr.h b/arch/arm/src/arm_a_r/sctlr.h
index ef1a382b747..8bca3d28fd4 100644
--- a/arch/arm/src/arm_a_r/sctlr.h
+++ b/arch/arm/src/arm_a_r/sctlr.h
@@ -133,10 +133,13 @@
 #define SCTLR_M                       (1 << 0)  /* Bit 0:  Enables the MMU/MPU 
enable bit */
 #define SCTLR_A                       (1 << 1)  /* Bit 1:  Enables strict 
alignment of data */
 #define SCTLR_C                       (1 << 2)  /* Bit 2:  Determines if data 
can be cached */
-                                                /* Bits 3-9: Reserved */
+#define SCTLR_W                       (1 << 3)  /* Bit 3:  Write buffer enable 
*/
+#define SCTLR_P                       (1 << 4)  /* Bit 4:  32-bit exception 
handler */
 #define SCTLR_CCP15BEN                (1 << 5)  /* Bit 5:  CP15 barrier enable 
*/
                                                 /* Bit 6:  Reserved */
 #define SCTLR_B                       (1 << 7)  /* Bit 7:  Should be zero on 
ARMv7-R */
+#define SCTLR_S                       (1 << 8)  /* Bit 8:  System MMU 
protection */
+#define SCTLR_R                       (1 << 9)  /* Bit 9:  ROM MMU protection 
*/
 #define SCTLR_SW                      (1 << 10) /* Bit 10: SWP/SWPB Enable bit 
*/
 #define SCTLR_Z                       (1 << 11) /* Bit 11: Program flow 
prediction control (1) */
 #define SCTLR_I                       (1 << 12) /* Bit 12: Determines if 
instructions can be cached */
diff --git a/arch/arm/src/dm320/dm320_restart.S 
b/arch/arm/src/dm320/dm320_restart.S
index 347ed4266e9..4c2ba8b1252 100644
--- a/arch/arm/src/dm320/dm320_restart.S
+++ b/arch/arm/src/dm320/dm320_restart.S
@@ -27,6 +27,7 @@
 #include <nuttx/config.h>
 
 #include "arm.h"
+#include "sctlr.h"
 
 /********************************************************************
  * Pre-processor Definitions
@@ -91,8 +92,8 @@ up_phyrestart:
         */
 
        mrc     p15, 0, r0, c1, c0              /* Get control register */
-       bic     r0, r0, #(CR_M|CR_C|CR_A|CR_W)
-       bic     r0, r0, #(CR_S|CR_I|CR_V|CR_RR)
+       bic     r0, r0, #(SCTLR_M|SCTLR_C|SCTLR_A|SCTLR_W)
+       bic     r0, r0, #(SCTLR_S|SCTLR_I|SCTLR_V|SCTLR_RR)
        mcr     p15, 0, r0, c1, c0, 0           /* Write control reg */
 
        /* We know that the bootloader entry point is at the

Reply via email to