This commit corrects the following compilation error:
/usr/include/cygwin/socket.h:27:8: error: redefinition of 'struct sockaddr'
27 | struct sockaddr {
| ^~~~~~~~
In file included from /usr/include/w32api/winsock2.h:57,
from sim/up_wpcap.c:48:
/usr/include/w32api/psdk_inc/_ip_types.h:70:8: note: originally defined here
70 | struct sockaddr {
| ^~~~~~~~
In file included from /usr/include/sys/socket.h:13,
from /usr/include/cygwin/in.h:21,
from /usr/include/netinet/in.h:12,
from sim/up_wpcap.c:57:
/usr/include/cygwin/socket.h:39:8: error: redefinition of 'struct sockaddr_storage'
39 | struct sockaddr_storage {
| ^~~~~~~~~~~~~~~~
In file included from sim/up_wpcap.c:48:
/usr/include/w32api/winsock2.h:269:10: note: originally defined here
269 | struct sockaddr_storage {
| ^~~~~~~~~~~~~
The compilation was broken by a couple of recent blind, unverified changes to up_wpcap.c. Most were introduced with commit: 8ce0ff5ce4 with this change:
diff --git a/arch/sim/src/sim/up_wpcap.c b/arch/sim/src/sim/up_wpcap.c
index ef7b4b3a0c..a15421e80c 100644
--- a/arch/sim/src/sim/up_wpcap.c
+++ b/arch/sim/src/sim/up_wpcap.c
@@ -55,6 +55,8 @@
#include <netinet/in.h>
+#include "up_internal.h"
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
up_internal.h includes:
47 # include <sys/types.h>
48 # include <stdbool.h>
49 # include <netinet/in.h>
And netinet/in.h includes:
46 #include <sys/types.h>
47 #include <sys/socket.h>
48 #include <stdint.h>
Which is where the collision error is introduced since up_wpcap.c includes winsock2.h already. There were additional problems introduced to the file by other changes:
- A malformed syslog() call was added
- Some issues with netdriver_setmacaddr()
## Summary of Changes
Add a host timer that generates periodic signals and sends SIGALRM to
the process that runs the NuttX simulation. This logic is integrated as
part of the existing NuttX oneshot timer. The host timer installs an
irq handler which is expected to run every CONFIG_USEC_PER_TICK .
Signed-off-by: Sebastian Ene <nuttx@fitbit.com>
1. There is difference about symbol replace on nuttx-names.in
between MacOS & Linux
2. For MacOS, if open '-fvisibility=hidden' and adjust nuttx-names.in,
it will meet symbol link-back-to-nuttx error.
3. Make the MacOS replace behaviour, same with Linux
Note:
MacOS should install objcopy with command:
$ brew install binutils
$ export PATH=$PATH:/usr/local/opt/binutils/bin
already check in to cibuild.sh
Change-Id: If78b784cc0ecb98cdbf7091de38acef00a8a02f3
Signed-off-by: ligd <liguiding1@xiaomi.com>
and remove the special handling in the stack dump
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia1ef9a427bd4c7f6cee9838d0445f29cfaca3998
EXTRAFLAGS is already applied to *FLAGS in board's Make.defs (and
it applies to whole build, not just arch-code). EXTRAFLAGS is passed
around each make call to the complete build.
KDEFINE is already added to EXTRAFLAGS in main Makefile so no need
to add it again in arch-level Makefile
After previous commit, add -fvisibility=hidden, we don't need
worry about depended libxx.so callback to nuttx symbol in SIM.
So most of the symbol in nuttx-names.in can be remove.
But we still need some symbol replacement for host code.
Host code should call host API if access HOST sth, for example:
open, close, accept, printf...
Signed-off-by: ligd <liguiding1@xiaomi.com>
should use syslog in kernel
RP check failed because host code call host API has
style AaaBbb, so, ignore the RP check
Change-Id: Iad3468dae2cd07e6dd92874c5e6d38d9018bee6c
Signed-off-by: ligd <liguiding1@xiaomi.com>
## Summary of changes
The pthread_cond_* API is also present as part of libfs.a and we want
to avoid colisions and link with the correct implementation.
Signed-off-by: Sebastian Ene <nuttx@fitbit.com>
## Summary of changes
On OSX with CONFIG_SMP=y the semaphore which notifies that the CPU is
initialised, is not created and the up_cpu_start() returns with error
from sem_init(). This patch fixes the problem by using pthread_cond_t
signalling mechanism which is supported on Mac.
Signed-off-by: Sebastian Ene <nuttx@fitbit.com>
Note: dlsymtab is not in standards. but just in case.
(gdb) bt
#0 getpid () at task/task_getpid.c:91
#1 0x00000000004fbc9d in modlib_registry_lock ()
at modlib/modlib_registry.c:89
#2 0x0000000000719ee0 in modsym (handle=0xffffffffffffffff,
name=0x7fa7ebdde8c7 "mmap") at module/mod_modsym.c:92
#3 0x000000000071597d in dlsym (handle=0xffffffffffffffff,
name=0x7fa7ebdde8c7 "mmap") at dlfcn/lib_dlsym.c:164
#4 0x00007fa7ebdbeb39 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
#5 0x00007fa7ebd79b28 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
#6 0x00007fa7ebd9d7a7 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
#7 0x00007fa7ec6ce03a in ?? () from /lib64/ld-linux-x86-64.so.2
#8 0x00007fa7ec6ce141 in ?? () from /lib64/ld-linux-x86-64.so.2
#9 0x00007fa7ec6be13a in ?? () from /lib64/ld-linux-x86-64.so.2
#10 0x0000000000000001 in ?? ()
#11 0x00007fff028f686b in ?? ()
#12 0x0000000000000000 in ?? ()
(gdb) quit
to save the preserved space(1KB) and also avoid the heap overhead
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I694073f68e1bd63960cedeea1ddec441437be025
so size with nuttx could report the correct bss value:
text data bss dec hex filename
155467 1464 1948 158879 26c9f nuttx
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7e9ec4d09d14b6f15b235b4b46ebdd98986d9750
1.Expose the notification through fb_vtable_s::updatearea
2.Incorporate old nx_notify_rectangle into the new updatearea callback
3.Migrate the calle of nx_notify_rectangle to fb_vtable_s::updatearea
Change-Id: Ia3d1f73e8757b2d381586d76ec6adc16c810018d
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
clang-check complained like the following.
While this is not a real bug, it's easy to appease.
sim/up_exit.c:68:21: warning: Value stored to 'tcb' during its initialization is never read
FAR struct tcb_s *tcb = this_task();
^~~ ~~~~~~~~~~~
1 warning generated.
include/arch/irq.h💯20: note: previous declaration with ‘C++’ linkage
100 | static inline void up_irqinitialize(void)
| ^~~~~~~~~~~~~~~~
In file included from include/ctype.h:45,
from include/libcxx/ctype.h:38,
from include/libcxx/cctype:38,
from include/libcxx/cwctype:53,
from include/libcxx/cwchar:106,
from include/libcxx/string:510,
from libcxx/src/debug.cpp:13:
include/nuttx/arch.h:1343:6: error: conflicting declaration of ‘void up_irqinitialize()’ with ‘C’ linkage
1343 | void up_irqinitialize(void);
| ^~~~~~~~~~~~~~~~
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0e0963a3465f9dabdaca6534a55b9c2c41f4bc64
Make.dep file should be updated by .config changed after first make.
There are 2 cases affected for this problem:
1) Add source files by config symbol
2) Include header files in #ifdef directive
These 2 cases may not be included in Make.dep and this may prevent the
differential build from working correctly.
since exit will be only callable from userspace and change
the 1st argument from "const uint8_t *" to "const char *"
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I86487d57210ab63109148232da71dbc4d60a563b
make can't guarantee the build order of prerequest with -jn where n > 1
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I772fcc0775d15b385f28fc0abeeff383b3a52622
fix the following linker error:
nuttx.rel:(.eh_frame+0x93): undefined reference to `__gxx_personality_v0'
Change-Id: I94f43a15275194d42199c91f276e8848ad5189f6
Signed-off-by: chao.an <anchao@xiaomi.com>
LD: nuttx.rel
objcopy: couldn't open symbol redefinition file nuttx-names.dat
(error: No such file or directory)
Makefile: 297: recipe for target 'nuttx.rel' failed
Change-Id: Ic78f030b77c3468ddbb96d4fb0558edad3abc3ae
Signed-off-by: chao.an <anchao@xiaomi.com>
ASAN trace:
...
==32087==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4502120 at pc 0x56673ca3 bp 0xff9b6a08 sp 0xff9b69f8
WRITE of size 1 at 0xf4502120 thread T0
#0 0x56673ca2 in strcpy string/lib_strcpy.c:64
0xf4502120 is located 0 bytes to the right of 8224-byte region [0xf4500100,0xf4502120)
allocated by thread T0 here:
#0 0xf7a60f54 in malloc (/usr/lib32/libasan.so.4+0xe5f54)
#1 0x5667725d in up_create_stack sim/up_createstack.c:135
#2 0x56657ed8 in nxthread_create task/task_create.c:125
#3 0x566580bb in kthread_create task/task_create.c:297
#4 0x5665935f in work_start_highpri wqueue/kwork_hpthread.c:149
#5 0x56656f31 in nx_workqueues init/nx_bringup.c:181
#6 0x56656fc6 in nx_bringup init/nx_bringup.c:436
#7 0x56656e95 in nx_start init/nx_start.c:809
#8 0x566548d4 in main sim/up_head.c:95
#9 0xf763ae80 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18e80)
CALLSTACK:
#8 0xf79de7a5 in __asan_report_store1 () from /usr/lib32/libasan.so.4
#9 0x565fd4d7 in strcpy (dest=0xf4a02121 "", src=0xf5c00895 "k") at string/lib_strcpy.c:64
#10 0x565e4eb2 in nxtask_setup_stackargs (tcb=0xf5c00810, argv=0x0) at task/task_setup.c:570
#11 0x565e50ff in nxtask_setup_arguments (tcb=0xf5c00810, name=0x5679e580 "hpwork", argv=0x0) at task/task_setup.c:714
#12 0x565e414e in nxthread_create (name=0x5679e580 "hpwork", ttype=2 '\002', priority=224, stack=0x0, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:143
#13 0x565e42e3 in kthread_create (name=0x5679e580 "hpwork", priority=224, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:297
#14 0x565e5557 in work_start_highpri () at wqueue/kwork_hpthread.c:149
#15 0x565e3e32 in nx_workqueues () at init/nx_bringup.c:181
#16 0x565e3ec7 in nx_bringup () at init/nx_bringup.c:436
#17 0x565e3d96 in nx_start () at init/nx_start.c:809
#18 0x565e3195 in main (argc=1, argv=0xffe6b954, envp=0xffe6b95c) at sim/up_head.c:95
Change-Id: I096f7952aae67d055daa737e967242eb217ef8ac
Signed-off-by: chao.an <anchao@xiaomi.com>
like other related macro(e.g. INTMAX_MIN, INTMAX_MAX...)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8863599960b1a9b1c22ae9c35735a379a4c745b0
utilize the call inside nxtask_exit instead, also move
nxsched_suspend_scheduler to nxtask_exit for symmetry
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I219fc15faf0026e452b0db3906aa40b40ac677f3
-Move task_init() and task_activate() prototypes from include/sched.h to include/nuttx/sched.h. These are internal OS functions and should not be exposed to the user.
-Remove references to task_init() and task_activate() from the User Manual.
-Rename task_init() to nxtask_init() since since it is an OS internal function
-Rename task_activate() to nxtask_activate since it is an OS internal function
remove the TLS alignment check
Regression by:
--------------------------------------------------------
commit a6da3c2cb6
Author: Ouss4 <abdelatif.guettouche@gmail.com>
Date: Thu May 7 18:50:07 2020 +0100
arch/*/*_checkstack.c: Get aligned address only when
CONFIG_TLS_ALIGNED is enabled.
--------------------------------------------------------
commit c2244a2382
Author: Gregory Nutt <gnutt@nuttx.org>
Date: Thu May 7 09:46:47 2020 -0600
Remove CONFIG_TLS
A first step in implementing the user-space error is
force TLS to be enabled at all times. It is no longer optional
Signed-off-by: chao.an <anchao@xiaomi.com>
Move the logic to get TLS information from an inline function to a normal function. For the unaligned case, it is probably too large to be inlined.
Also fixes some minor things from review of previous commits.
Fix it after the following change:
commit bb4458b63f
Author: Ouss4 <abdelatif.guettouche@gmail.com>
Date: Thu Apr 30 19:05:12 2020 +0100
include/sys/stat.h: Per the POSIX standard, the atime, ctime and mtime field
s
have changed their type from time_t to struct timespec.
Mac OS X was renamed to macOS at some point. Update references to
OSX, OS X, Mac OS X, Mac OSX, and other permutations, to macOS,
in README files and in comments of other files.