You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2025/11/13 17:49:16 UTC

(nuttx) branch master updated (0b9c86905b8 -> 2ce0c128f95)

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

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


    from 0b9c86905b8 arch/tricore: Fix specific definitions in the generic UART module
     new 1d9e160f970 toolchain/ghs: add Greenhills compiler support for .type directive for arm-v8r
     new ecef24ea335 toolchain/ghs: greenhills compiler does not recognize .syntax unified
     new e0e8a6e8524 toolchain/ghs: _hyp_vector_start uses b . syntax for both GCC and ghs
     new c9eeb4cb143 toolchain/ghs: change alignment syntax for GHS
     new 2ce0c128f95 toolchain/ghs: Adapt .macro syntax for GHS compiler

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/arm/src/armv8-r/arm_fpuconfig.S       |   6 ++
 arch/arm/src/armv8-r/arm_head.S            |  34 ++++++++
 arch/arm/src/armv8-r/arm_saveusercontext.S |   6 ++
 arch/arm/src/armv8-r/arm_vectors.S         | 122 +++++++++++++++++++++++++++
 arch/arm/src/armv8-r/arm_vectortab.S       |  16 ++--
 arch/arm/src/armv8-r/cp15_cacheops.h       | 131 +++++++++++++++++++++++++++++
 arch/arm/src/armv8-r/sctlr.h               |  24 ++++++
 arch/arm/src/common/gnu/arm_fetchadd.S     |  26 ++++++
 8 files changed, 358 insertions(+), 7 deletions(-)


(nuttx) 05/05: toolchain/ghs: Adapt .macro syntax for GHS compiler

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2ce0c128f95ba8114f1cb5a63c8f407cff288865
Author: xiezhanpeng3 <xi...@lixiang.com>
AuthorDate: Thu Nov 13 13:59:32 2025 +0800

    toolchain/ghs: Adapt .macro syntax for GHS compiler
    
    The GHS compiler uses different .macro syntax. Without this change,
    the GHS compiler reports error like:
    [asarm] (error #2014) nuttx/arch/arm/src/armv8-r/arm_vectors.S 155: expected a register
      vstmdb \ out ! , { s0 - s31 }
    ---------^
    
    And:
    [asarm] (error #2179) nuttx/arch/arm/src/armv8-r/arm_vectors.S 141: unexpected token type (comma) encountered; expected type (char)
      .macro savefpu , out , tmp
    -----------------^
    
    Co-authored-by: Chengdong Wang <wa...@lixiang.com>
    Signed-off-by: xiezhanpeng3 <xi...@lixiang.com>
---
 arch/arm/src/armv8-r/arm_vectors.S   |  55 +++++++++++++++
 arch/arm/src/armv8-r/cp15_cacheops.h | 131 +++++++++++++++++++++++++++++++++++
 arch/arm/src/armv8-r/sctlr.h         |  24 +++++++
 3 files changed, 210 insertions(+)

diff --git a/arch/arm/src/armv8-r/arm_vectors.S b/arch/arm/src/armv8-r/arm_vectors.S
index d4a6398ebd1..abe52d606c0 100644
--- a/arch/arm/src/armv8-r/arm_vectors.S
+++ b/arch/arm/src/armv8-r/arm_vectors.S
@@ -53,10 +53,16 @@
  ****************************************************************************/
 
 #if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
+#ifdef __ghs__
+	.macro	setirqstack tmp1 tmp2
+	ldr		sp, .Lirqstacktop		/* SP = IRQ stack top */
+	.endm
+#else
 	.macro	setirqstack, tmp1, tmp2
 	ldr		sp, .Lirqstacktop		/* SP = IRQ stack top */
 	.endm
 #endif
+#endif
 
 /****************************************************************************
  * Name: setfiqstack
@@ -68,10 +74,16 @@
  ****************************************************************************/
 
 #if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
+#ifdef __ghs__
+	.macro	setfiqstack tmp1 tmp2
+	ldr		sp, .Lfiqstacktop		/* SP = FIQ stack top */
+	.endm
+#else
 	.macro	setfiqstack, tmp1, tmp2
 	ldr		sp, .Lfiqstacktop		/* SP = FIQ stack top */
 	.endm
 #endif
+#endif
 
 /****************************************************************************
  * Name: savefpu
@@ -82,6 +94,26 @@
  ****************************************************************************/
 
 #ifdef CONFIG_ARCH_FPU
+#ifdef __ghs__
+	.macro	savefpu out tmp
+	/* Store all floating point registers.  Registers are stored in numeric order,
+	 * s0, s1, ... in increasing address order.
+	 */
+
+	/* Store the floating point control and status register. */
+
+	vmrs		tmp, fpscr			/* Fetch the FPSCR */
+	str		tmp, [out, #-4]! 		/* Save the floating point control and status register */
+
+#ifdef CONFIG_ARM_DPFPU32
+	vstmdb.64	out!, {d16-d31}		/* Save the full FP context */
+	vstmdb.64	out!, {d0-d15}
+#else
+	vstmdb		out!, {s0-s31}			/* Save the full FP context */
+#endif
+
+	.endm
+#else /* __ghs__ */
 	.macro	savefpu, out, tmp
 	/* Store all floating point registers.  Registers are stored in numeric order,
 	 * s0, s1, ... in increasing address order.
@@ -100,6 +132,7 @@
 #endif
 
 	.endm
+#endif /* __ghs__ */
 #endif
 
 /****************************************************************************
@@ -111,6 +144,27 @@
  ****************************************************************************/
 
 #ifdef CONFIG_ARCH_FPU
+#ifdef __ghs__
+	.macro	restorefpu in tmp
+	/* Load all floating point registers.  Registers are loaded in numeric order,
+	 * s0, s1, ... in increasing address order.
+	 */
+
+#ifdef CONFIG_ARM_DPFPU32
+	vldmia.64	in!, {d0-d15}			/* Restore the full FP context */
+	vldmia.64	in!, {d16-d31}
+#else
+	vldmia		in!, {s0-s31}			/* Restore the full FP context */
+#endif
+
+	/* Load the floating point control and status register.   At the end of the
+	 * vstmia, \in will point to the FPSCR storage location.
+	 */
+
+	ldr		tmp, [in], #4			/* Fetch the floating point control and status register */
+	vmsr		fpscr, tmp			/* Restore the FPSCR */
+	.endm
+#else
 	.macro	restorefpu, in, tmp
 	/* Load all floating point registers.  Registers are loaded in numeric order,
 	 * s0, s1, ... in increasing address order.
@@ -130,6 +184,7 @@
 	ldr		\tmp, [\in], #4			/* Fetch the floating point control and status register */
 	vmsr		fpscr, \tmp			/* Restore the FPSCR */
 	.endm
+#endif /* __ghs__ */
 #endif
 
 /****************************************************************************
diff --git a/arch/arm/src/armv8-r/cp15_cacheops.h b/arch/arm/src/armv8-r/cp15_cacheops.h
index cadd8f85904..fa7c93d1be6 100644
--- a/arch/arm/src/armv8-r/cp15_cacheops.h
+++ b/arch/arm/src/armv8-r/cp15_cacheops.h
@@ -224,12 +224,21 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_enable_dcache tmp
+  mrc p15, 0, tmp, c1, c0, 0 /* Read SCTLR */
+  orr tmp, tmp, #(0x1 << 2)  /* Enable D cache */
+  mcr p15, 0, tmp, c1, c0, 0 /* Update the SCTLR */
+  isb
+.endm
+#else
 .macro cp15_enable_dcache, tmp
   mrc p15, 0, \tmp, c1, c0, 0 /* Read SCTLR */
   orr \tmp, \tmp, #(0x1 << 2) /* Enable D cache */
   mcr p15, 0, \tmp, c1, c0, 0 /* Update the SCTLR */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_disable_dcache
@@ -245,12 +254,21 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_disable_dcache tmp
+  mrc p15, 0, tmp, c1, c0, 0 /* Read SCTLR */
+  bic tmp, tmp, #(0x1 << 2)  /* Disable D cache */
+  mcr p15, 0, tmp, c1, c0, 0 /* Update the SCTLR */
+  isb
+.endm
+#else
 .macro cp15_disable_dcache, tmp
   mrc p15, 0, \tmp, c1, c0, 0 /* Read SCTLR */
   bic \tmp, \tmp, #(0x1 << 2) /* Disable D cache */
   mcr p15, 0, \tmp, c1, c0, 0 /* Update the SCTLR */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_enable_icache
@@ -266,12 +284,21 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_enable_icache tmp
+  mrc p15, 0, tmp, c1, c0, 0  /* Read SCTLR */
+  orr tmp, tmp, #(0x1 << 12)  /* Enable I cache */
+  mcr p15, 0, tmp, c1, c0, 0  /* Update the SCTLR */
+  isb
+.endm
+#else
 .macro cp15_enable_icache, tmp
   mrc p15, 0, \tmp, c1, c0, 0  /* Read SCTLR */
   orr \tmp, \tmp, #(0x1 << 12) /* Enable I cache */
   mcr p15, 0, \tmp, c1, c0, 0  /* Update the SCTLR */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_disable_icache
@@ -287,12 +314,21 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_disable_icache tmp
+  mrc p15, 0, tmp, c1, c0, 0  /* Read SCTLR */
+  bic tmp, tmp, #(0x1 << 12)  /* Disable I cache */
+  mcr p15, 0, tmp, c1, c0, 0  /* Update the SCTLR */
+  isb
+.endm
+#else
 .macro cp15_disable_icache, tmp
   mrc p15, 0, \tmp, c1, c0, 0  /* Read SCTLR */
   bic \tmp, \tmp, #(0x1 << 12) /* Disable I cache */
   mcr p15, 0, \tmp, c1, c0, 0  /* Update the SCTLR */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_invalidate_icache_inner_sharable
@@ -308,11 +344,19 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_invalidate_icache_inner_sharable tmp
+  mov tmp, #0
+  mrc p15, 0, tmp, c7, c1, 0 /* ICIALLUIS */
+  isb
+.endm
+#else
 .macro cp15_invalidate_icache_inner_sharable, tmp
   mov \tmp, #0
   mrc p15, 0, \tmp, c7, c1, 0 /* ICIALLUIS */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_invalidate_btb_inner_sharable
@@ -328,11 +372,19 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_invalidate_btb_inner_sharable tmp
+  mov tmp, #0
+  mrc p15, 0, tmp, c7, c1, 6 /* BPIALLIS */
+  isb
+.endm
+#else
 .macro cp15_invalidate_btb_inner_sharable, tmp
   mov \tmp, #0
   mrc p15, 0, \tmp, c7, c1, 6 /* BPIALLIS */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_invalidate_icache_all
@@ -349,11 +401,19 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_invalidate_icache_all tmp
+  mov tmp, #0
+  mrc p15, 0, tmp, c7, c5, 0 /* ICIALLU */
+  isb
+.endm
+#else
 .macro cp15_invalidate_icache_all, tmp
   mov \tmp, #0
   mrc p15, 0, \tmp, c7, c5, 0 /* ICIALLU */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_invalidate_icache_bymva
@@ -369,10 +429,17 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_invalidate_icache_bymva va
+  mrc p15, 0, va, c7, c5, 1 /* ICIMVAU */
+  isb
+.endm
+#else
 .macro cp15_invalidate_icache_bymva, va
   mrc p15, 0, \va, c7, c5, 1 /* ICIMVAU */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_flush_btb
@@ -388,11 +455,19 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_flush_btb tmp
+  mov tmp, #0
+  mrc p15, 0, tmp, c7, c5, 6 /* BPIALL */
+  isb
+.endm
+#else
 .macro cp15_flush_btb, tmp
   mov \tmp, #0
   mrc p15, 0, \tmp, c7, c5, 6 /* BPIALL */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_flush_btb_bymva
@@ -408,10 +483,17 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_flush_btb_bymva va
+  mrc p15, 0, va, c7, c5, 7 /* BPIMVA */
+  isb
+.endm
+#else
 .macro cp15_flush_btb_bymva, va
   mrc p15, 0, \va, c7, c5, 7 /* BPIMVA */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_invalidate_dcacheline_bymva
@@ -427,10 +509,17 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_invalidate_dcacheline_bymva va
+  mrc p15, 0, va, c7, c6, 1 /* DCIMVAC */
+  isb
+.endm
+#else
 .macro cp15_invalidate_dcacheline_bymva, va
   mrc p15, 0, \va, c7, c6, 1 /* DCIMVAC */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_invalidate_dcacheline_bysetway
@@ -446,10 +535,17 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_invalidate_dcacheline_bysetway setway
+  mrc p15, 0, setway, c7, c6, 2 /* DCISW */
+  isb
+.endm
+#else
 .macro cp15_invalidate_dcacheline_bysetway, setway
   mrc p15, 0, \setway, c7, c6, 2 /* DCISW */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_clean_dcache_bymva
@@ -465,10 +561,17 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_clean_dcache_bymva va
+  mrc p15, 0, va, c7, c10, 1 /* DCCMVAC */
+  isb
+.endm
+#else
 .macro cp15_clean_dcache_bymva, va
   mrc p15, 0, \va, c7, c10, 1 /* DCCMVAC */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_clean_dcache_bysetway
@@ -484,10 +587,17 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_clean_dcache_bysetway setway
+  mrc p15, 0, setway, c7, c10, 2 /* DCCSW */
+  isb
+.endm
+#else
 .macro cp15_clean_dcache_bysetway, setway
   mrc p15, 0, \setway, c7, c10, 2 /* DCCSW */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_clean_ucache_bymva
@@ -503,10 +613,17 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_clean_ucache_bymva va
+  mrc p15, 0, va, c7, c11, 1 /* DCCMVAU */
+  isb
+.endm
+#else
 .macro cp15_clean_ucache_bymva, va
   mrc p15, 0, \va, c7, c11, 1 /* DCCMVAU */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_cleaninvalidate_dcacheline_bymva
@@ -522,10 +639,17 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_cleaninvalidate_dcacheline_bymva va
+  mrc p15, 0, va, c7, c14, 1 /* DCCIMVAC */
+  isb
+.endm
+#else
 .macro cp15_cleaninvalidate_dcacheline_bymva, va
   mrc p15, 0, \va, c7, c14, 1 /* DCCIMVAC */
   isb
 .endm
+#endif
 
 /****************************************************************************
  * Name: cp15_cleaninvalidate_dcacheline
@@ -541,10 +665,17 @@
  *
  ****************************************************************************/
 
+#ifdef __ghs__
+.macro cp15_cleaninvalidate_dcacheline setway
+  mrc p15, 0, setway, c7, c14, 2 /* DCCISW */
+  isb
+.endm
+#else
 .macro cp15_cleaninvalidate_dcacheline, setway
   mrc p15, 0, \setway, c7, c14, 2 /* DCCISW */
   isb
 .endm
+#endif
 
 #endif /* __ASSEMBLY__ */
 
diff --git a/arch/arm/src/armv8-r/sctlr.h b/arch/arm/src/armv8-r/sctlr.h
index 36a3239e7e6..f741d99a69a 100644
--- a/arch/arm/src/armv8-r/sctlr.h
+++ b/arch/arm/src/armv8-r/sctlr.h
@@ -496,6 +496,29 @@
 
 /* Get the device ID */
 
+#ifdef __ghs__
+.macro cp15_rdid id
+  mrc p15, 0, id, c0, c0, 0
+.endm
+
+/* Read/write the system control register (SCTLR) */
+
+.macro cp15_rdsctlr sctlr
+  mrc p15, 0, sctlr, c1, c0, 0
+.endm
+
+.macro cp15_wrsctlr sctlr
+  mcr p15, 0, sctlr, c1, c0, 0
+  nop
+  nop
+  nop
+  nop
+  nop
+  nop
+  nop
+  nop
+.endm
+#else
 .macro cp15_rdid, id
   mrc p15, 0, \id, c0, c0, 0
 .endm
@@ -517,6 +540,7 @@
   nop
   nop
 .endm
+#endif
 #endif /* __ASSEMBLY__ */
 
 /****************************************************************************


(nuttx) 03/05: toolchain/ghs: _hyp_vector_start uses b . syntax for both GCC and ghs

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e0e8a6e85241262dca1f876bffa881f1a0f89f2e
Author: xiezhanpeng3 <xi...@lixiang.com>
AuthorDate: Thu Nov 13 11:22:50 2025 +0800

    toolchain/ghs: _hyp_vector_start uses b . syntax for both GCC and ghs
    
    The $+0x0 is not accepted by Ghs compiler. Therefore, we change it to a
    more common syntax " b   ." for endless self loop.
    
    Signed-off-by: xiezhanpeng3 <xi...@lixiang.com>
---
 arch/arm/src/armv8-r/arm_vectortab.S | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/src/armv8-r/arm_vectortab.S b/arch/arm/src/armv8-r/arm_vectortab.S
index 90d424041f8..01b8145bc6c 100644
--- a/arch/arm/src/armv8-r/arm_vectortab.S
+++ b/arch/arm/src/armv8-r/arm_vectortab.S
@@ -112,13 +112,13 @@ _sys_vector_end:
 
 _hyp_vector_start:
 	ldr		pc, .Lhypresethandler	/* 0x00: Reset */
-	b		$+0x0					/* 0x04: Undefined instruction */
-	b		$+0x0					/* 0x08: Software interrupt */
-	b		$+0x0					/* 0x0c: Prefetch abort */
-	b		$+0x0					/* 0x10: Data abort */
-	b		$+0x0					/* 0x14: Address exception (reserved) */
-	b		$+0x0					/* 0x18: IRQ */
-	b		$+0x0					/* 0x1c: FIQ */
+	b		.					/* 0x04: Undefined instruction */
+	b		.					/* 0x08: Software interrupt */
+	b		.					/* 0x0c: Prefetch abort */
+	b		.					/* 0x10: Data abort */
+	b		.					/* 0x14: Address exception (reserved) */
+	b		.					/* 0x18: IRQ */
+	b		.					/* 0x1c: FIQ */
 
 	.globl	__start
 


(nuttx) 02/05: toolchain/ghs: greenhills compiler does not recognize .syntax unified

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ecef24ea335adcd1bfbe7c679edd60a8e829a7bf
Author: xiezhanpeng3 <xi...@lixiang.com>
AuthorDate: Wed Nov 12 16:24:55 2025 +0800

    toolchain/ghs: greenhills compiler does not recognize .syntax unified
    
    The GreenHills Compiler uses Unified Assembler Language by default and
    it does not recognize .syntax unified instruction. Therefore, remove
    them if GHS compiler is used.
    
    Co-authored-by: Chengdong Wang <wa...@lixiang.com>
    Signed-off-by: xiezhanpeng3 <xi...@lixiang.com>
---
 arch/arm/src/armv8-r/arm_fpuconfig.S       | 2 ++
 arch/arm/src/armv8-r/arm_head.S            | 2 ++
 arch/arm/src/armv8-r/arm_saveusercontext.S | 2 ++
 arch/arm/src/armv8-r/arm_vectors.S         | 2 ++
 arch/arm/src/armv8-r/arm_vectortab.S       | 2 ++
 arch/arm/src/common/gnu/arm_fetchadd.S     | 2 ++
 6 files changed, 12 insertions(+)

diff --git a/arch/arm/src/armv8-r/arm_fpuconfig.S b/arch/arm/src/armv8-r/arm_fpuconfig.S
index 2986655fd67..0d2c8583a1c 100644
--- a/arch/arm/src/armv8-r/arm_fpuconfig.S
+++ b/arch/arm/src/armv8-r/arm_fpuconfig.S
@@ -50,7 +50,9 @@
  ****************************************************************************/
 
 	.text
+#ifndef __ghs__
 	.syntax	unified
+#endif
 	.arm
 
 /****************************************************************************
diff --git a/arch/arm/src/armv8-r/arm_head.S b/arch/arm/src/armv8-r/arm_head.S
index 36a5e0a7fba..57d3d5bbcc2 100644
--- a/arch/arm/src/armv8-r/arm_head.S
+++ b/arch/arm/src/armv8-r/arm_head.S
@@ -129,7 +129,9 @@
  */
 
 	.text
+#ifndef __ghs__
 	.syntax	unified
+#endif
 	.arm
 	.global	__start
 #ifdef __ghs__
diff --git a/arch/arm/src/armv8-r/arm_saveusercontext.S b/arch/arm/src/armv8-r/arm_saveusercontext.S
index b95f5858c65..6854d79397f 100644
--- a/arch/arm/src/armv8-r/arm_saveusercontext.S
+++ b/arch/arm/src/armv8-r/arm_saveusercontext.S
@@ -30,7 +30,9 @@
 	.file	"arm_saveusercontext.S"
 
 	.text
+#ifndef __ghs__
 	.syntax	unified
+#endif
 	.arm
 
 /****************************************************************************
diff --git a/arch/arm/src/armv8-r/arm_vectors.S b/arch/arm/src/armv8-r/arm_vectors.S
index f9cf7f94fbe..db98d8bedec 100644
--- a/arch/arm/src/armv8-r/arm_vectors.S
+++ b/arch/arm/src/armv8-r/arm_vectors.S
@@ -137,7 +137,9 @@
  ****************************************************************************/
 
 	.text
+#ifndef __ghs__
 	.syntax	unified
+#endif
 	.arm
 
 /****************************************************************************
diff --git a/arch/arm/src/armv8-r/arm_vectortab.S b/arch/arm/src/armv8-r/arm_vectortab.S
index 5ea4de18c1a..90d424041f8 100644
--- a/arch/arm/src/armv8-r/arm_vectortab.S
+++ b/arch/arm/src/armv8-r/arm_vectortab.S
@@ -40,7 +40,9 @@
 	.eabi_attribute Tag_ABI_align_preserved, 1
 #endif
 
+#ifndef __ghs__
 	.syntax	unified
+#endif
 	.arm
 
 	.globl		_sys_vector_start
diff --git a/arch/arm/src/common/gnu/arm_fetchadd.S b/arch/arm/src/common/gnu/arm_fetchadd.S
index 79eb592594f..7435bb501ed 100644
--- a/arch/arm/src/common/gnu/arm_fetchadd.S
+++ b/arch/arm/src/common/gnu/arm_fetchadd.S
@@ -26,7 +26,9 @@
 
 #include <nuttx/config.h>
 
+#ifndef __ghs__
 	.syntax		unified
+#endif
 	.file		"arm_fetchadd.S"
 
 /****************************************************************************


(nuttx) 04/05: toolchain/ghs: change alignment syntax for GHS

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c9eeb4cb1439a2776acb20a440d0271fdaed214f
Author: xiezhanpeng3 <xi...@lixiang.com>
AuthorDate: Thu Nov 13 11:48:54 2025 +0800

    toolchain/ghs: change alignment syntax for GHS
    
    The .align N syntax in GHS means the alignment is N Bytes. In GCC
    compiler, it means 2**N Bytes. Therefore, .align 32 in GHS and
    .align 5 in GCC are equivalent.
    
    Co-authored-by: Chengdong Wang <wa...@lixiang.com>
    Signed-off-by: xiezhanpeng3 <xi...@lixiang.com>
---
 arch/arm/src/armv8-r/arm_vectors.S | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/src/armv8-r/arm_vectors.S b/arch/arm/src/armv8-r/arm_vectors.S
index db98d8bedec..d4a6398ebd1 100644
--- a/arch/arm/src/armv8-r/arm_vectors.S
+++ b/arch/arm/src/armv8-r/arm_vectors.S
@@ -259,7 +259,11 @@ arm_vectorirq:
 #endif
 	.size	arm_vectorirq, . - arm_vectorirq
 
+#ifdef __ghs__
+	.align	32
+#else
 	.align	5
+#endif
 
 /****************************************************************************
  * Function: arm_vectorsvc
@@ -370,7 +374,11 @@ arm_vectorsvc:
 	rfeia		r14
 	.size	arm_vectorsvc, . - arm_vectorsvc
 
+#ifdef __ghs__
+	.align	32
+#else
 	.align	5
+#endif
 
 /****************************************************************************
  * Name: arm_vectordata
@@ -465,7 +473,11 @@ arm_vectordata:
 	rfeia		r14
 	.size	arm_vectordata, . - arm_vectordata
 
+#ifdef __ghs__
+	.align	32
+#else
 	.align	5
+#endif
 
 /****************************************************************************
  * Name: arm_vectorprefetch
@@ -554,7 +566,11 @@ arm_vectorprefetch:
 	rfeia		r14
 	.size	arm_vectorprefetch, . - arm_vectorprefetch
 
+#ifdef __ghs__
+	.align	32
+#else
 	.align	5
+#endif
 
 /****************************************************************************
  * Name: arm_vectorundefinsn
@@ -638,7 +654,11 @@ arm_vectorundefinsn:
 	rfeia		r14
 	.size	arm_vectorundefinsn, . - arm_vectorundefinsn
 
+#ifdef __ghs__
+	.align	32
+#else
 	.align	5
+#endif
 
 /****************************************************************************
  * Name: arm_vectorfiq


(nuttx) 01/05: toolchain/ghs: add Greenhills compiler support for .type directive for arm-v8r

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1d9e160f97023cde87dbf624cd569239a91e1c8f
Author: xiezhanpeng3 <xi...@lixiang.com>
AuthorDate: Wed Nov 12 15:52:03 2025 +0800

    toolchain/ghs: add Greenhills compiler support for .type directive for arm-v8r
    
    The GreenHills Compiler uses different grammer for the .type directive
    in asm, this patch adds support for the grammer for arm-v8r.
    Similar change for arm-v7r was done in pull request #12883.
    
    Co-authored-by: Chengdong Wang <wa...@lixiang.com>
    Signed-off-by: xiezhanpeng3 <xi...@lixiang.com>
---
 arch/arm/src/armv8-r/arm_fpuconfig.S       |  4 +++
 arch/arm/src/armv8-r/arm_head.S            | 32 +++++++++++++++++++++
 arch/arm/src/armv8-r/arm_saveusercontext.S |  4 +++
 arch/arm/src/armv8-r/arm_vectors.S         | 45 ++++++++++++++++++++++++++++++
 arch/arm/src/common/gnu/arm_fetchadd.S     | 24 ++++++++++++++++
 5 files changed, 109 insertions(+)

diff --git a/arch/arm/src/armv8-r/arm_fpuconfig.S b/arch/arm/src/armv8-r/arm_fpuconfig.S
index c4a7c342908..2986655fd67 100644
--- a/arch/arm/src/armv8-r/arm_fpuconfig.S
+++ b/arch/arm/src/armv8-r/arm_fpuconfig.S
@@ -66,7 +66,11 @@
  ****************************************************************************/
 
 	.globl	arm_fpuconfig
+#ifdef __ghs__
+	.type	arm_fpuconfig, $function
+#else
 	.type	arm_fpuconfig, %function
+#endif
 
 arm_fpuconfig:
 
diff --git a/arch/arm/src/armv8-r/arm_head.S b/arch/arm/src/armv8-r/arm_head.S
index 6d3eec5ff4e..36a5e0a7fba 100644
--- a/arch/arm/src/armv8-r/arm_head.S
+++ b/arch/arm/src/armv8-r/arm_head.S
@@ -132,7 +132,11 @@
 	.syntax	unified
 	.arm
 	.global	__start
+#ifdef __ghs__
+	.type	__start, $function
+#else
 	.type	__start, #function
+#endif
 
 __start:
 	/* Get cpuindex, cpu0 continue boot, others wait event from cpu0 */
@@ -275,7 +279,11 @@ __cpu0_start:
  ***************************************************************************/
 
 	.global	arm_data_initialize
+#ifdef __ghs__
+	.type	arm_data_initialize, $function
+#else
 	.type	arm_data_initialize, #function
+#endif
 
 arm_data_initialize:
 
@@ -354,7 +362,11 @@ arm_data_initialize:
  ***************************************************************************/
 
 	.global	hsctlr_initialize
+#ifdef __ghs__
+	.type	hsctlr_initialize, $function
+#else
 	.type	hsctlr_initialize, #function
+#endif
 
 hsctlr_initialize:
 	mrc		CP15_HSCTLR(r0)		/* Get Hyp System Control Register */
@@ -386,7 +398,11 @@ hsctlr_initialize:
  ***************************************************************************/
 
 	.global	sctlr_initialize
+#ifdef __ghs__
+	.type	sctlr_initialize, $function
+#else
 	.type	sctlr_initialize, #function
+#endif
 
 sctlr_initialize:
 	/* Configure the system control register (see sctrl.h) */
@@ -553,7 +569,11 @@ sctlr_initialize:
 	 * end of memory.  See g_idle_topstack below.
 	 */
 
+#ifdef __ghs__
+	.type	.Linitparms, $object
+#else
 	.type	.Linitparms, %object
+#endif
 .Linitparms:
 	.long	_sbss
 	.long	_ebss
@@ -564,7 +584,11 @@ sctlr_initialize:
 	.long	_sys_vector_start
 
 #ifdef CONFIG_BOOT_RUNFROMFLASH
+#ifdef __ghs__
+	.type	.Ldatainit, $object
+#else
 	.type	.Ldatainit, %object
+#endif
 .Ldatainit:
 	.long	_eronly					/* Where .data defaults are stored in FLASH */
 	.long	_sdata					/* Where .data needs to reside in SDRAM */
@@ -572,7 +596,11 @@ sctlr_initialize:
 #endif
 
 #ifdef CONFIG_ARCH_RAMFUNCS
+#ifdef __ghs__
+	.type	.Lfuncinit, $object
+#else
 	.type	.Lfuncinit, %object
+#endif
 .Lfuncinit:
 	.long	_framfuncs				/* Where RAM functions are stored in FLASH */
 .Lramfuncs:
@@ -593,7 +621,11 @@ sctlr_initialize:
 	.section	.rodata, "a"
 	.align	4
 	.globl	g_idle_topstack
+#ifdef __ghs__
+	.type	g_idle_topstack, $object
+#else
 	.type	g_idle_topstack, object
+#endif
 
 g_idle_topstack:
 
diff --git a/arch/arm/src/armv8-r/arm_saveusercontext.S b/arch/arm/src/armv8-r/arm_saveusercontext.S
index c67b0c287e2..b95f5858c65 100644
--- a/arch/arm/src/armv8-r/arm_saveusercontext.S
+++ b/arch/arm/src/armv8-r/arm_saveusercontext.S
@@ -54,7 +54,11 @@
 
 	.globl	up_saveusercontext
 	.globl	up_saveusercontext
+#ifdef __ghs__
+	.type	up_saveusercontext, $function
+#else
 	.type	up_saveusercontext, %function
+#endif
 
 up_saveusercontext:
 
diff --git a/arch/arm/src/armv8-r/arm_vectors.S b/arch/arm/src/armv8-r/arm_vectors.S
index 76a601c8c08..f9cf7f94fbe 100644
--- a/arch/arm/src/armv8-r/arm_vectors.S
+++ b/arch/arm/src/armv8-r/arm_vectors.S
@@ -154,7 +154,11 @@
 
 	.globl	arm_decodeirq
 	.globl	arm_vectorirq
+#ifdef __ghs__
+	.type	arm_vectorirq, $function
+#else
 	.type	arm_vectorirq, %function
+#endif
 
 arm_vectorirq:
 
@@ -265,7 +269,11 @@ arm_vectorirq:
 
 	.globl	arm_syscall
 	.globl	arm_vectorsvc
+#ifdef __ghs__
+	.type	arm_vectorsvc, $function
+#else
 	.type	arm_vectorsvc, %function
+#endif
 
 arm_vectorsvc:
 
@@ -375,7 +383,11 @@ arm_vectorsvc:
 
 	.globl	arm_dataabort
 	.globl	arm_vectordata
+#ifdef __ghs__
+	.type	arm_vectordata, $function
+#else
 	.type	arm_vectordata, %function
+#endif
 
 arm_vectordata:
 
@@ -466,7 +478,11 @@ arm_vectordata:
 
 	.globl	arm_prefetchabort
 	.globl	arm_vectorprefetch
+#ifdef __ghs__
+	.type	arm_vectorprefetch, $function
+#else
 	.type	arm_vectorprefetch, %function
+#endif
 
 arm_vectorprefetch:
 
@@ -549,7 +565,11 @@ arm_vectorprefetch:
 
 	.globl	arm_undefinedinsn
 	.globl	arm_vectorundefinsn
+#ifdef __ghs__
+	.type	arm_vectorundefinsn, $function
+#else
 	.type	arm_vectorundefinsn, %function
+#endif
 
 arm_vectorundefinsn:
 
@@ -631,7 +651,11 @@ arm_vectorundefinsn:
 	.globl	arm_decodefiq
 #endif
 	.globl	arm_vectorfiq
+#ifdef __ghs__
+	.type	arm_vectorfiq, $function
+#else
 	.type	arm_vectorfiq, %function
+#endif
 
 arm_vectorfiq:
 #ifdef CONFIG_ARCH_HIPRI_INTERRUPT
@@ -728,7 +752,12 @@ arm_vectorfiq:
  ****************************************************************************/
 
 	.globl	arm_vectoraddrexcptn
+#ifdef __ghs__
+	.type	arm_vectoraddrexcptn, $function
+#else
 	.type	arm_vectoraddrexcptn, %function
+#endif
+
 arm_vectoraddrexcptn:
 	b		arm_vectoraddrexcptn
 	.size	arm_vectoraddrexcptn, . - arm_vectoraddrexcptn
@@ -742,9 +771,17 @@ arm_vectoraddrexcptn:
 	.balign	8
 
 	.globl	g_intstackalloc
+#ifdef __ghs__
+	.type	g_intstackalloc, $object
+#else
 	.type	g_intstackalloc, object
+#endif
 	.globl	g_intstacktop
+#ifdef __ghs__
+	.type	g_intstacktop, $object
+#else
 	.type	g_intstacktop, object
+#endif
 
 g_intstackalloc:
 	.skip	((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
@@ -758,9 +795,17 @@ g_intstacktop:
 
 #ifdef CONFIG_ARCH_HIPRI_INTERRUPT
 	.globl	g_fiqstackalloc
+#ifdef __ghs__
+	.type	g_fiqstackalloc, $object
+#else
 	.type	g_fiqstackalloc, object
+#endif
 	.globl	g_fiqstacktop
+#ifdef __ghs__
+	.type	g_fiqstacktop, $object
+#else
 	.type	g_fiqstacktop, object
+#endif
 
 g_fiqstackalloc:
 	.skip	((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
diff --git a/arch/arm/src/common/gnu/arm_fetchadd.S b/arch/arm/src/common/gnu/arm_fetchadd.S
index 122923d6394..79eb592594f 100644
--- a/arch/arm/src/common/gnu/arm_fetchadd.S
+++ b/arch/arm/src/common/gnu/arm_fetchadd.S
@@ -53,7 +53,11 @@
  ****************************************************************************/
 
 	.globl	up_fetchadd32
+#ifdef __ghs__
+	.type	up_fetchadd32, $function
+#else
 	.type	up_fetchadd32, %function
+#endif
 
 up_fetchadd32:
 
@@ -87,7 +91,11 @@ up_fetchadd32:
  ****************************************************************************/
 
 	.globl	up_fetchsub32
+#ifdef __ghs__
+	.type	up_fetchsub32, $function
+#else
 	.type	up_fetchsub32, %function
+#endif
 
 up_fetchsub32:
 
@@ -121,7 +129,11 @@ up_fetchsub32:
  ****************************************************************************/
 
 	.globl	up_fetchadd16
+#ifdef __ghs__
+	.type	up_fetchadd16, $function
+#else
 	.type	up_fetchadd16, %function
+#endif
 
 up_fetchadd16:
 
@@ -155,7 +167,11 @@ up_fetchadd16:
  ****************************************************************************/
 
 	.globl	up_fetchsub16
+#ifdef __ghs__
+	.type	up_fetchsub16, $function
+#else
 	.type	up_fetchsub16, %function
+#endif
 
 up_fetchsub16:
 
@@ -191,7 +207,11 @@ up_fetchsub16:
  ****************************************************************************/
 
 	.globl	up_fetchadd8
+#ifdef __ghs__
+	.type	up_fetchadd8, $function
+#else
 	.type	up_fetchadd8, %function
+#endif
 
 up_fetchadd8:
 
@@ -225,7 +245,11 @@ up_fetchadd8:
  ****************************************************************************/
 
 	.globl	up_fetchsub8
+#ifdef __ghs__
+	.type	up_fetchsub8, $function
+#else
 	.type	up_fetchsub8, %function
+#endif
 
 up_fetchsub8: