-
Notifications
You must be signed in to change notification settings - Fork 1.5k
macOS support for sim #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a607853
ecb9cbf
86bd529
ed2c615
b32483e
32d6387
a3d2a4a
277f538
23ed146
74015be
faa921f
a3f5a22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,6 @@ | |
| void up_initial_state(struct tcb_s *tcb) | ||
| { | ||
| memset(&tcb->xcp, 0, sizeof(struct xcptcontext)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about we add a dummy field in xcptcontext instead?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don't understand your suggestion. can you explain?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like the below dummy field:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change is about the actual stack alignment. that is, the value of RSP register.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My previous comment is wrong, but all places(up_use_stack/up_stack_frame) which modify adj_stack_ptr already align this pointer to 16B boundary, the extra subtraction just make the situation even worse, I can't understand why this change fix your problem.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the convention is, align before a function call. |
||
| tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr; | ||
| tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr - sizeof(xcpt_reg_t); | ||
| tcb->xcp.regs[JB_PC] = (xcpt_reg_t)tcb->start; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,16 +46,20 @@ | |
| #ifdef __CYGWIN__ | ||
| # define SYMBOL(s) _##s | ||
| #else | ||
| #ifdef __ELF__ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic is wrong, should it be #ifndef?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops, you are right.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| # define SYMBOL(s) _##s | ||
| #else | ||
| # define SYMBOL(s) s | ||
| #endif | ||
| #endif | ||
|
|
||
| /************************************************************************** | ||
| * Public Functions | ||
| **************************************************************************/ | ||
|
|
||
| .text | ||
| .globl SYMBOL(up_setjmp) | ||
| #ifndef __CYGWIN__ | ||
| #ifdef __ELF__ | ||
| .type SYMBOL(up_setjmp), @function | ||
| #endif | ||
| SYMBOL(up_setjmp): | ||
|
|
@@ -86,11 +90,11 @@ SYMBOL(up_setjmp): | |
|
|
||
| xorl %eax, %eax | ||
| ret | ||
| #ifndef __CYGWIN__ | ||
| #ifdef __ELF__ | ||
| .size SYMBOL(up_setjmp), . - SYMBOL(up_setjmp) | ||
| #endif | ||
| .globl SYMBOL(up_longjmp) | ||
| #ifndef __CYGWIN__ | ||
| #ifdef __ELF__ | ||
| .type SYMBOL(up_longjmp), @function | ||
| #endif | ||
| SYMBOL(up_longjmp): | ||
|
|
@@ -112,7 +116,7 @@ SYMBOL(up_longjmp): | |
| /* Jump to saved PC. */ | ||
|
|
||
| jmp *%edx | ||
| #ifndef __CYGWIN__ | ||
| #ifdef __ELF__ | ||
| .size SYMBOL(up_longjmp), . - SYMBOL(up_longjmp) | ||
| #endif | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ | |
| * protection to simply disable pre-emption when accessing this list. | ||
| */ | ||
|
|
||
| FAR struct binfmt_s *g_binfmts; | ||
| FAR struct binfmt_s *g_binfmts = NULL; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we use -fno-common option instead? There are many place which don't initialize global variables explicitly.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think it works. do you prefer it?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are many places which don't set the global variable to NULL, the same error will report again and again if we turn more option in defconfig. The right fix is to add -fno-common.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, let me try the -fno-common approach later. |
||
|
|
||
| /**************************************************************************** | ||
| * Private Functions | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,7 @@ | |
| include ${TOPDIR}/.config | ||
| include ${TOPDIR}/tools/Config.mk | ||
|
|
||
| HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"} | ||
| HOSTOS = ${shell uname -o 2>/dev/null || uname -s 2>/dev/null || echo "Other"} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we fix the same issue in:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i guess it doesn't actually matter as they seem just checking if cygwin or not.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you are right. |
||
|
|
||
| ifeq ($(CONFIG_DEBUG_SYMBOLS),y) | ||
| ARCHOPTIMIZATION = -g | ||
|
|
@@ -116,9 +116,7 @@ EXTRA_LIBPATHS = -L "${shell dirname "$(LIBSUPXX)"}" | |
| EXTRA_LIBS = -lsupc++ | ||
|
|
||
| ifeq ($(CONFIG_DEBUG_SYMBOLS),y) | ||
| LDLINKFLAGS += -g | ||
| CCLINKFLAGS += -g | ||
| LDFLAGS += -g | ||
| endif | ||
|
|
||
| ifeq ($(CONFIG_SIM_M32),y) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -244,9 +244,9 @@ echo " Refreshing..." | |
| cd $nuttx || { echo "ERROR: failed to cd to $nuttx"; exit 1; } | ||
| make clean_context 1>/dev/null 2>&1 | ||
| if [ "X${debug}" = "Xy" ]; then | ||
| make olddefconfig V=1 | ||
| make olddefconfig V=1 || { echo "ERROR: failed to refresh"; exit 1; } | ||
| else | ||
| make olddefconfig 1>/dev/null 2>&1 | ||
| make olddefconfig 1>/dev/null || { echo "ERROR: failed to refresh"; exit 1; } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need keep 2>&1?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's intentional to expose the errors.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok |
||
| fi | ||
|
|
||
| # Move config file to correct location and restore any previous .config | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If so, why we don't update other platform to use -unexported_symbols_list? to simplify the logic in Makefile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do gnu ld have the option? my copy of its documentation doesn't have it.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emm, unexported_symbols_list doesn't support on Linux, but after searching we can install binutils and use gobjcopy? even for ld so we don't modify Makefile at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as i mentioned in the commit logs, gnu binutils didn't actually work for me.
objcopy runs without errors, producing a corrupted object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.