You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/02 22:48:37 UTC
[GitHub] [incubator-nuttx] ptka opened a new pull request #5401: Initial support sim:nsh on M1 based hosts.
ptka opened a new pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401
## Summary
Configuration sim:nsh working on M1 base hosts:
login: admin
password:
User Logged-in!
NuttShell (NSH) NuttX-10.2.0
MOTD: username=admin password=Administrator
nsh> uname -a
NuttX 10.2.0 dcd4a88dde Feb 2 2022 23:40:55 sim sim
nsh> ps
PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND
0 0 0 FIFO Kthread N-- Ready 00000000 069584 Idle Task
1 1 224 FIFO Kthread --- Waiting Semaphore 00000000 067536 hpwork 0x1026f4718
2 2 100 FIFO Task --- Running 00000000 067552 nsh_main
nsh>
Next: Further sim configuration and testing with 'ostest'
## Impact
Hosts running on M1.
## Testing
MacBook Air 2020 running Monterey 12.2
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800146798
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
Ok, after review the related code again, the root cause is that up_create_stack/up_use_stack doesn't allocate/adjust the stack to start at 16 bytes boundary. This is common issue for both x64 and arm64, could you create a separated patch fix this issue? You can reference the similar arm code here:
https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/common/arm_createstack.c
https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/common/arm_usestack.c
https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/common/arm_stackframe.c
The subtraction in up_initial_state could be removed, just like other arch:
https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv8-m/arm_initialstate.c
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r801802211
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
Thnks for pinging ... I'm currently woking on the other open point "ostest/vfork" is not working yet. Once that point is, I will come back this point. Rason to switch is, that I can't guarentee, that there are no dependecies and thus I'm focussing on getting it completely working and than decide the best clean-up/refactor options. Hope, this makes sence.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#issuecomment-1035103882
Let me park this PR completely ... it's not working, they way it was intended ... I need to re-think.
Current major blocker is the dependency to homebrew based tools. A lot of part working w/o, but getting the modules compiled, there's a hard reference to homebrew based tools.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800065502
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
Not sure, if this is possible for all architectures and host OS versions. The gcc/binutils based versions seems to work different regarding fvisibility=hidden compared to clang based solution. At least on the MacOS host systems. Objcopy is used to hide the NuttX world from the HOST world avoiding calling wrong OS level functions. For my best knowledge all gcc/binutils based simulations needs to use objcopy.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802262594
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <arch/setjmp.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ stp x19, x20, [x0, JB_X19_X20]
+ stp x21, x22, [x0, JB_X21_X22]
+ stp x23, x24, [x0, JB_X23_X24]
+ stp x25, x26, [x0, JB_X25_X26]
+ stp x27, x28, [x0, JB_X27_X28]
+ stp x29, lr, [x0, JB_X29_XLR]
+ mov x1, sp /* STP can't access SP directly */
+ stp fp, x1, [x0, JB_XFP_XSP]
+ stp d8, d9, [x0, JB_D08_D09]
+ stp d10, d11, [x0, JB_D10_D11]
+ stp d12, d13, [x0, JB_D12_D13]
+ stp d14, d15, [x0, JB_D14_D15]
+
+ mov x0,#0 /* return value */
+ ret
+
+ .text
+ .globl SYMBOL(longjmp)
+ .align 4
Review comment:
align the code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804873369
##########
File path: arch/sim/include/setjmp.h
##########
@@ -111,7 +145,8 @@
#ifndef __ASSEMBLY__
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
Maybe, but "#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)" was already in the code. I'm not sure, if other simulations will break. I get remove it and let the CI check?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804837693
##########
File path: arch/sim/include/setjmp.h
##########
@@ -97,12 +101,42 @@
# define JB_FP JB_EBP
#elif defined(CONFIG_HOST_ARM)
+
# define XCPTCONTEXT_REGS 16
# define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
# define JB_FP 7
# define JB_SP 8
# define JB_PC 9
+
+#elif defined(CONFIG_HOST_ARM64)
+
+# define XCPTCONTEXT_REGS 32
+# define XCPTCONTEXT_SIZE (8 * XCPTCONTEXT_REGS)
+
+# ifdef __ASSEMBLY__
+
+# define JB_X19_X20 #0x00
Review comment:
align with others(e.g. line 115
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800105819
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
Objcopy is not needed on MacOS as the native compiler suite on MacOS honors fvisibilty=hidden differently. That's the reason why __attribute__ ((visibility("default"))) is needed in up_interruptcontext.c to get up_doirq() visible to the host part of the simulation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802408688
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,9 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
+
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
+# Native (clang based) compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ ifeq ($(CONFIG_HOST_ARM64),y)
Review comment:
No, MacOS/X86 uses the homebrew gcc/binutils. That's also how it's documented in "Getting Started". Removing the guard "ifeq ($(CONFIG_HOST_ARM64),y)" will break the CI build. We had the discussion last week already. Our view was, that it would make sense to get MacOS/ARM and MacOS/X86 simulation on the same baseline --> native compiler. What I can't forsee is the impact to the community, if the MacOS/X86 simulation is changed from homebrew gcc/binutils to native compiler suite. I mean, if it breaks the workflow of others, as they depend on current homebrew gcc/binutils solution. Any proposal how to progress here and get a good decision?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799668183
##########
File path: arch/sim/src/sim/up_interruptcontext.c
##########
@@ -51,6 +51,7 @@ bool up_interrupt_context(void)
* Name: up_doirq
****************************************************************************/
+__attribute__ ((visibility("default")))
Review comment:
Thanks for the detailed explanation, the need of visibility attribute is clear to me now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799068434
##########
File path: arch/sim/src/sim/up_interruptcontext.c
##########
@@ -51,6 +51,7 @@ bool up_interrupt_context(void)
* Name: up_doirq
****************************************************************************/
+__attribute__ ((visibility("default")))
Review comment:
I did some further tests on Linux ARM64 and MacOS AARCH64. Without the attribute up_doirq() is not found on MacOS AARCH64 while it's still found on Linux ARM64. In both cases it's compiled with 'fvisibility=hidden" and objdump on Linux ARM shows, that up_doirq in marked ".hidden". On MacOS objdump doesn't provide this information. My current conclusion is, that it should not link on Linux ARM64, too. But in reality it does.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r798247667
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
It's currently saving, FP, SP and LR. I agree, that it sounds not enough ... but it's initially working.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r798932703
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
Can vfork test in ostest run without issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r808311307
##########
File path: arch/sim/include/limits.h
##########
@@ -54,7 +54,8 @@
/* These change on 32-bit and 64-bit platforms */
-#if !defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32)
+#if (!defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32)) && \
+ !defined(CONFIG_HOST_ARM64)
Review comment:
done
##########
File path: arch/sim/include/limits.h
##########
@@ -71,7 +72,8 @@
/* A pointer is 4 or 8 bytes */
#define PTR_MIN (-PTR_MAX - 1)
-#if !defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32)
+#if (!defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32)) && \
Review comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802166818
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
With latest update octets/vfork() is working:
End of test memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 6 9
mxordblk 3e02610 3db2cd0
uordblks 1ebe10 24ccd0
fordblks 3e13ff0 3db3130
user_main: vfork() test
vfork_test: Child 125 ran successfully
Final memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 2 7
mxordblk 3e389f0 3e04650
uordblks 1c73d0 1e9c10
fordblks 3e38a30 3e161f0
user_main: Exiting
ostest_main: Exiting with status 0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802263127
##########
File path: arch/sim/include/setjmp.h
##########
@@ -97,12 +101,42 @@
# define JB_FP JB_EBP
#elif defined(CONFIG_HOST_ARM)
+
# define XCPTCONTEXT_REGS 16
# define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
# define JB_FP 7
# define JB_SP 8
# define JB_PC 9
+
+#elif defined(CONFIG_HOST_ARM64)
+
+# define XCPTCONTEXT_REGS 32
+# define XCPTCONTEXT_SIZE (8 * XCPTCONTEXT_REGS)
+
+# ifdef __ASSEMBLY__
+
+# define JB_X19_X20 #0x00
+# define JB_X21_X22 #0x10
+# define JB_X23_X24 #0x20
+# define JB_X25_X26 #0x30
+# define JB_X27_X28 #0x40
+# define JB_X29_XLR #0x50
+# define JB_XFP_XSP #0x60
+
+# define JB_D08_D09 #0x70
+# define JB_D10_D11 #0x80
+# define JB_D12_D13 #0x90
+# define JB_D14_D15 #0xA0
+
Review comment:
move the define to assemble file?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r803200630
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,9 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
+
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
+# Native (clang based) compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ ifeq ($(CONFIG_HOST_ARM64),y)
Review comment:
I created separate PR to enable clang based native compiler on MacOS for X86_64/ARM64:
https://github.com/apache/incubator-nuttx/pull/5452
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802262383
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,9 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
+
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
+# Native (clang based) compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ ifeq ($(CONFIG_HOST_ARM64),y)
Review comment:
we can remove this check?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799848933
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
Got it ... honestly spoken ... I don't know. The subtract was part of the code already. Directly in front of the code, there's a comment, explaining the reason. I took this for granted and adapted it to the ARM64 requirements as the simulation was throwing an exception without it.
/* Note: The amd64 ABI requires 16-bytes alignment _before_ a function
* call.
* On the other hand, our way to set up and switch to a new context
* is basically a JUMP.
* Thus, we need to emulate the effect of a CALL here, by subtracting
* sizeof(xcpt_reg_t), which is the amount a CALL would move RSP to store
* the return address.
*/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800158681
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
I get your point, but I'm not sure, if that will work. Current Linux based simulation compiles with '-fvisibilty=hidden' in the same way as MacOS. I didn't changed anything. But as Linux gcc/binutils doesn't honor that flag in the same way as MacOC/clang based solutions does, the hack is needed to prevent wrong linking. I fully agree, that the construct overall is quite ugly and we can invest to fix this in a better way in a different PR. To get there, the first step would be, that the Linux simulation needs fail on linking, if point 3 and 4 of your list are applied. That's current.y the fact for MacOS/clang. Having this, point 2 can be applied to fix it. Point 1 is already current situation in the Linux/MacOS simulation. What I currently don't know, is the impact to the other host systems ... further changes could be needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r805000897
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -84,10 +97,10 @@ void up_initial_state(struct tcb_s *tcb)
* the return address.
*/
- tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
- tcb->adj_stack_size -
- sizeof(xcpt_reg_t);
+ tcb->xcp.regs[JB_SP] = (xcpt_reg_t)
+ STACK_ALIGN_DOWN((long)tcb->stack_base_ptr + tcb->adj_stack_size - 1);
Review comment:
I reviewed code again and the subtraction cannot be removed. There is a specific reason for it (not related to any aligment issue) on the amd64 architecture:
/* Note: The amd64 ABI requires 16-bytes alignment _before_ a function
* call.
* On the other hand, our way to set up and switch to a new context
* is basically a JUMP.
* Thus, we need to emulate the effect of a CALL here, by subtracting
* sizeof(xcpt_reg_t), which is the amount a CALL would move RSP to store
* the return address.
*/
The subtraction simulates how a CALL would change the stack.
On the ARM64 architecture the return address is not stored on the stack, but in LR register. There's no need for the subtraction on the ARM64 architecture as the stack is unchanged.
I changed the code in a way, that the subtraction is only effective on none ARM64 architectures and added a note.
* Note: On ARM64 architectures the return address is passed via LR
* register. No extra adjustment for the stack needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804985842
##########
File path: arch/sim/src/sim/up_copyfullstate.c
##########
@@ -41,7 +41,8 @@
*
****************************************************************************/
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
Not working on Linux(sim-02):
In file included from sim/up_unblocktask.c:35:
sim/up_unblocktask.c: In function 'up_unblock_task':
Error: sim/up_unblocktask.c:92:33: error: passing argument 1 of 'up_copyfullstate' from incompatible pointer type [-Werror=incompatible-pointer-types]
92 | up_savestate(rtcb->xcp.regs);
| ~~~~~~~~~^~~~~
| |
| xcpt_reg_t * {aka unsigned int *}
sim/up_internal.h:66:45: note: in definition of macro 'up_savestate'
66 | #define up_savestate(regs) up_copyfullstate(regs, (xcpt_reg_t *)CURRENT_REGS)
| ^~~~
sim/up_internal.h:128:38: note: expected 'long unsigned int *' but argument is of type 'xcpt_reg_t *' {aka 'unsigned int *'}
128 | void up_copyfullstate(unsigned long *dest, unsigned long *src);
| ~~~~~~~~~~~~~~~^~~~
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804839699
##########
File path: arch/sim/src/sim/up_internal.h
##########
@@ -125,7 +125,8 @@ extern char **g_argv;
/* Context switching */
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
void up_copyfullstate(unsigned long *dest, unsigned long *src);
Review comment:
could handle all case by:
void up_copyfullstate(unsigned long *dest, unsigned long *src);
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r805203870
##########
File path: arch/sim/include/setjmp.h
##########
@@ -111,7 +145,8 @@
#ifndef __ASSEMBLY__
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
Okay ... let's wait until that PR is integrated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r807420665
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -84,10 +97,10 @@ void up_initial_state(struct tcb_s *tcb)
* the return address.
*/
- tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
- tcb->adj_stack_size -
- sizeof(xcpt_reg_t);
+ tcb->xcp.regs[JB_SP] = (xcpt_reg_t)
+ STACK_ALIGN_DOWN((long)tcb->stack_base_ptr + tcb->adj_stack_size - 1);
Review comment:
I tested https://github.com/apache/incubator-nuttx/pull/5507 in combination with this test on MacBook Air M1 2020 running Monterey 12.2.1. Executed test: sim:nsh with additional ostest configured. Result: complete ostest passed w/o error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802297942
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
Definitely … I thought, I did it … I‘ll do it soon.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802314706
##########
File path: arch/sim/include/setjmp.h
##########
@@ -97,12 +101,42 @@
# define JB_FP JB_EBP
#elif defined(CONFIG_HOST_ARM)
+
# define XCPTCONTEXT_REGS 16
# define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
# define JB_FP 7
# define JB_SP 8
# define JB_PC 9
+
+#elif defined(CONFIG_HOST_ARM64)
+
+# define XCPTCONTEXT_REGS 32
+# define XCPTCONTEXT_SIZE (8 * XCPTCONTEXT_REGS)
+
+# ifdef __ASSEMBLY__
+
+# define JB_X19_X20 #0x00
+# define JB_X21_X22 #0x10
+# define JB_X23_X24 #0x20
+# define JB_X25_X26 #0x30
+# define JB_X27_X28 #0x40
+# define JB_X29_XLR #0x50
+# define JB_XFP_XSP #0x60
+
+# define JB_D08_D09 #0x70
+# define JB_D10_D11 #0x80
+# define JB_D12_D13 #0x90
+# define JB_D14_D15 #0xA0
+
Review comment:
I get your point, but as these values needs to be aligned with JB_PC, JB_FP and JB_SP they are kept in one file. This is the same as for X86 definitions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802313181
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <arch/setjmp.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ stp x19, x20, [x0, JB_X19_X20]
+ stp x21, x22, [x0, JB_X21_X22]
+ stp x23, x24, [x0, JB_X23_X24]
+ stp x25, x26, [x0, JB_X25_X26]
+ stp x27, x28, [x0, JB_X27_X28]
+ stp x29, lr, [x0, JB_X29_XLR]
+ mov x1, sp /* STP can't access SP directly */
+ stp fp, x1, [x0, JB_XFP_XSP]
+ stp d8, d9, [x0, JB_D08_D09]
+ stp d10, d11, [x0, JB_D10_D11]
+ stp d12, d13, [x0, JB_D12_D13]
+ stp d14, d15, [x0, JB_D14_D15]
+
+ mov x0,#0 /* return value */
+ ret
+
+ .text
+ .globl SYMBOL(longjmp)
+ .align 4
Review comment:
Okay ... will come with next update.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804884011
##########
File path: arch/sim/include/setjmp.h
##########
@@ -111,7 +145,8 @@
#ifndef __ASSEMBLY__
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
I removed it.
##########
File path: arch/sim/src/sim/up_internal.h
##########
@@ -125,7 +125,8 @@ extern char **g_argv;
/* Context switching */
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
void up_copyfullstate(unsigned long *dest, unsigned long *src);
Review comment:
done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804969595
##########
File path: arch/sim/include/setjmp.h
##########
@@ -111,7 +145,8 @@
#ifndef __ASSEMBLY__
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
"ypedef unsigned long xcpt_reg_t" is not enough. Linux(sim-02) breaks:
In file included from sim/up_vfork.c:32:
sim/up_vfork.c: In function 'up_vfork':
Error: sim/up_vfork.c:96:9: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'xcpt_reg_t' {aka 'const long unsigned int'} [-Werror=format=]
96 | sinfo(" frame pointer:%08" PRIxPTR " sp:%08" PRIxPTR " pc:%08" PRIxPTR ""
| ^~~~~~~~~~~~~~~~~~~~~
97 | "\n", context[JB_FP], context[JB_SP], context[JB_PC]);
| ~~~~~~~~~~~~~~
| |
| xcpt_reg_t {aka const long unsigned int}
In file included from /github/workspace/sources/nuttx/include/stdint.h:35,
from /github/workspace/sources/nuttx/include/sys/types.h:32,
from /github/workspace/sources/nuttx/include/stddef.h:28,
from /github/workspace/sources/nuttx/include/inttypes.h:28,
from sim/up_vfork.c:27:
/github/workspace/sources/nuttx/include/arch/inttypes.h:125:24: note: format string is defined here
125 | # define PRIxPTR "x"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804884011
##########
File path: arch/sim/include/setjmp.h
##########
@@ -111,7 +145,8 @@
#ifndef __ASSEMBLY__
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
I removed it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800069496
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
Both, setjmp/longjmp should handle the alignment and subtract correctly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r798270367
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
That's not the same. On MACOS/ARM64 objcopy is not available and the call in arch/sim/src/Makefile is breaking. There are two potential solutions (except installing extra software on the host): Guard the call in arch/sim/src/Makefile or defining OBJCOPY as and empty call. The later one is currently used defining "OBJCOPY = :" in MACOS/ARM64. ':' is as empty call in bash/zsh shells.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799410983
##########
File path: arch/sim/src/sim/up_interruptcontext.c
##########
@@ -51,6 +51,7 @@ bool up_interrupt_context(void)
* Name: up_doirq
****************************************************************************/
+__attribute__ ((visibility("default")))
Review comment:
In fact up_doirq() is also called from up_handle_irq() in up_hostirq.c, too. Removing the attribute, results in the following link error:
LD: nuttx
Undefined symbols for architecture arm64:
"_up_doirq", referenced from:
_up_handle_irq in up_hostirq.o
ld: symbol(s) not found for architecture arm64
The linker is invoked:
"cc" -g -fomit-frame-pointer -L board -o /Users/piet/Projects/NuttX/feature-sim-m1-support/nuttx/nuttx nuttx.rel up_hostirq.o up_hostmemory.o up_hosttime.o up_simuart.o up_hostmisc.o -lpthread -lz
The missing symbol up_doirq() is part of nuttx.rel object file, which is build with the following command:
ld -r -L"/Users/piet/Projects/NuttX/feature-sim-m1-support/nuttx/staging" -L board -o nuttx.rel up_head.o -lsched -ldrivers -lboards -lc -lmm -larch -lapps -lfs -lbinfmt -lboard
This partially linking step hides up_doirq() for the final link step as the original cc call used '-fvisibility=hidden' for all compilations. And this seems be different on none MacOS based host system.
I would be glad, if there's a better solution w/o the attribute in the source code itself.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r798200644
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
does the code save enough register?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r808195481
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,90 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <arch/setjmp.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ stp x19, x20, [x0, JB_X19_X20]
+ stp x21, x22, [x0, JB_X21_X22]
+ stp x23, x24, [x0, JB_X23_X24]
+ stp x25, x26, [x0, JB_X25_X26]
+ stp x27, x28, [x0, JB_X27_X28]
+ stp x29, lr, [x0, JB_X29_XLR]
+ mov x1, sp /* STP can't access SP */
+ stp fp, x1, [x0, JB_XFP_XSP]
+ stp d8, d9, [x0, JB_D08_D09]
+ stp d10, d11, [x0, JB_D10_D11]
+ stp d12, d13, [x0, JB_D12_D13]
+ stp d14, d15, [x0, JB_D14_D15]
+
+ mov x0,#0 /* return value */
+ ret
+
+ .text
+ .globl SYMBOL(longjmp)
+ .align 4
+
+SYMBOL(longjmp):
+
+ ldp x19, x20, [x0, JB_X19_X20]
+ ldp x21, x22, [x0, JB_X21_X22]
+ ldp x23, x24, [x0, JB_X23_X24]
+ ldp x25, x26, [x0, JB_X25_X26]
+ ldp x27, x28, [x0, JB_X27_X28]
+ ldp x29, lr, [x0, JB_X29_XLR]
+ ldp fp, x2, [x0, JB_XFP_XSP]
+ ldp d8, d9, [x0, JB_D08_D09]
+ ldp d10, d11, [x0, JB_D10_D11]
+ ldp d12, d13, [x0, JB_D12_D13]
+ ldp d14, d15, [x0, JB_D14_D15]
+ mov sp, x2 /* LDP can't access SP */
+
+ mov x0, x1
+ cmp x0, #0
+ b.ne 1f /* return 1, if val is 0 */
+
+ mov x0,#1 /* return value */
+1: ret
Review comment:
done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804839314
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -84,10 +97,10 @@ void up_initial_state(struct tcb_s *tcb)
* the return address.
*/
- tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
- tcb->adj_stack_size -
- sizeof(xcpt_reg_t);
+ tcb->xcp.regs[JB_SP] = (xcpt_reg_t)
+ STACK_ALIGN_DOWN((long)tcb->stack_base_ptr + tcb->adj_stack_size - 1);
Review comment:
let's fix alignment issue first before merge this patch?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804838626
##########
File path: arch/sim/include/setjmp.h
##########
@@ -111,7 +145,8 @@
#ifndef __ASSEMBLY__
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
typedef unsigned long xcpt_reg_t should work in all case
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r798931742
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
So, x64 MAC has objcopy/objdump by default?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799350977
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
Seems not ... current build breaks exactly there. Within the CI you're installaing gcc/objopy via brew. My solution is targetting to use the native compiler suite and not installing anything via brew for the simuation. This way the simulation would be easier to use for new community members, who wants to join. Just downloading the code is good enough to work on NuttX with the simlation. I know, this could be a philosophic discussion as the CI solution is harmonizing the simulation builds across the host architectures. Anyway, the guard "ifeq ($(CONFIG_HOST_ARM64),y)" is needed for the memoment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799350977
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
Seems not ... current build breaks exactly there. Within the CI you're installaing gcc/objopy via brew. My solution is targetting to use the native compiler suite and not installing anything via brew for the simuation. This way the simulation would be easier to use for new community who wants to join. Just downloading the code is good enough work on NuttX with the simlation. I know, this could be philosophic discussion as the CI solution is harmonizing the simulation build across the host architectures. Anyway, the guard "ifeq ($(CONFIG_HOST_ARM64),y)" is needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799268074
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
So, check CONFIG_HOST_MACOS is enough?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r798934748
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
Do you know why we need allocate 8/16 bytes here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799401315
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
From the PDF:
Pass Arguments to Functions Correctly
The **stack pointer on Apple platforms follows the ARM64 standard ABI and requires 16-byte alignment**.
That's why 2*sizeof(xcpt_reg_t) as sizeof(xcpt_reg_t) is 8 bytes only.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802166818
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
With latest update octets/vfork() is working:
End of test memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 6 9
mxordblk 3e02610 3db2cd0
uordblks 1ebe10 24ccd0
fordblks 3e13ff0 3db3130
user_main: vfork() test
vfork_test: Child 125 ran successfully
Final memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 2 7
mxordblk 3e389f0 3e04650
uordblks 1c73d0 1e9c10
fordblks 3e38a30 3e161f0
user_main: Exiting
ostest_main: Exiting with status 0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] acassis commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
acassis commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r801584218
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
ping @ptka
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802262474
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
Review comment:
change to apache copyright
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r808141077
##########
File path: arch/sim/include/limits.h
##########
@@ -54,7 +54,8 @@
/* These change on 32-bit and 64-bit platforms */
-#if !defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32)
+#if (!defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32)) && \
+ !defined(CONFIG_HOST_ARM64)
Review comment:
let's use the positive logic like line 107:
```
#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
defined(CONFIG_HOST_ARM64)
```
##########
File path: arch/sim/include/limits.h
##########
@@ -71,7 +72,8 @@
/* A pointer is 4 or 8 bytes */
#define PTR_MIN (-PTR_MAX - 1)
-#if !defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32)
+#if (!defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32)) && \
Review comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka removed a comment on pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka removed a comment on pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#issuecomment-1035103882
Let me park this PR completely ... it's not working, they way it was intended ... I need to re-think.
Current major blocker is the dependency to homebrew based tools. A lot of part working w/o, but getting the modules compiled, there's a hard reference to homebrew based tools.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802289682
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
Let's merge the two patch into one.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r807272886
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -84,10 +97,10 @@ void up_initial_state(struct tcb_s *tcb)
* the return address.
*/
- tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
- tcb->adj_stack_size -
- sizeof(xcpt_reg_t);
+ tcb->xcp.regs[JB_SP] = (xcpt_reg_t)
+ STACK_ALIGN_DOWN((long)tcb->stack_base_ptr + tcb->adj_stack_size - 1);
Review comment:
> ```
> /* Note: The amd64 ABI requires 16-bytes alignment _before_ a function
> * call.
> * On the other hand, our way to set up and switch to a new context
> * is basically a JUMP.
> * Thus, we need to emulate the effect of a CALL here, by subtracting
> * sizeof(xcpt_reg_t), which is the amount a CALL would move RSP to store
> * the return address.
But the thread never return to the bottom of the stack, I don't believe that it's so critical whether we subtract or not 8bytes.
@ptka and @yamt could you try this PR:
https://github.com/apache/incubator-nuttx/pull/5507.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r798260723
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
That's not possible. The issues is exactly this place. tcb->stack_base_ptr and tcb->adj_stack_size are correctly 16 byte aligned. But this code allocates a single 64bit, resulting in tcb->xcp.regs[JB_SP] gets 8byte aligned.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799212328
##########
File path: arch/sim/src/sim/up_interruptcontext.c
##########
@@ -51,6 +51,7 @@ bool up_interrupt_context(void)
* Name: up_doirq
****************************************************************************/
+__attribute__ ((visibility("default")))
Review comment:
Using an x86_64 based Macbook, sim:nsh is not working, too. It fails linking at the same two functions: up_doirq() / main(). This nails the issue down to be most likely an clang related issue regardless of host CPU architecture. Are there any simulations known to work using clang based compiler suite?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799269479
##########
File path: arch/sim/src/sim/up_hostmemory.c
##########
@@ -63,8 +63,14 @@ void *host_alloc_heap(size_t sz)
{
void *p;
+#if defined(CONFIG_HOST_MACOS) && defined(CONFIG_HOST_ARM64)
+ p = mmap(NULL, sz, PROT_READ | PROT_WRITE,
Review comment:
macos don't allow we mmap the memory with execute permission?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804982488
##########
File path: arch/sim/src/sim/up_internal.h
##########
@@ -125,7 +125,8 @@ extern char **g_argv;
/* Context switching */
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
void up_copyfullstate(unsigned long *dest, unsigned long *src);
Review comment:
Not working on Linux(sim-02):
In file included from sim/up_unblocktask.c:35:
sim/up_unblocktask.c: In function 'up_unblock_task':
Error: sim/up_unblocktask.c:92:33: error: passing argument 1 of 'up_copyfullstate' from incompatible pointer type [-Werror=incompatible-pointer-types]
92 | up_savestate(rtcb->xcp.regs);
| ~~~~~~~~~^~~~~
| |
| xcpt_reg_t * {aka unsigned int *}
sim/up_internal.h:66:45: note: in definition of macro 'up_savestate'
66 | #define up_savestate(regs) up_copyfullstate(regs, (xcpt_reg_t *)CURRENT_REGS)
| ^~~~
sim/up_internal.h:128:38: note: expected 'long unsigned int *' but argument is of type 'xcpt_reg_t *' {aka 'unsigned int *'}
128 | void up_copyfullstate(unsigned long *dest, unsigned long *src);
| ~~~~~~~~~~~~~~~^~~~
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800147042
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
BTW, maybe you can create a new PR to fix this issue separately since it isn't related to M1 but the difference between Linux and macOS.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800158681
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
I get your point, but I'm not sure, if that will work. Current Linux based simulation compiles with '-fvisibilty=hidden' in the same way as MacOS. I didn't changed anything. But as Linux gcc/binutils doesn't honor that flag is the same way as MacOC clang based solutions does, the hack is needed to prevent wrong linking. I fully agree, that the construct overall is quite ugly and we can invest to fix this in a better way in a different PR. To get there, the first step would be, that the Linux simulation needs fail on linking, if point 3 and 4 of your list are applied. That's there fact for MacOS/clang. Having this, point 2 can be applied to fix it. Point 1 is already current situation in the Linux/MacOS simulation. What I currently don't know, is the impact to the other host systems ... further changes could be needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799438583
##########
File path: arch/sim/src/sim/up_hostmemory.c
##########
@@ -63,8 +63,14 @@ void *host_alloc_heap(size_t sz)
{
void *p;
+#if defined(CONFIG_HOST_MACOS) && defined(CONFIG_HOST_ARM64)
+ p = mmap(NULL, sz, PROT_READ | PROT_WRITE,
Review comment:
That's a known issue reported in MacOS 11.2 on M1 silicon.
See following discussion: https://developer.apple.com/forums/thread/672804
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799644717
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
Yes, x86/x84 version pass all validation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799741552
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
It's better to align X86 and M1 CI setup on the same page, either gcc or clang is fine to me.
BTW, objcopy is useless on sim, because we can't use binary directly instead of elf. So, you can create a new patch to drop all objcopy reference from sim specific directories.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799635974
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
Yes, I know the alignment requirement, but I don't understand why we need subtract.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799848933
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
Got it ... honestly spoken ... I don't. The subtract was part of the code already. Directly in front of the code, there's a comment, explaining the reason. I took this for granted and adapted it to the ARM64 requirements as the simulation was throwing an exception without it.
/* Note: The amd64 ABI requires 16-bytes alignment _before_ a function
* call.
* On the other hand, our way to set up and switch to a new context
* is basically a JUMP.
* Thus, we need to emulate the effect of a CALL here, by subtracting
* sizeof(xcpt_reg_t), which is the amount a CALL would move RSP to store
* the return address.
*/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799741552
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
It's better to align X86 and M1 CI setup on the same page, either gcc or clang is fine to me.
BTW, objcopy is useless on sim, because we can't use binary directly instead of elf. So, you can create a new patch to drop all objcopy reference from sim specifical directory.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804969595
##########
File path: arch/sim/include/setjmp.h
##########
@@ -111,7 +145,8 @@
#ifndef __ASSEMBLY__
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
"typedef unsigned long xcpt_reg_t" is not enough. Linux(sim-02) breaks:
In file included from sim/up_vfork.c:32:
sim/up_vfork.c: In function 'up_vfork':
Error: sim/up_vfork.c:96:9: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'xcpt_reg_t' {aka 'const long unsigned int'} [-Werror=format=]
96 | sinfo(" frame pointer:%08" PRIxPTR " sp:%08" PRIxPTR " pc:%08" PRIxPTR ""
| ^~~~~~~~~~~~~~~~~~~~~
97 | "\n", context[JB_FP], context[JB_SP], context[JB_PC]);
| ~~~~~~~~~~~~~~
| |
| xcpt_reg_t {aka const long unsigned int}
In file included from /github/workspace/sources/nuttx/include/stdint.h:35,
from /github/workspace/sources/nuttx/include/sys/types.h:32,
from /github/workspace/sources/nuttx/include/stddef.h:28,
from /github/workspace/sources/nuttx/include/inttypes.h:28,
from sim/up_vfork.c:27:
/github/workspace/sources/nuttx/include/arch/inttypes.h:125:24: note: format string is defined here
125 | # define PRIxPTR "x"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802442792
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,9 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
+
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
+# Native (clang based) compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ ifeq ($(CONFIG_HOST_ARM64),y)
Review comment:
@yamt what your opinion to use native compiler for macOS/x84 by default to simplify the setup? I know user still need gcc to try NuttX ELF feature, but clang is enough for most user case.
If you don't object the change, I would suggest to unify the macOS experience for both x64 and arm64, and simplify the setup process by update CI and documentation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r808143062
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,90 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <arch/setjmp.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ stp x19, x20, [x0, JB_X19_X20]
+ stp x21, x22, [x0, JB_X21_X22]
+ stp x23, x24, [x0, JB_X23_X24]
+ stp x25, x26, [x0, JB_X25_X26]
+ stp x27, x28, [x0, JB_X27_X28]
+ stp x29, lr, [x0, JB_X29_XLR]
+ mov x1, sp /* STP can't access SP */
+ stp fp, x1, [x0, JB_XFP_XSP]
+ stp d8, d9, [x0, JB_D08_D09]
+ stp d10, d11, [x0, JB_D10_D11]
+ stp d12, d13, [x0, JB_D12_D13]
+ stp d14, d15, [x0, JB_D14_D15]
+
+ mov x0,#0 /* return value */
+ ret
+
+ .text
+ .globl SYMBOL(longjmp)
+ .align 4
+
+SYMBOL(longjmp):
+
+ ldp x19, x20, [x0, JB_X19_X20]
+ ldp x21, x22, [x0, JB_X21_X22]
+ ldp x23, x24, [x0, JB_X23_X24]
+ ldp x25, x26, [x0, JB_X25_X26]
+ ldp x27, x28, [x0, JB_X27_X28]
+ ldp x29, lr, [x0, JB_X29_XLR]
+ ldp fp, x2, [x0, JB_XFP_XSP]
+ ldp d8, d9, [x0, JB_D08_D09]
+ ldp d10, d11, [x0, JB_D10_D11]
+ ldp d12, d13, [x0, JB_D12_D13]
+ ldp d14, d15, [x0, JB_D14_D15]
+ mov sp, x2 /* LDP can't access SP */
+
+ mov x0, x1
+ cmp x0, #0
+ b.ne 1f /* return 1, if val is 0 */
+
+ mov x0,#1 /* return value */
+1: ret
Review comment:
move ret to the next line
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r808144096
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -84,10 +97,10 @@ void up_initial_state(struct tcb_s *tcb)
* the return address.
*/
- tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
- tcb->adj_stack_size -
- sizeof(xcpt_reg_t);
+ tcb->xcp.regs[JB_SP] = (xcpt_reg_t)
+ STACK_ALIGN_DOWN((long)tcb->stack_base_ptr + tcb->adj_stack_size - 1);
Review comment:
Let's continue the discussion in #5507
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r803200630
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,9 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
+
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
+# Native (clang based) compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ ifeq ($(CONFIG_HOST_ARM64),y)
Review comment:
I created separate PR to enable clang based native compiler on MacOS for X86_64/ARM64: https://github.com/apache/incubator-nuttx/pull/5452
Once that PR is integrated, this PR for the M1 support needs some rework.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#issuecomment-1037471467
@ptka it's better that you could fix the stack alignment issue first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#issuecomment-1035103566
Let me park this PR completely ... it's not working, they way it was intended ... I need to re-think.
Current major blocker is the dependency to homebrew based tools. A lot of part working w/o, but getting the modules compiled, there's a hard reference to homebrew based tools.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802166818
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
With latest update ostets/vfork() is working:
End of test memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 6 9
mxordblk 3e02610 3db2cd0
uordblks 1ebe10 24ccd0
fordblks 3e13ff0 3db3130
user_main: vfork() test
vfork_test: Child 125 ran successfully
Final memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 2 7
mxordblk 3e389f0 3e04650
uordblks 1c73d0 1e9c10
fordblks 3e38a30 3e161f0
user_main: Exiting
ostest_main: Exiting with status 0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802166818
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
With latest update ostest/vfork() is working:
End of test memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 6 9
mxordblk 3e02610 3db2cd0
uordblks 1ebe10 24ccd0
fordblks 3e13ff0 3db3130
user_main: vfork() test
vfork_test: Child 125 ran successfully
Final memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 2 7
mxordblk 3e389f0 3e04650
uordblks 1c73d0 1e9c10
fordblks 3e38a30 3e161f0
user_main: Exiting
ostest_main: Exiting with status 0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#issuecomment-1037471467
@ptka it's better that you could fix the stack alignment issue first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799214199
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
No, my x86_64 based Macbook running Big Sur also doesn't have objcopy while opjdump is available. This seems to be a clang based issue as both are using clang based host compiler suites. Updated this location.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799410983
##########
File path: arch/sim/src/sim/up_interruptcontext.c
##########
@@ -51,6 +51,7 @@ bool up_interrupt_context(void)
* Name: up_doirq
****************************************************************************/
+__attribute__ ((visibility("default")))
Review comment:
In fact up_doirq() is also called from up_handle_irq() in up_hostirq.c, too. Removing the attribute, results in the following link error:
LD: nuttx
Undefined symbols for architecture arm64:
"_up_doirq", referenced from:
_up_handle_irq in up_hostirq.o
ld: symbol(s) not found for architecture arm64
The linker is invoked:
"cc" -g -fomit-frame-pointer -L board -o /Users/piet/Projects/NuttX/feature-sim-m1-support/nuttx/nuttx nuttx.rel up_hostirq.o up_hostmemory.o up_hosttime.o up_simuart.o up_hostmisc.o -lpthread -lz
The missing symbol up_doirq() is part of nuttx.rel object file, which is build with the following command:
ld -r -L"/Users/piet/Projects/NuttX/feature-sim-m1-support/nuttx/staging" -L board -o nuttx.rel up_head.o -lsched -ldrivers -lboards -lc -lmm -larch -lapps -lfs -lbinfmt -lboard
This partially linking steps hides up_doirq() for the final link step. And this seems be different on none MacOS based host system.
I would be glad, if there's a better solution w/o the attribute in the source code itself.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800065729
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
With current implementation vfork/ostest is not working. It’s not crashing, but it‘s also not passing. Further investigation is needed. I will update PR as it‘s done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802243788
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
Nice
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799438583
##########
File path: arch/sim/src/sim/up_hostmemory.c
##########
@@ -63,8 +63,14 @@ void *host_alloc_heap(size_t sz)
{
void *p;
+#if defined(CONFIG_HOST_MACOS) && defined(CONFIG_HOST_ARM64)
+ p = mmap(NULL, sz, PROT_READ | PROT_WRITE,
Review comment:
That's a known issue reported in MacOS 11.2 on M1 silicon.
See following discussion: https://developer.apple.com/forums/thread/672804
I will add the reference with the next update.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800038210
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
From the description, I think setjmp/longjmp is the better place to fix this issue. Could you try to fix this issue there instead?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802408688
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,9 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
+
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
+# Native (clang based) compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ ifeq ($(CONFIG_HOST_ARM64),y)
Review comment:
No, MacOS/X86 uses the homebrew gcc/binutils. That's also how it's documented in "Getting Started". Removing the guard "ifeq ($(CONFIG_HOST_ARM64),y)" will break the CI build. We had the discussion last week already. Or view was, that it would make sense to get MacOS/ARM and MacOS/X86 simulation on the same baseline --> preferred the native compiler. What I can't forsee is the impact to the community, if the MacOS/X86 simulation is changed from homebrew gcc/binutils to native compiler suite. I mean, if it breaks the workflow of others as they depend on current homebrew gcc/binutils solutions. Any proposal how to progress here and get a good decision?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799445961
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
Not yet done ... is ostest overall a good validation, that simulation is fully working?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800064669
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
Overall subtract or just the alignment for ARM64?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802312810
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,9 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
+
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
+# Native (clang based) compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ ifeq ($(CONFIG_HOST_ARM64),y)
Review comment:
No, as objcopy is not available on MacOS using native compiler. M1/ARM64 support is based on native compiler.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r805203341
##########
File path: arch/sim/include/setjmp.h
##########
@@ -111,7 +145,8 @@
#ifndef __ASSEMBLY__
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
The code need adjust too, please see #5473
##########
File path: arch/sim/src/sim/up_internal.h
##########
@@ -125,7 +125,8 @@ extern char **g_argv;
/* Context switching */
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
void up_copyfullstate(unsigned long *dest, unsigned long *src);
Review comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka closed pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka closed pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r798203028
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
```suggestion
ifneq ($(CONFIG_HOST_MACOS),y)
OBJCOPY ?= $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
endif
```
##########
File path: arch/sim/src/sim/up_interruptcontext.c
##########
@@ -51,6 +51,7 @@ bool up_interrupt_context(void)
* Name: up_doirq
****************************************************************************/
+__attribute__ ((visibility("default")))
Review comment:
why need
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
let's correct the alignment in first place instead(up_create_stack/up_use_stack/up_stack_frame).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799265935
##########
File path: arch/sim/src/sim/up_interruptcontext.c
##########
@@ -51,6 +51,7 @@ bool up_interrupt_context(void)
* Name: up_doirq
****************************************************************************/
+__attribute__ ((visibility("default")))
Review comment:
do_irq is used by nuttx elf self, not to other so, it's strange that visibility could impact the linking of do_irq.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799268591
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
Look like the link doesn't answer my question: why we need sub sizeof(xcpt_reg_t) or 2 * sizeof(xcpt_reg_t) from sp.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r798253226
##########
File path: arch/sim/src/sim/up_interruptcontext.c
##########
@@ -51,6 +51,7 @@ bool up_interrupt_context(void)
* Name: up_doirq
****************************************************************************/
+__attribute__ ((visibility("default")))
Review comment:
Otherwise native linker was not able to find up_doirq() in final link step. There's another place in up_head() for main(). It's overwriting fvisibility=hidden flag. Not sure, if there's a better solution possible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r798929816
##########
File path: arch/sim/src/sim/up_interruptcontext.c
##########
@@ -51,6 +51,7 @@ bool up_interrupt_context(void)
* Name: up_doirq
****************************************************************************/
+__attribute__ ((visibility("default")))
Review comment:
Ok.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r798280047
##########
File path: arch/sim/src/sim/up_interruptcontext.c
##########
@@ -51,6 +51,7 @@ bool up_interrupt_context(void)
* Name: up_doirq
****************************************************************************/
+__attribute__ ((visibility("default")))
Review comment:
Let me check, if there's a better solution possible w/o adding this to the code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800146119
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
The change look like much better than before, but I still have the same question: if up_create_stack/up_use_stack/up_stack_frame already ensure the alignment correctly, why we need align again in up_initial_state?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802262818
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <arch/setjmp.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ stp x19, x20, [x0, JB_X19_X20]
+ stp x21, x22, [x0, JB_X21_X22]
+ stp x23, x24, [x0, JB_X23_X24]
+ stp x25, x26, [x0, JB_X25_X26]
+ stp x27, x28, [x0, JB_X27_X28]
+ stp x29, lr, [x0, JB_X29_XLR]
+ mov x1, sp /* STP can't access SP directly */
+ stp fp, x1, [x0, JB_XFP_XSP]
+ stp d8, d9, [x0, JB_D08_D09]
+ stp d10, d11, [x0, JB_D10_D11]
+ stp d12, d13, [x0, JB_D12_D13]
+ stp d14, d15, [x0, JB_D14_D15]
+
+ mov x0,#0 /* return value */
+ ret
+
+ .text
+ .globl SYMBOL(longjmp)
+ .align 4
Review comment:
we should use tab in all assemble file like others
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802263127
##########
File path: arch/sim/include/setjmp.h
##########
@@ -97,12 +101,42 @@
# define JB_FP JB_EBP
#elif defined(CONFIG_HOST_ARM)
+
# define XCPTCONTEXT_REGS 16
# define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
# define JB_FP 7
# define JB_SP 8
# define JB_PC 9
+
+#elif defined(CONFIG_HOST_ARM64)
+
+# define XCPTCONTEXT_REGS 32
+# define XCPTCONTEXT_SIZE (8 * XCPTCONTEXT_REGS)
+
+# ifdef __ASSEMBLY__
+
+# define JB_X19_X20 #0x00
+# define JB_X21_X22 #0x10
+# define JB_X23_X24 #0x20
+# define JB_X25_X26 #0x30
+# define JB_X27_X28 #0x40
+# define JB_X29_XLR #0x50
+# define JB_XFP_XSP #0x60
+
+# define JB_D08_D09 #0x70
+# define JB_D10_D11 #0x80
+# define JB_D12_D13 #0x90
+# define JB_D14_D15 #0xA0
+
Review comment:
move the define to assemble file? only JB_PC, JB_FP and JB_SP need in header file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802261983
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -84,10 +97,10 @@ void up_initial_state(struct tcb_s *tcb)
* the return address.
*/
- tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
- tcb->adj_stack_size -
- sizeof(xcpt_reg_t);
+ tcb->xcp.regs[JB_SP] = (xcpt_reg_t)
+ STACK_ALIGN_DOWN((long)tcb->stack_base_ptr + tcb->adj_stack_size - 1);
Review comment:
let's fix the alignment issue in another patch?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802312993
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
Review comment:
Got it ... will come with next update.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804880520
##########
File path: arch/sim/src/sim/up_copyfullstate.c
##########
@@ -41,7 +41,8 @@
*
****************************************************************************/
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
we can simply add this:
#ifdef CONFIG_SIM_M32
static_assert(sizeof(unsigned long) == 4));
#endif
If there isn't preprocess error, it should be good.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka removed a comment on pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka removed a comment on pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#issuecomment-1035103566
Let me park this PR completely ... it's not working, they way it was intended ... I need to re-think.
Current major blocker is the dependency to homebrew based tools. A lot of part working w/o, but getting the modules compiled, there's a hard reference to homebrew based tools.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802442792
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,9 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
+
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
+# Native (clang based) compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ ifeq ($(CONFIG_HOST_ARM64),y)
Review comment:
@yamt what your opinion to use native compiler for macOS/x84 by default to simplify the setup? I know user still need gcc to try NuttX ELF feature, but clang is enough for most user case.
If you don't object the change, I would suggest to unify the macOS experience for both x64 and arm64, and simplify the setup process by update both CI and documentation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802315533
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -84,10 +97,10 @@ void up_initial_state(struct tcb_s *tcb)
* the return address.
*/
- tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
- tcb->adj_stack_size -
- sizeof(xcpt_reg_t);
+ tcb->xcp.regs[JB_SP] = (xcpt_reg_t)
+ STACK_ALIGN_DOWN((long)tcb->stack_base_ptr + tcb->adj_stack_size - 1);
Review comment:
Right ... as the basic M1 support in done (PR ready, but not integrated), I'll think about the alignment issue in another PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800145129
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
Ok, I fully understand the situation now. Look like the best approach is:
1. Change the default visibility to hidden for both macOS and Linux
2. Add ` __attribute ((visibility("default")))' Explicitly to the function need be called by host side code
3. Remove nuttx-names.dat.in and the related hack
4. Remove OBJCOPY finally
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800158681
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
Okay ... I get your point ... let me check, if I can manage that as it depends on having Linux/MacOS on ARM64/X86_64 running. I assume, it needs to validated at least on 4 combination: MacOS/ARM64, MacOS/X86_64, Linux/X86_64, Linux/ARM64. Also to be validated, that there's no regression on Windows/Cygwin and 32bit based simulations. Do you know the level of support for BSD currently?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800069785
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
You are right. objcopy in sim is used to rename the symbols to avoid the conflict with host's glibc:
https://github.com/apache/incubator-nuttx/blob/master/arch/sim/src/Makefile#L288
So, I think objcopy can't avoid on M1 too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800158681
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
Okay ... I get your point ... let me check, if I can manage that as it depends on having Linux/MacOS nut ARM64/X86_64 running. I assume, we need to validate at least 4 combination: MacOS/ARM64, MacOS/X86_64, Linux/X86_64, Linux/ARM64. Also it needs to be validated, that there's no regression on Windows/Cygwin based simulations. Do you know the level of support for BSD currently?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800178047
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
You are right. Look like gcc and clang interpret hidden attribute for relocated file in a different way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800109140
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
I get your point, but in my opinion it's not the best solution to calculate a wrongly aligned stack pointer in up_initial_state() and let setjmp/longjmp later correct it. To avoid the ifdef and ugly subtract, I changed the code to calculate the initial stack pointer in a different way. New calculation leaves one "alignment size" (16 byte) free at the end of the stack to simulate what the comment describes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804840218
##########
File path: arch/sim/src/sim/up_copyfullstate.c
##########
@@ -41,7 +41,8 @@
*
****************************************************************************/
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
remove #if/#else/#endif
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804876419
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -84,10 +97,10 @@ void up_initial_state(struct tcb_s *tcb)
* the return address.
*/
- tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
- tcb->adj_stack_size -
- sizeof(xcpt_reg_t);
+ tcb->xcp.regs[JB_SP] = (xcpt_reg_t)
+ STACK_ALIGN_DOWN((long)tcb->stack_base_ptr + tcb->adj_stack_size - 1);
Review comment:
Yes ...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804999654
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
I reviewed code again and the subtraction cannot be removed. There is a specific reason for it (not related to any aligment issue) on the amd64 architecture:
/* Note: The amd64 ABI requires 16-bytes alignment _before_ a function
* call.
* On the other hand, our way to set up and switch to a new context
* is basically a JUMP.
* Thus, we need to emulate the effect of a CALL here, by subtracting
* sizeof(xcpt_reg_t), which is the amount a CALL would move RSP to store
* the return address.
*/
The subtraction simulates how a CALL would change the stack.
On the ARM64 architecture the return address is not stored on the stack, but in LR register. There's no need for the subtraction on the ARM64 architecture as the stack is unchanged.
I changed the code in a way, that the subtraction is only effective on none ARM64 architectures and added a note.
* Note: On ARM64 architectures the return address is passed via LR
* register. No extra adjustment for the stack needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799066097
##########
File path: arch/sim/src/sim/up_initialstate.c
##########
@@ -86,7 +86,13 @@ void up_initial_state(struct tcb_s *tcb)
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
+#if defined(CONFIG_HOST_ARM64)
+ /* SP needs 16byte alignment on ARM64 architecture */
Review comment:
It's part of the ARM64 architecture itself and explicitly required on Apple platforms: https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms --> "Pass Arguments to Functions Correctly"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804875092
##########
File path: arch/sim/src/sim/up_copyfullstate.c
##########
@@ -41,7 +41,8 @@
*
****************************************************************************/
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
Okay ... hopefully it's not breaking the 32 bit host simulation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r805203341
##########
File path: arch/sim/include/setjmp.h
##########
@@ -111,7 +145,8 @@
#ifndef __ASSEMBLY__
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
The code need adjust too, please see #5473
##########
File path: arch/sim/src/sim/up_internal.h
##########
@@ -125,7 +125,8 @@ extern char **g_argv;
/* Context switching */
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
void up_copyfullstate(unsigned long *dest, unsigned long *src);
Review comment:
ditto
##########
File path: arch/sim/src/sim/up_copyfullstate.c
##########
@@ -41,7 +41,8 @@
*
****************************************************************************/
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r805203449
##########
File path: arch/sim/src/sim/up_copyfullstate.c
##########
@@ -41,7 +41,8 @@
*
****************************************************************************/
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804901750
##########
File path: arch/sim/src/sim/up_copyfullstate.c
##########
@@ -41,7 +41,8 @@
*
****************************************************************************/
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
CI will try to build 32bit sim config, but doesn't run the generated binary. You could add CONFIG_SIM_M32=y to sim:smp and run ostest to check it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804837331
##########
File path: arch/sim/include/setjmp.h
##########
@@ -97,12 +101,42 @@
# define JB_FP JB_EBP
#elif defined(CONFIG_HOST_ARM)
+
# define XCPTCONTEXT_REGS 16
# define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
# define JB_FP 7
# define JB_SP 8
# define JB_PC 9
+
+#elif defined(CONFIG_HOST_ARM64)
+
+# define XCPTCONTEXT_REGS 32
+# define XCPTCONTEXT_SIZE (8 * XCPTCONTEXT_REGS)
+
+# ifdef __ASSEMBLY__
+
+# define JB_X19_X20 #0x00
Review comment:
```suggestion
# define JB_X19_X20 #0x00
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r805203870
##########
File path: arch/sim/include/setjmp.h
##########
@@ -111,7 +145,8 @@
#ifndef __ASSEMBLY__
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
Okay ... let's wait until that PR is integrated.
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
With latest update ostets/vfork() is working:
End of test memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 6 9
mxordblk 3e02610 3db2cd0
uordblks 1ebe10 24ccd0
fordblks 3e13ff0 3db3130
user_main: vfork() test
vfork_test: Child 125 ran successfully
Final memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 2 7
mxordblk 3e389f0 3e04650
uordblks 1c73d0 1e9c10
fordblks 3e38a30 3e161f0
user_main: Exiting
ostest_main: Exiting with status 0
##########
File path: libs/libc/machine/sim/arch_setjmp_arm64.S
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_setjmp_arm64.S
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Nickolay Semyonov (RPI) <sn...@wolpike.com>
+ *
+ * Extracted from the MUSL C-library. The MUSL C library has a compatible
+ * MIT license and is released here under the NuttX 3-clause BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_HOST_MACOS)
+ #define SYMBOL(x) _##x
+#else
+ #define SYMBOL(x) x
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+ .text
+ .globl SYMBOL(setjmp)
+ .align 4
+
+SYMBOL(setjmp):
+
+ mov x1,x0 /* [0:]: */
+ mov x2,fp /* [1:JB_FP]: FP (frame pointer) */
+ stp x1,x2,[x0]
+
+ mov x1,sp /* [2:JB_SP]: SP (stack pointer) */
Review comment:
With latest update ostest/vfork() is working:
End of test memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 6 9
mxordblk 3e02610 3db2cd0
uordblks 1ebe10 24ccd0
fordblks 3e13ff0 3db3130
user_main: vfork() test
vfork_test: Child 125 ran successfully
Final memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 3fffe00 3fffe00
ordblks 2 7
mxordblk 3e389f0 3e04650
uordblks 1c73d0 1e9c10
fordblks 3e38a30 3e161f0
user_main: Exiting
ostest_main: Exiting with status 0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804883081
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,9 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
+
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
+# Native (clang based) compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ ifeq ($(CONFIG_HOST_ARM64),y)
Review comment:
This has been solve in a different PR: https://github.com/apache/incubator-nuttx/pull/5452
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804880520
##########
File path: arch/sim/src/sim/up_copyfullstate.c
##########
@@ -41,7 +41,8 @@
*
****************************************************************************/
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
we can simply add this in any file:
```
#ifdef CONFIG_SIM_M32
static_assert(sizeof(unsigned long) == 4));
#endif
```
If there isn't preprocess error, it should be good.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804883672
##########
File path: arch/sim/include/setjmp.h
##########
@@ -97,12 +101,42 @@
# define JB_FP JB_EBP
#elif defined(CONFIG_HOST_ARM)
+
# define XCPTCONTEXT_REGS 16
# define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
# define JB_FP 7
# define JB_SP 8
# define JB_PC 9
+
+#elif defined(CONFIG_HOST_ARM64)
+
+# define XCPTCONTEXT_REGS 32
+# define XCPTCONTEXT_SIZE (8 * XCPTCONTEXT_REGS)
+
+# ifdef __ASSEMBLY__
+
+# define JB_X19_X20 #0x00
Review comment:
should be fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: sim: initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r804884639
##########
File path: arch/sim/src/sim/up_copyfullstate.c
##########
@@ -41,7 +41,8 @@
*
****************************************************************************/
-#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
+#if (defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)) || \
+ defined(CONFIG_HOST_ARM64)
Review comment:
Are there 32bit simulations in the CI, which would detect that?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799647831
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
I also agree your idea to avoid the extra installation as much as possible. So I would suggest that it's better to left OBJCOPY/OBJDUMP empty on macOS regardless it run on arm64 or x64.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r799735824
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
There's no issue with objdump. It's part of native compiler suite. Only objcopy is missing. It needs to be guarded with ARM64. Otherwise the CI build for x86 simulation on MacOS fails as it's based on gcc compiler suite. If there's a need to harmonize the simulation on MacOS for X86 and M1 always using native compiler suite, that's an additional topic. It also needs involvement of the CI team. What's your view on this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800069785
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
You are right. objcopy in sim is used to rename the symbols to avoid the conflict with host's glibc:
https://github.com/apache/incubator-nuttx/blob/master/arch/sim/src/Makefile#L288
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ptka commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
ptka commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r800158681
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,7 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
-OBJCOPY = $(CROSSDEV)objcopy
+
+# Native compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
Review comment:
Okay ... I get your point ... let me check, if I can manage that as it depends on having Linux/MacOS on ARM64/X86_64 running. I assume, it needs to validated at least on 4 combination: MacOS/ARM64, MacOS/X86_64, Linux/X86_64, Linux/ARM64. Also to be validated, that there's no regression on Windows/Cygwin and 32bit based simulations. Do you know the level of support for BSD currently? Anyway let me think about the PR as it makes this PR smaller, which is overall a good approach.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5401: Initial support sim:nsh on MacOS M1 and Linux ARM64 based hosts.
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5401:
URL: https://github.com/apache/incubator-nuttx/pull/5401#discussion_r802364276
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -93,9 +93,17 @@ STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
endif
NM = $(CROSSDEV)nm
+
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
+# Native (clang based) compiler doesn't have objcopy ... just ignore it.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ ifeq ($(CONFIG_HOST_ARM64),y)
Review comment:
I assume macOS/x64 also use native compiler too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org