Commit Graph

49760 Commits

Author SHA1 Message Date
Alexander Lunev
7af151aa51 arch/arm: move -mthumb option back to ARCHCPUFLAGS
CONFIG_ARM_TOOLCHAIN_GNU_EABI build got broken when -mthumb option was moved
from ARCHCPUFLAGS to ARCHOPTIMIZATION variable:

arm-none-eabi-ld: error: .../build/nuttx/nuttx uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_fixunsdfdi.o) does not
arm-none-eabi-ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_fixunsdfdi.o)
arm-none-eabi-ld: error: .../build/nuttx/nuttx uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_udivmoddi4.o) does not
arm-none-eabi-ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_udivmoddi4.o)
2023-06-29 18:18:23 +08:00
guoshichao
d4dc0f6ec7 libs/libc/aio: fix aio_fsync compatible issue
1. make the aio_fsync implementation can pass the
ltp/open_posix_testsuite/aio_fsync testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_fsync.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-29 18:15:48 +08:00
Mingjie Shen
f5a2741ec2 libc/lib_remove: fix TOCTOU race condition
Separately checking the state of a file before operating on it may allow
an attacker to modify the file between the two operations.

Reference:
  CWE-367
  4290aed051/sysdeps/posix/remove.c (L29-L41)

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-29 18:15:06 +08:00
guoshichao
dc69b108b8 libs/libc/aio: fix aio_write compatible bug
1. make the aio_write implementation can pass the
lpt/open_posix_testsuite/aio_write testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_write.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-29 00:59:27 +08:00
Mingjie Shen
7d13f5eb78 fs/fat: Fix undefined behavior in signed integer overflow check
Testing for overflow by adding a value to a variable to see if it "wraps
around" works only for unsigned integer values, because signed overflow
has undefined behavior according to the C and C++ standards.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-28 23:02:25 +08:00
Alin Jerpelea
669ccfaa32 documentation: Add release notes for 12.2.0 release
This is a local copy taken from the confluence notes
https://cwiki.apache.org/confluence/display/NUTTX/NuttX+12.2.0

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2023-06-28 23:00:21 +08:00
Alin Jerpelea
3003236e3f ReleaseNotes: cleanup
remove double and trailing spaces

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2023-06-28 23:00:21 +08:00
Xiang Xiao
987b01221c fs/rpmsgfs: Zero dirs after realloc to avoid stale data
since many places assume the null pointer as an unused entry

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-28 10:29:21 -03:00
guoshichao
d33f90b78c libs/libc/aio: fix aio_read compatible bug
1. make the aio_read implementation can pass the
ltp/open_posix_testsuite/aio_read testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_read.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-28 10:28:28 -03:00
Huang Qi
f48a92810b libc.csv: Correct return type of strchr
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-06-28 18:23:52 +08:00
chao an
a2c4027da6 mm/kasan: replace load/store methods to marco
Signed-off-by: chao an <anchao@xiaomi.com>
2023-06-28 15:18:04 +08:00
guoshichao
0d9e7be323 libs/libc/aio: fix aio_return compatible bug
1. make the aio_return implementation can pass the
ltp/open_posix_testsuite/aio_return testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_return.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-28 15:17:35 +08:00
fangxinyong
d08b81db9d sched: fix pthread_exit crash
A normal user task calls pthread_exit(), will crash at DEBUGASSERT.
Cause pthread_exit limit in user pthread task.

test case:
int main(int argc, FAR char *argv[])
{
  pthread_exit(NULL);
  return 0;
}
>> test
>> echo $?
>> 0

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-06-28 15:17:17 +08:00
Mingjie Shen
1d6e51220d cxd56_dmac, lcd_dev: fix null pointer dereference
Check return values of following functions for null:
   - board_lcd_getdev
   - get_device

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-28 10:16:38 +03:00
Stuart Ianna
5b00c31396 boards/litex/arty_a7: Support building fully linked executables.
Changes the executable type built against the `make export` target fully linked by default. This greatly improves performance when loading applications, as relocations no longer need to be processed.
2023-06-28 15:16:28 +08:00
Stuart Ianna
6492f0172e binfmt/elf: Allow the userspace ELF type to be defined by board configuration.
This change allows boards to define an additional kconfig option, which specifies the final link format of application executables.

By selecting `CONFIG_BINFMT_ELF_RELOCATABLE`, and providing an appropriate linker script, applications can be fully linked, removing the need to process relocations.
2023-06-28 15:16:28 +08:00
Lucas Saavedra Vaz
9bd1d5ddda arch/risc-v/espressif: Add USB-Serial-JTAG driver
Add support for USB-Serial-JTAG on ESP32-C3/C6/H2 using the Espressif HAL
2023-06-28 08:47:55 +08:00
chao an
4de2284614 compiler/fortify: remove unused label prefix and fix build warning
string/lib_memmove.c:39:1: warning: optimization attribute on 'memmove' follows definition but the attribute doesn't match [-Wattributes]
   39 | {
      | ^
In file included from string/lib_memmove.c:27:
nuttx/include/string.h:177:37: note: previous definition of 'memmove' with type 'void *(void *, const void *, size_t)' {aka 'void *(void *, const void *, unsigned int)'}
  177 | fortify_function(memmove) FAR void *memmove(FAR void *dest,
      |                                     ^~~~~~~
string/lib_memset.c:55:1: warning: optimization attribute on 'memset' follows definition but the attribute doesn't match [-Wattributes]
   55 | {
      | ^
In file included from string/lib_memset.c:30:
nuttx/include/string.h:194:36: note: previous definition of 'memset' with type 'void *(void *, int,  size_t)' {aka 'void *(void *, int,  unsigned int)'}
  194 | fortify_function(memset) FAR void *memset(FAR void *s, int c, size_t n)
      |                                    ^~~~~~
CC:  unistd/lib_sysconf.c string/lib_memcpy.c:43:1: warning: optimization attribute on 'memcpy' follows definition but the attribute doesn't match [-Wattributes]
   43 | {
      | ^
In file included from string/lib_memcpy.c:27:
nuttx/include/string.h:186:36: note: previous definition of 'memcpy' with type 'void *(void *, const void *, size_t)' {aka 'void *(void *, const void *, unsigned int)'}
  186 | fortify_function(memcpy) FAR void *memcpy(FAR void *dest,
      |

Signed-off-by: chao an <anchao@xiaomi.com>
2023-06-28 08:47:33 +08:00
Stuart Ianna
b9fa045427 tools/syscall: Resolve compile time warning on address validation.
The following warning is emitted when building with GCC 12.2.0:

"the comparison will always evaluate as ‘true’ for the address of ‘g_parm’ will never be NULL [-Waddress]"

As g_param is an array of char[]. each member should have an actual address, so the validation in each if statement is not required.
2023-06-28 08:47:07 +08:00
Stuart Ianna
160e1a965d mkexport: Allow boards to supply custom gnu-elf.ld.
Allows boards to supply their own gnu-elf linker script, used when building Nuttx applications and CONFIG_BUILD_KERNEL.

This is useful when building fully-linked applications (see #9395).
2023-06-28 08:46:10 +08:00
Xiang Xiao
b64c029080 libc/pwd: Correct the geos related comment and ddd ROOT_GEOS macro
fix the minor issue in https://github.com/apache/nuttx/pull/7998

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-27 16:18:57 -03:00
Xiang Xiao
f1f33917f7 libc/pwd: Reuse g_passwd and g_passwd_buffer in getpwbuf
like other similar functions(e.g. getpwnam and getpwuid)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-27 16:18:57 -03:00
chao an
b9b615b425 sched/pthread: fix race condition on pthread_cond_wait()
pthread_cond_wait() should be an atomic operation in the mutex lock/unlock.
Since the sched_lock() has been wrongly deleted in the previous commit,
the context switch will occurred after the mutex was unlocked:

--------------------------------------------------------------------
  Task1(Priority 100)             |      Task2(Priority 101)
                                  |
  pthread_mutex_lock(mutex);      |
  |                               |
  pthread_cond_wait(cond, mutex)  |
  |  |                            |
  |  |                            |
  |  ->enter_critical_section()   |
  |  ->pthread_mutex_give(mutex)  | ----> pthread_mutex_lock(mutex);    // contex switch to high priority task
  |                               |       pthread_cond_signal(cond);    // signal before wait
  |                               | <---- pthread_mutex_unlock(mutex);  // switch back to original task
  |  ->pthread_sem_take(cond->sem)|                                     // try to wait the signal, Deadlock.
  |  ->leave_critical_section()   |
  |
  |  ->pthread_mutex_take(mutex)  |
  |                               |
  pthread_mutex_lock(mutex);      |
---------------------------------------------------------------------

This PR will bring back sched_lock()/sched_unlock() to avoid context switch to ensure atomicity

Signed-off-by: chao an <anchao@xiaomi.com>
2023-06-28 02:25:05 +08:00
raiden00pl
0aa1af7ff1 boards/thingy52: add sx1509 support
SX1509 is used to control various peripherals and RGB LEDs available on the board.
2023-06-27 14:44:00 -03:00
raiden00pl
dc608de144 drivers/ioexpander: add support for SX1509
SX1509 from Semtech is GPIO expander with LED driver and keypad engine.
For now, the keypad engine is not supported.
2023-06-27 14:44:00 -03:00
raiden00pl
c63b2d5c91 drivers/userled: add an interface to support LED effects.
LED effects must be implemented in the lower-half of the LED driver.
The interface is designed to supports the following LED effects:
  - intenisty (PWM)
  - Bling (Timer)
  - Fade in, Fade out (Ramp)
2023-06-27 14:44:00 -03:00
guoshichao
6c60c7df07 libs/libc/aio: fix aio_error compatible bug
1. make the aio_error implementation can pass the
ltp/open_posix_testsuite/aio_error testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_error.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-27 10:10:37 -03:00
SPRESENSE
31a2c22112 tools: Add script to parse callstack
Add 'callstack.py' script for parsing stack dump log to callstack.
2023-06-27 10:10:12 -03:00
Michal Lenc
9a9c35fa45 samv7: fix compile warnings for sam_wdt.c
Incorrect types in wdinfo and wderr functions were fixed to PRIu32 and
PRIx32.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-06-27 10:03:25 -03:00
Stuart Ianna
8a668fe733 include/sys: Include string.h to silence implicit memset declration.
This change stops the warning "implicit declaration of function 'memset'" when using the `FD_ZERO` macro.
2023-06-27 10:36:13 +03:00
GD32-MCU
ec2a62c397 add gd32f470 support 2023-06-27 14:59:33 +08:00
Stuart Ianna
30f8cf541c net/udp: Populate the udp connection structure with the address family.
The udp connection structure contains the field, "domain", which defines which address family it belongs to. Prior to this change, this field was only populated correctly if IPv4 and IPv6 was enabled. As a result, packet information was not processed in udp_recvpktinfo, as expected when the appropriate socket option was enabled.
2023-06-27 14:58:12 +08:00
guoshichao
037a6f5836 libs/libc/signal: add killpg function
1. the killpg function can make all the
ltp/open_posix_testsuite/killpg testcaes passed
2. Nuttx do not support process group, so we use kill process instead
3. the implementation are referred to:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/killpg.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-27 13:26:20 +08:00
Stuart Ianna
d94013837e risc-v/litex: Improve ethernet packet reception.
In the default configuration, the Litex ethernet peripheral contains two RX and two TX buffers. The active buffer for the peripheral should be swapped as soon as possible, in order to reduce packet loss.

This modification acknowledges the receive buffer as soon as the pending data is copied into the NuttX device data buffer. Improving reliability under heavy load.
2023-06-27 03:33:40 +08:00
Xiang Xiao
7f80b4aeba clock: Move the content of include/nuttx/time.h to include/nuttx/clock.h
and remove include/nuttx/time.h to reduce the nuttx specific header files

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-26 19:14:08 +03:00
Mingjie Shen
3344697afc drivers/sensors/apds9960.c: Fix resource leak in error handling
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-26 09:43:01 -03:00
chao an
df6d799577 tools/ci: Update GNU Arm Embedded Toolchain to Version 12.2-2022.12.22
x86_64 Linux hosted cross toolchains
AArch32 bare-metal target (arm-none-eabi)

arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz

Remove toolchain workaround which already fixed by ARM:
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
https://community.arm.com/support-forums/f/compilers-and-libraries-forum/53470/arm-gnu-toolchain-11-3-rel1-x86_64-arm-none-eabi-wrong-newlib-version-strings-error-when-stdlib-h-is-included

Signed-off-by: chao an <anchao@xiaomi.com>
2023-06-26 20:03:38 +08:00
Xiang Xiao
b5c48f3ed8 binfmt: Always include arch/elf.h in include/nuttx/elf.h
since symbols defined in arch/elf.h is also used in other case, for example:
CC:  pthread/pthread_testcancel.c machine/arm/gnu_unwind_find_exidx.c:32:8: error: unknown type name '__EIT_entry'
   32 | static __EIT_entry *__exidx_start_elf;
      |        ^~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-25 19:02:53 -03:00
guoshichao
3821ad514d libs/libc/unistd: add getpgrp function
1. the getpgrp function can help to pass the ltp/open_posix_teststuite/killpg related testcases
2. Nuttx do not support process group, so we use getpid to implement this
3. the implementation are referred to: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgrp.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-26 01:03:36 +08:00
Mingjie Shen
cbe4edd479 arch/arm/imxrt: Fix implicit function declaration
The function 'imxrt_config_gpio' was implicitly declared.
Fix by include the header 'imxrt_gpio.h'.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-25 11:29:42 -03:00
anjiahao
1dfcb1f12d Documentation:Add documentation related to gdb python script debugging
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-06-25 18:17:30 +08:00
anjiahao
adc5c8b5ac Debug:support python script auto debug nuttx kernel
This patch add an example and pyhton base modules:
1.add memdump.py is an example to analyze memory
usage by python script.
2.add The most basic data structure analysis, like list, etc.

future ideas:
Maybe we can add modules related to "sched, drivers, arch, fs.." to
automatically analyze scripts to debug some problems

References:
linux kernel (https://github.com/torvalds/linux/tree/master/scripts/gdb)
The official manual of gdb (https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html)

Change-Id: Ib9025a0a141cb89f3813526f7c55dcb28de31ed9
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-06-25 18:17:30 +08:00
anjiahao
79c0fafc06 mm:Fix the problem that the memdump statistics of blkcont are inconsistent
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-06-25 18:17:30 +08:00
Mingjie Shen
49afeb4d63 arch/arm/stm: Fix duplicate include guard
The following macros
  __ARCH_ARM_SRC_STM32F7_HARDWARE_STM32F74XX75XX_FLASH_H
  __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4X6XX_RCC_H
are used in other header files.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-25 12:23:23 +03:00
Mingjie Shen
65e97ffca1 drivers/can/can.c: Fix nested loops with same variable
In this nested loop, the iteration variable is the same for both loops.
This is a typo and the inner loop should use a new loop variable.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-25 11:47:34 +03:00
Mingjie Shen
209bee3266 drivers/sensors/apds9960.c: Fix use after free
Memory pointed by priv may be used (in line 1289) after it is
freed in line 1283.
Fix by adding the missing return statement in error handling.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-25 14:36:22 +08:00
Filipe Cavalcanti
9603288c80 drivers/sensors/mpu60x0.c: add IOCTL for AFS_SEL, sample rate and FIFO support 2023-06-24 10:57:12 -03:00
tjwu1217
42914040de mm_lock.c: reformat preprocessor format 2023-06-24 10:54:19 -03:00
Roy Feng
10251f6b6c Fix assertion of free a wrong heap 2023-06-24 16:34:53 +08:00
Lucas Saavedra Vaz
09dcf50f20 boards/risc-v/esp32c3-generic: Add full GPIO and Buttons support 2023-06-24 13:11:45 +08:00