Commit Graph

49834 Commits

Author SHA1 Message Date
Xiang Xiao
8f38fa6062 symtab: Remove the unnessary inclusion of nuttx/symtab.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-06 09:24:02 -03:00
Xiang Xiao
62480d1a8b boardctl: Add const to struct boardioc_symtab_s::symtab
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-06 09:24:02 -03:00
Xiang Xiao
935f43185f libc/modlib: Replace nx_stat with file_stat
to avoid searching the path twice

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-06 09:20:24 -03:00
Xiang Xiao
1b2f37259a binfmt/elf: Replace nx_stat with file_stat
since kernel code prefer to use file_ API

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-06 09:20:24 -03:00
Xiang Xiao
7bb97f7e22 elf: Replace {0x7f, 'E', 'L', 'F'} to EI_MAGIC
to avoid the duplication of the magic number.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-06 09:15:50 -03:00
Neale Ferguson
3cee81af6d * libs/libc/machine/arm/armv7-m/arch_elf.c
- Fix typo
2023-07-06 09:13:38 -03:00
Neale Ferguson
fec789047a Add support for the loading of ET_DYN objects
* libs/libc/machine/arm/armv7-m/arch_elf.c
      - Fix cast of error message parameters

    * build-globals.sh
      - Build the modlib_globals.S file used to resolve symbols when dynamically loading

    * libs/libc/modlib/Make.defs
      - Build modlib_globals.S for all targets

    * libs/libc/modlib/modlib_load.c
      - Calculate sizes and text/data addresses based on program headers rather than section headers
      - Handle objects with no program headers

    * libs/libc/modlib/modlib_bind.c
      - Call modlib_readsym with pointer to symbol table
      - Add modlib_relocatedyn to manage relocation of symbols with shared object (ET_DYN)
      - Differentiate between ET_REL and ET_DYN objects
      - Use arch independent symbol ELF_R_SYM
      - Cast sizes to avoid warnings

    * libs/libc/modlib/modlib_load.c
      - Cast sizes to avoid warnings

    * include/elf.h
      - Add definitions that may be found in shared objects

    * include/nuttx/lib/modlib.h
      - Add parameter to modlib_readsym prototype
      - Add prototypes for:
        - modlib_insertsymtab
        - modlib_findglobal
      - Define Elf_Dyn and Elf_Off according to the elf architecture
      - Add fields to mod_loadifno_s:
        - Program headers
        - Exported symbols
        - Data section address
        - Padding requirement
        - Section index for dynamic symbol table
        - Number of symbols exported
      - Add prottotype for modlib_freesymtab

    * libs/libc/dlfcn/lib_dlclose.c
      - Free the symbol table when the dll is closed

    * libs/libc/dlfcn/lib_dlopen.c
      - Add dump of program headers to debug routine
      - Differentiate between ET_REL and ET_DYN objects

    * libs/libc/machine/arm/armv7-m/arch_elf.c
      - Add handling of R_ARM_RELATIVE and R_ARM_JUMP slot relocation types

    * libs/libc/modlib/modlib_loadshdrs.c
      - Rename modlib_loadshdrs.c to modlib_loadhdrs.c
      - Rename modlib_loadshdrs to modlib_loadhdrs
      - Add code to load program headers

    * libs/libc/modlib/modlib_symbols.c
      - Define entry point structure
      - Add offset parameter to modlib_symname() and use to find symbol names
      - Add symtab section header parameter to modlib_readsym()
      - Add offset parameter to modlib_symvalue() to locate symbol names
      - Add modlib_insertsyntab() to create a symbol table for exporting and resolution
      - Add findEP() to resolve a symbol in the modlib_global table
      - Add modlib_findglobal() to find symbol in the modlib_global table
      - Add modlib_freesymtab() to free the symbol table

    * libs/libc/modlib/modlib_uninit.c
      - Free header and sections from a module_loadinfo_s control block

    * libs/libc/modlib/modlib_verify.c
      - Handle ET_DYN shared objects

    * libs/libc/modlib/modlib_globals.S
      - Multi-target global table
      - Define library APIs that may be resolved when loading a shared object
2023-07-06 09:13:38 -03:00
lpxiao
f0107683d5 1.arch/arm/src/stm32/stm32_rtcounter.c   up_rtc_initialize Possible stall
2.arch/arm/src/stm32/stm32_rtcounter.c up_rtc_settime memory hardfault
2023-07-06 18:07:24 +08:00
chao an
6a4495e3b7 net/local: fix build warning on GCC 12.2.0
In file included from local/local_fifo.c:25:
In function ‘local_format_name’,
    inlined from ‘local_hd_name’ at local/local_fifo.c:132:3,
    inlined from ‘local_open_receiver’ at local/local_fifo.c:661:3:
local/local_fifo.c:77:16: warning: ‘%s’ directive output may be truncated writing up to 107 bytes into a region of size 100 [-Wformat-truncation=]
   77 |                CONFIG_NET_LOCAL_VFS_PATH "/%s%s", inpath, suffix);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
local/local_fifo.c: In function ‘local_open_receiver’:
local/local_fifo.c:82:44: note: format string is defined here
   82 |                CONFIG_NET_LOCAL_VFS_PATH "/%s%s%" PRIx32,
      |                                            ^~
In function ‘local_format_name’,
    inlined from ‘local_hd_name’ at local/local_fifo.c:132:3,
    inlined from ‘local_open_receiver’ at local/local_fifo.c:661:3:
local/local_fifo.c:76:7: note: ‘snprintf’ output between 12 and 119 bytes into a destination of size 109
   76 |       snprintf(outpath, LOCAL_FULLPATH_LEN - 1,
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   77 |                CONFIG_NET_LOCAL_VFS_PATH "/%s%s", inpath, suffix);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-06 13:19:21 +08:00
SPRESENSE
4eb6da33c2 cxd56/alt1250: Change power on sequence
Change the power on sequence according to ALT1250 modem spec.
2023-07-06 13:18:57 +08:00
simonatoaca
a4708d217a esp32/common: Added support for rgb led driver on esp32
Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>

esp32-sparrow-kit: Added rgb led driver to bringup and to defconfig

Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>

Fixed checkstyle

Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>

Update esp32_rgbled.h

Update boards/xtensa/esp32/common/src/esp32_rgbled.c

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

Update boards/xtensa/esp32/common/src/esp32_rgbled.c

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

Update boards/xtensa/esp32/common/src/esp32_rgbled.c

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

Update boards/xtensa/esp32/common/src/esp32_rgbled.c

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

Removed ret 0 as an error in the case of nx_write()
2023-07-05 16:08:56 -03:00
Robert-Ionut Alexa
c3576d79d9 esp32-sparrow-kit: enable framebuffer support in the default configuration
Signed-off-by: Robert-Ionut Alexa <robertalexa2000@gmail.com>
2023-07-05 11:23:33 -03:00
Robert-Ionut Alexa
6adeae4d0a esp32: initializing a display should not initialize the framebuffer as well
The framebuffer itself already initializes the display so there is no need to
do the reverse operation. Otherwise the code gets stuck in an infinite loop.

Signed-off-by: Robert-Ionut Alexa <robertalexa2000@gmail.com>
2023-07-05 11:23:33 -03:00
raiden00pl
21ec89b067 arch/armv8-m/nvic.h: add definition for NVIC non-secure registers offset
This will make it easier to use the NVIC non-secure registers using the current NVIC secure registers definitions.
2023-07-05 11:21:06 -03:00
raiden00pl
206d339b37 arch/arm: add support for ARMv8-M Security Extensions 2023-07-05 11:20:46 -03:00
Xiang Xiao
015e30a866 drivers/net: Remove HAVE_ATOMICS and use CONFIG_HAVE_ATOMICS directly
since OpenAMP never support to compile in c89 only mode

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-05 13:43:17 +03:00
Roy Feng
8f66b033db change free to kmm_free as it was allocated via kmm_alloc 2023-07-05 16:40:23 +08:00
fangxinyong
dc7f8f136c signal: correct to const pointer for sigorset and sigandset
the two GNU functions, should use const input pointer parameter.

https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/baselib-sigorset.html
https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/baselib-sigandset.html

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-07-05 16:26:18 +08:00
Zhe Weng
1072b5b564 net: Limit max value for Send/Recv bufsize
There're some apps trying to set too large SO_SNDBUF and SO_RCVBUF, which may use all IOBs in one socket and block all other network traffic.

Note:
Linux silently limits SO_SNDBUF to be less than `sysctl_wmem_max`, so we can also do this limit without returning any error.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-07-05 13:57:08 +08:00
guoshichao
67ec447513 sched/clock/clock_getcpuclockid: fix code format, remove space
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-05 13:03:06 +08:00
simonatoaca
fd4dd59c3c Made the PWM frequency of the RGB driver configurable from the menu.
Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>
2023-07-05 00:49:44 +08:00
guoshichao
bc084a8505 sched/clock/clock_getcpuclockid: add clock_getcpuclockid implementation
1. the implementation can pass the full
ltp/open_posix_testsuite/clock_getcpuclockid testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getcpuclockid.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-05 00:32:11 +08:00
Petro Karashchenko
dc6baf68a9 .github/workflows: run MAC OS builds based on macos-13 image
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-05 00:16:44 +08:00
raiden00pl
91be7781f5 arch/armv8-m/arm_secure_irq.c: fix writing to the NVIC_AIRCR register
Register key (VECTKEY) must be written, otherwise the write is ignored.

Reference:
https://developer.arm.com/documentation/100235/0004/the-cortex-m33-peripherals/system-control-block/application-interrupt-and-reset-control-register
2023-07-05 00:02:42 +08:00
SPRESENSE
a03b09c34d arch: cxd56xx: Fix bug when watchdog restart
Fix a bug that watchdog is expired in less time than the specified time
when restarting without clearing interrupt.
2023-07-04 10:37:17 -03:00
Sunny
abfdffd879 libc/libvsprintf:fix vsnprintf bug with "%#.0f"
With double value=3.141593 initialized in va_list ap,
such code:
   vsnprintf(buffer, sizeof(buffer), "%#.0f", ap);
expected output string: "3."
but real output string: ".3"

Signed-off-by: Sunny <zxcvbnm37425@gmail.com>
2023-07-04 10:36:31 -03:00
Xiang Xiao
6b11672310 arch/sim: Remove the unused sim_camera_uninitialize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-04 20:15:30 +09:00
Xiang Xiao
af50cdd21b arch/sim: Rename sim_video to sim_camera
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-04 20:15:30 +09:00
SPRESENSE
6611bf99c4 drivers: video: isx012: Fix system clock to HV mode
ISX012 doesn't work if CONFIG_CPUFREQ_RELEASE_LOCK is enabled
without this changes.
2023-07-04 12:34:13 +03:00
SPRESENSE
d0d787c1b0 drivers: video: isx019: Fix system clock to HV mode
ISX019 doesn't work if CONFIG_CPUFREQ_RELEASE_LOCK
is enabled without this changes.

Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
2023-07-04 12:34:13 +03:00
libei1
63774125d9 arch/sim : Audio driver add AUDIOIOC_GETLATENCY ioctl
add AUDIOIOC_GETLATENCY definition, and add reference code in sim alsa.

Signed-off-by: libei1 <libei1@xiaomi.com>
2023-07-04 13:48:58 +08:00
Beat Küng
cbbeec3183 ramtron.c: add FM25V02A-DGQ 2023-07-04 08:19:56 +08:00
Petro Karashchenko
cb2849b4ab Revert "tools: Fix CONFIG_BASE_DEFCONFIG generation"
This reverts commit bc4266fa48.
2023-07-03 19:18:32 -03:00
Petro Karashchenko
d7af2f4c0a tools/ci: remove 'brew update' needed for AVR toolchain installation on OSX
Remove 'brew update' introduced by https://github.com/apache/nuttx-testing/pull/88
as it seems to be not longer needed

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-03 19:16:19 -03:00
guoshichao
42f8308423 sched/clock/clock_getres: add two CPUTIME_ID res support
1. make the clock_getres can pass the
ltp/open_posix_testsuite/clock_getres 7-1, 8-1 two cases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-03 23:11:00 +03:00
Junbo Zheng
7c8adecca8 fs/mount: correct df -h output format
config: ./tools/configure.sh sim:nsh
correct before
```
nsh> df
  Block    Number
  Size     Blocks       Used   Available Mounted on
     0          0          0           0 /bin
    64          8          8           0 /etc
     0          0          0           0 /proc
   512        985          2         983 /tmp
nsh>
nsh> df -h
  Filesystem    Size      Used  Available Mounted on
  binfs      0B        0B         0B /bin
  romfs      512B      512B         0B /etc
  procfs     0B        0B         0B /proc
  vfat       492K        1K       491K /tmp
nsh>
```
correct after
```
nsh> df
  Block    Number
  Size     Blocks       Used   Available Mounted on
     0          0          0           0 /bin
    64          8          8           0 /etc
     0          0          0           0 /proc
   512        985          2         983 /tmp
nsh> df -h
  Filesystem      Size      Used  Available Mounted on
  binfs             0B        0B         0B /bin
  romfs           512B      512B         0B /etc
  procfs            0B        0B         0B /proc
  vfat            492K        1K       491K /tmp
nsh>
```

config: ./tools/configure.sh ../vendor/sim/boards/miwear/configs/miwear -j16
correct before
```
nsh>
nsh> df
  Block    Number
  Size     Blocks       Used   Available Mounted on
     0          0          0           0 /bin
  4096  240075962   87644775   152431187 /data
    64       3621       3621           0 /etc
  4096  240075962   87644775   152431187 /font
  4096  240075962   87644775   152431187 /i18n
     0          0          0           0 /proc
  4096  240075962   87644775   152431187 /resource/app
  4096  240075962   87644775   152431187 /resource/misc
  4096  240075962   87644775   152431187 /resource/recovery
  4096  240075962   87644775   152431187 /resource/system
  4096  240075962   87644775   152431187 /system
   512         26         24           2 /tmp
  4096  240075962   87644775   152431187 /vendor
  4096  240075962   87644775   152431187 /watchface
nsh>
nsh> df -h
  Filesystem    Size      Used  Available Mounted on
  binfs      0B        0B         0B /bin
  hostfs     915G      334G       581G /data
  romfs      226K      226K         0B /etc
  hostfs     915G      334G       581G /font
  hostfs     915G      334G       581G /i18n
  procfs     0B        0B         0B /proc
  hostfs     915G      334G       581G /resource/app
  hostfs     915G      334G       581G /resource/misc
  hostfs     915G      334G       581G /resource/recovery
  hostfs     915G      334G       581G /resource/system
  hostfs     915G      334G       581G /system
  tmpfs      13K       12K         1K /tmp
  hostfs     915G      334G       581G /vendor
  hostfs     915G      334G       581G /watchface
```
correct after
```
nsh>
nsh> date
Mon, Jul 03 02:09:53 2023
nsh>
nsh> df
  Block    Number
  Size     Blocks       Used   Available Mounted on
     0          0          0           0 /bin
  4096  240075962   87644776   152431186 /data
    64       3621       3621           0 /etc
  4096  240075962   87644776   152431186 /font
  4096  240075962   87644776   152431186 /i18n
     0          0          0           0 /proc
  4096  240075962   87644776   152431186 /resource/app
  4096  240075962   87644776   152431186 /resource/misc
  4096  240075962   87644776   152431186 /resource/recovery
  4096  240075962   87644776   152431186 /resource/system
  4096  240075962   87644776   152431186 /system
   512         26         24           2 /tmp
  4096  240075962   87644776   152431186 /vendor
  4096  240075962   87644776   152431186 /watchface
nsh>
nsh> df -h
  Filesystem      Size      Used  Available Mounted on
  binfs             0B        0B         0B /bin
  hostfs          915G      334G       581G /data
  romfs           226K      226K         0B /etc
  hostfs          915G      334G       581G /font
  hostfs          915G      334G       581G /i18n
  procfs            0B        0B         0B /proc
  hostfs          915G      334G       581G /resource/app
  hostfs          915G      334G       581G /resource/misc
  hostfs          915G      334G       581G /resource/recovery
  hostfs          915G      334G       581G /resource/system
  hostfs          915G      334G       581G /system
  tmpfs            13K       12K         1K /tmp
  hostfs          915G      334G       581G /vendor
  hostfs          915G      334G       581G /watchface
nsh>
```

Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2023-07-03 23:09:46 +03:00
tjwu1217
75d0312b4c sched/init/nx_start.c: Fix typo and format 2023-07-03 23:06:55 +03:00
simbit18
79db26bda3 drivers/sensors/apds9960.c: Fix mistakes in comments snerr
Fix mistakes in comments snerr
APDS9960_GCONFIG3 -> APDS9960_GCONFIG4
2023-07-03 23:05:36 +03:00
Michal Lenc
d470c3f268 samv7/sam_serial.c: reset all DMA pointers on DMA setup
This small fix ensures all DMA pointers are correctly reseted during
DMA setup (when the driver is opened). Without this there could be rare
occurrence of driver pointer to incorrect (invalidate) DMA buffer and thus
saving incorrect characters to upper layer.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-07-03 17:09:20 +03:00
Michal Lenc
49f153abb1 samv7/sam_xdmac.c: use sam_freelinklist only if circular buffer not used
Circular buffer does not use DMA linked list therefore function
sam_freelinklist() cannot be called as it would fail on assertion (csa
not defined). Peripheral that calls DMA should care of buffer invalidation
instead.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-07-03 17:09:20 +03:00
liuwei35
63ac8fbdfd sim/audio register mixer device
add amixer register code

Signed-off-by: liuwei35 <liuwei35@xiaomi.com>
2023-07-03 10:18:37 -03:00
zhanghongyu
27d6f1e0c4 documentation: correct the nfs command format
Change the command format to the actual one in the system

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-03 10:18:00 -03:00
Nicolas Caramelli
e82b762fb7 input/touchscreen: Translate raw X/Y data into pixel coordinates 2023-07-03 10:17:04 -03:00
qiaohaijiao1
de5c35382a sim/sim_alsa.c: add paused variable instead of snd_pcm_pause.
snd_pcm_hw_params_can_pause return false on sim.
add paused variable to support pause.

Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2023-07-03 13:51:09 +08:00
Zhe Weng
210c72a651 errno: Adjust help string for EALREADY and ESTALE
EALREADY:
Both Linux(asm-generic/errno.h) and FreeBSD(sys/sys/errno.h) regard it as "Operation already in progress"

ESTALE:
Linux specifically removed the "NFS" description, and we may not only use it for NFS
0ca4343518

The ECANCELED and EOWNERDEAD also use different strings from Linux's header, but their meanings are same, and NuttX's description are more likely to obey POSIX 1003.1-2008, so not changing them.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-07-03 13:38:02 +08:00
guoshichao
af53d7a178 libs/libc/aio/lio_listio: fix the heap use-after-free bug
1. the lio_sigsetup() method use a universal sighand instance across all
aiocb instances, but inside the lio_sighandler() method, if one aiocb is
handle finished, then this method will free the sighand instance that
come along with current aiocb instance. thus when handle next aiocb
instance, use-after-free crash will happen. in order to solve this
problem, we make each aiocb instance have their own sighand instance
2. make the lio_listio implementation can pass the
ltp/open_posix_testsuite/lio_listio testcases
3. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/lio_listio.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-03 13:37:34 +08:00
Petro Karashchenko
b1dd5d1189 drivers/wireles/gs2200m: add NET_TCP dependency to NFS_DONT_BIND_TCP_SOCKET option
The NFS_DONT_BIND_TCP_SOCKET should be selected only TCP networking is enabled

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-03 13:32:31 +08:00
wanggang26
57d521cc59 binfmt: Immediately exit from elf_loadbinary if elf format isn't supported 2023-07-03 00:52:16 +08:00
raiden00pl
76cf66165a arch/nrf91: simplyfy modem option names 2023-07-03 00:52:01 +08:00
raiden00pl
1a6d507422 arch/{nrf52|nrf53|nrf91}: rename NRFxx to nRFxx to be compatible with the manufacturer's nomenclature 2023-07-03 00:52:01 +08:00