Skip to content

Commit

Permalink
fs:add _POSIX_OPEN_MAX limit to files_extend
Browse files Browse the repository at this point in the history
Signed-off-by: 田昕 <[email protected]>

workqueue: add work_foreach support

Signed-off-by: ligd <[email protected]>

arch/risc-v: Rename up_fpuconfig to riscv_fpuconfig

Signed-off-by: Huang Qi <[email protected]>

arch/risc-v: Use riscv_fpuconfig to enable FPU

Use common function instead of chip specified code.

Signed-off-by: Huang Qi <[email protected]>

riscv/bl602: Implement SPI Cmd/Data

To control the Data/Command Pin on ST7789 SPI Display, the SPI Driver flips the MISO Pin as though it was a GPIO.

To implement this on BL602, we reconfigure MISO from SPI Pin to GPIO Pin on the fly inside `bl602_spi_cmddata()`.

When the SPI Port is deselected (after the SPI operation), we revert MISO back from GPIO Pin to SPI Pin. We implement this inside `bl602_spi_select()`.

[More Details Here](https://github.com/lupyuen/st7789-nuttx#spi-cmddata)

This change impacts 3 LCD drivers that call `SPI_CMDDATA()`: ST7735, ST7789, GC9A01.

Previously the BL602 SPI Driver would fail with "SPI cmddata not supported" when the above drivers are used.

After the change, the above drivers will set the LCD Data/Command Pin correctly.

We tested this implementation of SPI Cmd/Data with NuttX ST7789 Driver and a Logic Analyser on PineCone BL602:

-   [Testing with Logic Analyser](https://github.com/lupyuen/st7789-nuttx#spi-cmddata)

We also tested LVGL with ST7789 on PineCone BL602:

-   [Testing with LVGL](https://github.com/lupyuen/st7789-nuttx#run-lvgl-demo)

As for regular SPI Devices that don't require SPI Cmd/Data, we tested `CONFIG_SPI_CMDDATA=y` with Semtech SX1262 SPI Transceiver on PineCone BL602:

-   [Testing Cmd/Data](https://github.com/lupyuen/incubator-nuttx/releases/tag/release-2022-03-29)

arch/risc-v/litex: add cache_invalidate

driver/mmcsd: add option to support SD/MMC PHYs that only run in 4-bit mode

arch/risc-v/src/litex/litex_sdio: add litesdcard peripheral driver

See the following for details on the pepheral:
https://github.com/enjoy-digital/litesdcard

boards/risc-v/litex/arty_a7: add SDCARD support for the Arty_A7 board

boards/risc-v/litex/arty_a7: update README to include building in LITESDCARD peripheral

opendir: use inode_find() instead when opendir()

Signed-off-by: ligd <[email protected]>

arm/cortex-[a|r]: IRQ Switch return should with shadow SPSR

The SPSR is used to store the current value of the CPSR when an exception
is taken so that it can be restored after handling the exception.
Each exception handling mode can access its own SPSR.

User mode and System mode do not have an SPSR because they are not
exception handling modes.

Signed-off-by: chao.an <[email protected]>

signal: Don't do schedule_sigaction when there is no action

Signed-off-by: ligd <[email protected]>

task: don't set default signal in kernal thread

Signed-off-by: ligd <[email protected]>

riscv/bl602: Remove check for LCD driver

`bl602_spi_cmddata()` implements SPI Cmd/Data `SPI_CMDDATA()` for only 3 LCD drivers: ST7735, ST7789 and GC9A01.

This patch removes the check for LCD drivers, so that SPI Cmd/Data will work for all LCD drivers.

More details: https://github.com/apache/incubator-nuttx/pull/5898

This change impacts LCD drivers that call `SPI_CMDDATA()`.

Previously `SPI_CMDDATA()` would fail with `ENODEV` for LCD drivers other than ST7735, ST7789 and GC9A01.

After patching, `SPI_CMDDATA()` will work correctly with all LCD drivers.

We tested with LVGL and ST7789 on PineCone BL602:

-   [Testing with LVGL](https://github.com/lupyuen/st7789-nuttx#run-lvgl-demo)

As for regular SPI Devices that don't require SPI Cmd/Data, we tested `CONFIG_SPI_CMDDATA=y` with Semtech SX1262 SPI Transceiver on PineCone BL602:

-   [Testing Cmd/Data](https://github.com/lupyuen/incubator-nuttx/releases/tag/release-2022-03-30)

riscv/esp32c3: Remove check for LCD driver

`esp32c3_spi2_cmddata()` implements SPI Cmd/Data `SPI_CMDDATA()` for only 3 LCD drivers: ST7735, ST7789 and GC9A01.

This patch removes the check for LCD drivers, so that SPI Cmd/Data will work for all LCD drivers.

More details: https://github.com/apache/incubator-nuttx/pull/5898

This change impacts LCD drivers that call `SPI_CMDDATA()`.

Previously `SPI_CMDDATA()` would fail with `ENODEV` for LCD drivers other than ST7735, ST7789 and GC9A01.

After patching, `SPI_CMDDATA()` will work correctly with all LCD drivers.

This is a minor patch so no testing is needed.

xtensa: Move XCHAL_SWINT_CALL definition into syscall header

This is required to avoid the interface header (syscall.h) depending on
the xtensa_swi.h header from the implementation

Signed-off-by: Gustavo Henrique Nihei <[email protected]>

xtensa: Build OS-assisted atomic operations on ESP32-S2

ESP32-S2 lacks support for conditional load/store instructions.

Signed-off-by: Gustavo Henrique Nihei <[email protected]>

risc-v/esp32c3: Fix inclusion of C++ constructors/destructors table

RISC-V GCC is configured with --enable-initfini-array so it emits an
.init_array section instead of .ctors

Signed-off-by: Gustavo Henrique Nihei <[email protected]>

xtensa|risc-v: Make CXX exception and RTTI depend on Kconfig options

Signed-off-by: Gustavo Henrique Nihei <[email protected]>

libcxx: Add patch for preventing redefinition of PS macro on Xtensa

Signed-off-by: Gustavo Henrique Nihei <[email protected]>

libcxx: Fix libc++ for archs without conditional load/store support

This commit brings a patch already merged to upstream LLVM project:
https://reviews.llvm.org/D118391

Signed-off-by: Gustavo Henrique Nihei <[email protected]>

esp32[s2/s3/c3]: Add defconfigs for testing C++

Signed-off-by: Gustavo Henrique Nihei <[email protected]>

arch/arm: Make CXX exception and RTTI depend on Kconfig options

Signed-off-by: Gustavo Henrique Nihei <[email protected]>

documentation: Add release notes for 10.3.0 release

This is a local copy taken from the confluence notes
https://cwiki.apache.org/confluence/display/NUTTX/NuttX+10.3

Signed-off-by: Alin Jerpelea <[email protected]>

fs/romfs: fix bug about compare path with same prefix

Signed-off-by: Jiuzhu Dong <[email protected]>

boards/boardctl:common boardctl to read reset cause.

Signed-off-by: 田昕 <[email protected]>

rptun: set rptun thread default stack size to 4K

Signed-off-by: ligd <[email protected]>

rptun: add rptun_force_panic support

Signed-off-by: ligd <[email protected]>

rptun: add rptun_reset support

Signed-off-by: ligd <[email protected]>

rptun: use HPWORK instead of thread

Signed-off-by: ligd <[email protected]>

rptun: add rptun_panic for both master & salve

Signed-off-by: ligd <[email protected]>

rptun: add rpmsg_wait/post support for recursive dispatch

Signed-off-by: ligd <[email protected]>

rptun: divide shram to TX & RX

Signed-off-by: ligd <[email protected]>

rptun: add rptun dump support

Signed-off-by: ligd <[email protected]>

rptun: pm_stay when send msg & pm_relax when all tx buffer returned

Signed-off-by: ligd <[email protected]>

rptun: enable rx interrupts for virtq

use wait_tx_buffer method need enable rx interrupts

Signed-off-by: ligd <[email protected]>

rptun: add ping rpmsg support

Signed-off-by: ligd <[email protected]>

openamp: add openamp patches

0006-openamp-fix-scenario-case.patch
0007-openamp-divide-shram-to-TX-shram-RX-shram.patch
0008-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch

Signed-off-by: ligd <[email protected]>

rptun: forward panic/reset to lowerhalf

Signed-off-by: ligd <[email protected]>

remove DISCLAIMER-WIP

most licenses have been converted to Apache and the non Apache
licenses have been documented.
We can assume that now it should be the time to remove DISCLAIMER-WIP

Signed-off-by: Alin Jerpelea <[email protected]>

arch/risc-v/mpfs: Remove duplicated riscv_restorefpu

Signed-off-by: Huang Qi <[email protected]>

ioe_rpmsg: use rptun_wait/post to resolve deadlock with usrsock

Signed-off-by: ligd <[email protected]>

arch/risc-v: Store/Restore FPU register in exception_common

Signed-off-by: Huang Qi <[email protected]>

arch/risc-v: Rename up_doirq to riscv_doirq

Signed-off-by: Huang Qi <[email protected]>

arch/risc-v: Remove deprecated logic from riscv_doirq

Signed-off-by: Huang Qi <[email protected]>

arch/risc-v: Merge duplicated logic by riscv_doirq

Signed-off-by: Huang Qi <[email protected]>

arch/risc-v: Dont' disable/enable irq in riscv_doirq

Since these codes added to all chips but not fully tested,
so we should changd this behavior.

Signed-off-by: Huang Qi <[email protected]>

arch/risc-v: Remove unneeded group_addrenv call which handled by riscv_doirq

Signed-off-by: Huang Qi <[email protected]>

arch/risc-v: move REGLOAD/REGSTORE macro to riscv_internal.h

Signed-off-by: Petro Karashchenko <[email protected]>

arch/risc-v: include csr.h indirectly through nuttx/irq.h

Signed-off-by: Petro Karashchenko <[email protected]>

arch/risc-v: fix ARCH_RV32 offset for the stub lookup table calculation

Signed-off-by: Petro Karashchenko <[email protected]>

mm/mm_heap: place alloc-bit at the LSB of node->preceeding.

Heap always allocate the memory at least 2bytes alignment.

Signed-off-by: wangbowen6 <[email protected]>

mm_heap: heapsize align with MM_MIN_CHUNK.

Signed-off-by: wangbowen6 <[email protected]>

driver/syslog: Add microseconds after date time

Signed-off-by: Jiuzhu Dong <[email protected]>

ARCH_ADDRENV: Add guard against mis-configuration

When process a is switched to process b, the address environment is
swapped with a call to group_addrenv(). The stack upon entry will be
a's, and upon exit b's. This will fail, so a neutral stack is required,
either a kernel stack or an IRQ stack.

Infrastructure for an IRQ stack is already in place, so give a hint
that an interrupt stack should be provided if address environments
are enabled.

arch/risc-v: get wider visibility for arch instruction macros

Signed-off-by: Petro Karashchenko <[email protected]>

rpmsgfs: add wait ready to rpmsgfs

Signed-off-by: ligd <[email protected]>

rpmsgfs: add timeout when mount in rpmsgfs

Signed-off-by: ligd <[email protected]>

rpmsgfs: use rptun_wait/post to resolve deadlock with usrsock

Signed-off-by: ligd <[email protected]>

sigact: get free sigact from freelist always successful

Signed-off-by: Jiuzhu Dong <[email protected]>

netdev_file_ioctl: Fix fcntl F_SETFL O_NONBLOCK regression

This fixes a regression caused by the following commit,
which prevents the file flag from being updated.

```
commit 28860b5242dd5efd86b5da8a089e5d898cd8a9a1
Author: chao.an <[email protected]>
Date:   Sat Mar 19 14:47:37 2022 +0800

    net/netdev: fix switch case missing break

    Signed-off-by: chao.an <[email protected]>
```

Note: some applications like mbedtls uses F_GETFL to confirm
the nonblock-ness of the socket. This is critical for such
applications.

nuttx: Add "#include <nuttx/fs/ioctl.h>" to tioctl.h

Signed-off-by: zhouliang3 <[email protected]>

fs/unionfs: fix bug about use after free about ui

Signed-off-by: Jiuzhu Dong <[email protected]>

fs/unionfs: check return value to avoid unused value

Signed-off-by: Jiuzhu Dong <[email protected]>

fs/unionfs: add sanity check for parameter

if relpath is NULL, it will cause system crash:
unionfs_opendir with relpath NULL
    ->	unionfs_tryopendir
	    ->	unionfs_offsetpath
		->  strncmp(prefix, relpath, pfxlen

Signed-off-by: Jiuzhu Dong <[email protected]>

SEGGER_RTT: solve compile error when enable segger rtt in armv7m.

1. SEGGER_RTT_ASM_ARMv7M include SEGGER_RTT.h, and SEGGER_RTT.h
include SEGGER_RTT_Conf.h, so add __ASSEMBLY__ in
SEGGER_RTT_Conf.h;
2. AFLAG add segger/config because SEGGER_RTT_ASM_ARMv7M.S
include SEGGER_RTT_Conf.h;

Signed-off-by: wangbowen6 <[email protected]>

fs/procfstcbinfo: minor bug about print address

Signed-off-by: Jiuzhu Dong <[email protected]>

fs/romfs: fix string overflow when the length of rn_name exceeds NAME_MAX + 1

Signed-off-by: Jiuzhu Dong <[email protected]>

fs and unistd: increase OPEN_MAX by claiming a Kconfig.

Signed-off-by: 田昕 <[email protected]>

rpmsgfs: do NOT access the pointer when do remote ioctl

Signed-off-by: ligd <[email protected]>

fs/rpmsgfs: fix bug about using uninit variable "times"

Signed-off-by: Jiuzhu Dong <[email protected]>

arch/xtensa: add syscall note support in the flat build

Signed-off-by: chao.an <[email protected]>

sched/note: unify the data format

Signed-off-by: chao.an <[email protected]>

sched/trace: correct the note print format

note print should with Instruction pointer.

e.g:

        trace_printk("hello NuttX");

trace dump:

hello-6  [000] .... 23080.367994: 0xc044a005: hello NuttX

Signed-off-by: chao.an <[email protected]>

sched/note: add support of trace section mark

The implementation of this feature is based on android systrace:

https://source.android.com/devices/tech/debug/ftrace

Application developers are more concerned about the performance of
the specified application section,
added two APIs to implement performance measurement:

void sched_note_begin(uintptr_t ip, FAR const char *buf);
void sched_note_end(uintptr_t ip, FAR const char *buf);
or
SCHED_NOTE_BEGIN();  /* defined to sched_note_begin(_THIS_IP_, __FUNCTION__) */
SCHED_NOTE_END();    /* defined to sched_note_end(_THIS_IP_, __FUNCTION__) */

Signed-off-by: chao.an <[email protected]>

unistd:rename CONFIG_OPEN_MAX to CONFIG_LIBC_OPEN_MAX

Signed-off-by: 田昕 <[email protected]>

sim: Fix init of static C++ constructors when using glibc >= 2.34

glibc 2.34 changed the dynamic linker behavior during the startup
process, which makes the previous "__init_array_start" replacement trick
non-effective.
Now the dynamic linker parses the constructors/destructors information
from the DYNAMIC segment of the program.

Signed-off-by: Gustavo Henrique Nihei <[email protected]>

libs/libc/lib_err.c:add va_end to vwarn

call va_copy,after need call va_end
Signed-off-by: anjiahao <[email protected]>

local socket: cancel assert about backlog exceed 255

Signed-off-by: zhanghu6 <[email protected]>

net/local: change 255 to UINT8_MAX

Signed-off-by: Xiang Xiao <[email protected]>

power: unify lock states

unify critical_section and nxsem with pm_lock/pm_unlock

Signed-off-by: zhuyanlin <[email protected]>

power:driver: move pm_auto_update to outer dir

Pm_auto_update maybe called by outter PM users

Signed-off-by: zhuyanlin <[email protected]>

lib_chdir:use change ret judgment method

Signed-off-by: anjiahao <[email protected]>

modlib/modlib_bind:fix unsigned_compare with zero

Signed-off-by: anjiahao <[email protected]>

Update libs/libc/modlib/modlib_bind.c

u are right

Co-authored-by: Petro Karashchenko <[email protected]>

Update libs/libc/modlib/modlib_bind.c

Co-authored-by: Petro Karashchenko <[email protected]>

mmcsd: Add gotextcsd callback to sdio_dev_s

so the driver implementation could get critical EXTCSD info

Signed-off-by: anjianjun <[email protected]>

mmcsd: Move SDIO_GOTEXTCSD after SDIO_DMASENDSETUP

Signed-off-by: Xiang Xiao <[email protected]>

mmcsd: Fix mmc card error but system can not catch it

Signed-off-by: anjianjun <[email protected]>

risc-v/esp32c3: Fix regression on IRQ handling for ECALL instruction

Signed-off-by: Gustavo Henrique Nihei <[email protected]>

RISC-V: Implement option to run NuttX in supervisor mode (S-mode)

- Add config "ARCH_USE_S_MODE" which controls whether the kernel
  runs in M-mode or S-mode
- Add more MSTATUS and most of the SSTATUS register definitions
- Add more MIP flags for interrupt delegation
- Add handling of interrupts from S-mode
- Add handling of FPU from S-mode
- Add new context handling functions that are not dependent on the trap
  handlers / ecall

NOTE: S-mode requires a companion SW (SBI) which is not yet implemented,
      thus S-mode is not usable as is, yet.

RISC-V: Implement skeleton for a per CPU structure

It might be useful to store things in memory per CPU. The tricky part
is that all CPUs run the same code and see the same memory, so some
kind of centralized access is required.

For now, the structure contains the hart id.

Access to the structure elements is provided via sscratch, which is
unique for every hart!

Fix ESP32-C3 toolchain download link

arch/xtensa: Add xtensa_tcbinfo struct that contains helpful offsets.

Signed-off-by: Abdelatif Guettouche <[email protected]>

fix:Temporarily remove udp send large pkt assert

Signed-off-by: zhanghongyu <[email protected]>

net: tcp/udp/icmp/icmpv6 add FIONSPACE support

Signed-off-by: zhanghongyu <[email protected]>

timerexpiration:fix DEADCODE when RR_INTERVAL or SCHED_SPORADIC not select

tmp is always true for CONFIG_RR_INTERVAL > 0
and CONFIG_SCHED_SPORADIC not select

Signed-off-by: zhuyanlin <[email protected]>

arch/riscv: Align the macro definition in csr.h

Signed-off-by: Xiang Xiao <[email protected]>

arch/riscv: Rename riscv_syscall_dispatch to riscv_dispatch_syscall

follow other function naming(e.g. riscv_dispatch_irq)

Signed-off-by: Xiang Xiao <[email protected]>

arch/riscv: Remove riscv_sbi.c since it doesn't exist

Signed-off-by: Xiang Xiao <[email protected]>

arch/riscv: Rename riscv_exception_macros.S to riscv_macros.S

since macro defined in this file is also used in the normal context

Signed-off-by: Xiang Xiao <[email protected]>

arch/riscv: Access [m|s]scratch through CSR_SCRATCH macro

Signed-off-by: Xiang Xiao <[email protected]>

arch/riscv: Rename g_scratch to g_percpu

Signed-off-by: Xiang Xiao <[email protected]>

sched_note: fix buffer size warning in coverity

Signed-off-by: zhuyanlin <[email protected]>

mod_insmod: fix coverity warning

Signed-off-by: zhuyanlin <[email protected]>

stm32: add support for up_perf

boards/nucleo-f446re: initialize up_perf

note_sysview.c: fix compilation for CONFIG_TASK_NAME_SIZE == 0

note_sysview.c: fix compilation if CONFIG_SCHED_INSTRUMENTATION_FILTER not defined

arm/chip: add backtrace support for all chips that support thumb instruction set.

Signed-off-by: wangbowen6 <[email protected]>

usrsock: Move event field to usrsock_message_common_s

Signed-off-by: zhanghongyu <[email protected]>

net:fix coverity warning

Signed-off-by: hejianliang3 <[email protected]>

stm32u5: stm32_stdclockconfig fixes

Fix stm32_stdclockconfig for stm32u585xx to the extend that the
B-U585I-IOT02A board's clock tree can be configured.  This board uses
the MSIS as PLL1's input clock and the LSE to autotrim the MSIS.

b-u585i-iot02a: Fix stdclock initialization

Correct the respective defines to initialize the B-U585I-IOT02A clock
tree correctly by means of stm32_stdclockconfig().

b-u585i-iot02a:nsh: Drop TrustedFirmware-M dependency

Make the nsh defconfig for the b-u585i-iot02a run stand-alone (i.e. not
as a companion that relies on TF-M doing low-level board
initialization).

net/utils: fix IPv4 checksum calculation

Signed-off-by: Petro Karashchenko <[email protected]>

arch/risc-v: use STACK_FRAME_SIZE for in S-mode syscall asm

Signed-off-by: Petro Karashchenko <[email protected]>

arch/riscv: Rename SCRATCH_HARTID_OFFSET to RISCV_PERCPU_HARTID_OFFSET

and fix the typo error

Signed-off-by: Xiang Xiao <[email protected]>

modlib_bind.c: Restore "Relocation address out of range" checks

Restore the checks which got completely broken by the following change.
```
commit 15142a8b106bee8db6ac744b963969feba5c8289
Author: anjiahao <[email protected]>
Date:   Fri Apr 1 16:20:03 2022 +0800

    modlib/modlib_bind:fix unsigned_compare with zero

    Signed-off-by: anjiahao <[email protected]>
```

syscall: Fix Makefile:69: target 'syscall_names.o' given more than once in the same rule

Signed-off-by: Xiang Xiao <[email protected]>

libc/netdb: Support the recursive lock

Signed-off-by: Xiang Xiao <[email protected]>

libc/netdb: Remove the temporary unlock in dns_foreach_nameserver

since netdb support the recursive lock

Signed-off-by: Xiang Xiao <[email protected]>

libc/netdb: Hold dns lock when operating with resolv.conf

Signed-off-by: Xiang Xiao <[email protected]>

arch/xtensa: Build the xtensa_tcbinfo.c file for S2 and S3.

Signed-off-by: Abdelatif Guettouche <[email protected]>

nuttx: unify FAR attribute usage across the code

Signed-off-by: Petro Karashchenko <[email protected]>

RISC-V: Fix file name of riscv_dispatch_syscall

RISC-V: Fix usage of static_assert in riscv_percpu.c

There is no alias for struct riscv_percu_s

Update cpp_cmake.rst

update CMAKE_C_FLAGS when compile C file

Update cpp_cmake.rst

openamp: Change the dependence from OPENAMP to RPTUN

since all rpmsg driver need the extension api exposed by rptun driver

Signed-off-by: Xiang Xiao <[email protected]>

libc/string: Fix the minor style issue

Signed-off-by: Xiang Xiao <[email protected]>

libc: Avoid the compiler generate code call self(memcpy/memmove/memset/memcmp) recursively

please reference the similar change done by other libc implementation:
https://reviews.llvm.org/D68028?id=224286
https://github.com/bminor/glibc/commit/85c2e6110c9a01ec817c30f1b7e20549d7229987
https://github.com/bminor/musl/commit/4a1f55e92fa74ee382909baa96302231f566b5e1
https://github.com/bminor/newlib/commit/82dfae9ab0734b9946321590162dc6021057fec1

Signed-off-by: Xiang Xiao <[email protected]>

arch:tcbinfo: update tcbinfo as xcpcontext update

Signed-off-by: zhuyanlin <[email protected]>

jlink-nuttx: update regs as nuttx regs save path change

Signed-off-by: zhuyanlin <[email protected]>

include/nuttx: remove double definitions of UNUSED macro

Signed-off-by: Petro Karashchenko <[email protected]>

fix uinput rpmsg logic error

xtensa/esp32: Add support to TWAI/CANBus controller

esp32: Add board support to TWAI/CANBus

arch/sim: support simulator keyboard devices

arch/risc-v: Replace riscv_fault with riscv_exception

Remove riscv_fault since its code is duplicated with riscv_exception,
and there are textual excpetion reason in riscv_exception.

Signed-off-by: Huang Qi <[email protected]>

fs/epoll: change type of eventset from uint8_t to uint32_t

to support EPOLLONESHOT and so on.

Signed-off-by: Jiuzhu Dong <[email protected]>

fs/poll: change format for type pollevent_t

Signed-off-by: Jiuzhu Dong <[email protected]>

lib_lib_vsprintf/backtrace: fix the type issue

using 't': For integer types, causes printf to expect
a ptrdiff_t-sized integer argument.

Signed-off-by: Jiuzhu Dong <[email protected]>

fs/poll: change format for type pollevent_t

complete the following commits:

commit d87cf8d4ca5fe69c71c131015a7b64b68c917593
Author: Jiuzhu Dong <[email protected]>
Date:   Fri Apr 1 20:59:55 2022 +0800

    fs/poll: change format for type pollevent_t

    Signed-off-by: Jiuzhu Dong <[email protected]>

commit d535943a69f03033b077cb95cce162bb28b40b56
Author: Jiuzhu Dong <[email protected]>
Date:   Fri Apr 1 17:49:10 2022 +0800

    fs/epoll: change type of eventset from uint8_t to uint32_t

    to support EPOLLONESHOT and so on.

    Signed-off-by: Jiuzhu Dong <[email protected]>

Signed-off-by: chao.an <[email protected]>

arch/risc-v: Remove the unnecessary inclusion of board header files

Signed-off-by: Xiang Xiao <[email protected]>

MPFS: Prepare support for S-mode

- Access to PLIC via S-mode registers
- Access to IRQs via S-mode registers / definitions
- Initialize S-mode registers upon boot
- Initialize per CPU area before nx_start

NOTE: S-mode requires a companion SW (SBI) which is not yet implemented,
thus S-mode is not usable as is, yet.

esp32c3: Simplify irq dispatch logic

ESP32C3 use customized irq encoding so it's hard to share further code
with other risc-v based chips, in this patch, we keep the exception
number definition with risc-v spec.

Signed-off-by: Huang Qi <[email protected]>

Documentation/guides/pysimcoder.rst: update pysimCoder dependencies

CONFIG_LIBM option may be required by some toolchains that do not include
standard math library. Morover CONFIG_PTHREAD_STACK_MIN was listed twice
in the list.

Signed-off-by: Michal Lenc <[email protected]>

arch/riscv: Minor style change and text correction

Signed-off-by: Huang Qi <[email protected]>

sched/pthread:need check pthread is DETACHED

pthread_join need check thread is DETACHED,
Whether to wait according to the result.And,
if a thread is DETACHED,it will not set a new
attr.
Signed-off-by: anjiahao <[email protected]>

sched/note: add dummy definition if CONFIG_SCHED_INSTRUMENTATION disabled

Signed-off-by: chao.an <[email protected]>

sched/note: correct flatten format

Signed-off-by: chao.an <[email protected]>

arm/armv[7|8]-m: skip the fpu save/restore if stack frame is integer-only

Signed-off-by: chao.an <[email protected]>

fs/vfs: fix st_mode mask check

The full mask for st_mode is 0177777
Now modify any file permissions in hostfs and all will fail

arch/risc-v: Add handler for misaligned load/store

Some risc-v based chips don't support unaligned data access,
it will trigger a exception and then lead to crash.

In this patch, we handle the misaligned access by software to make
system run continue.

Signed-off-by: Huang Qi <[email protected]>

tools/checkrelease.sh: Don't check DISCLAIMER-WIP anymore

since all license is clean up now

Signed-off-by: Xiang Xiao <[email protected]>

sched/wqueue: Simplify CALL_WORKER dispatch condition

Signed-off-by: Xiang Xiao <[email protected]>

sched/irq: Remove CONFIG_SCHED_IRQMONITOR when define CALL_VECTOR

since up_perf_ API doesn't couple with CONFIG_SCHED_IRQMONITOR

Signed-off-by: Xiang Xiao <[email protected]>

sched/irq: Fix array overrun in coverity check

Signed-off-by: Xiang Xiao <[email protected]>

boards/nucleo-h743zi2: Enable up_perf API

Signed-off-by: Xiang Xiao <[email protected]>

boards/lx_cpu: Enable up_perf API

Signed-off-by: Xiang Xiao <[email protected]>

arch/risc-v: Align prototype of riscv_exception with xcpt_t

Thus we can attach it to irq handler without any cast.

Signed-off-by: Huang Qi <[email protected]>

arch/risc-v: Attach exception handler in common place

Signed-off-by: Huang Qi <[email protected]>

arch/risc-v: Move epc adjustment to riscv_doirq

Signed-off-by: Huang Qi <[email protected]>

checkpatch.sh: add -m option to enable/disable Change-Id check

Defaultly disable Change-Id check in commit message.

Signed-off-by: liuhaitao <[email protected]>

.github/workflows/check.yml: Enable Change-ID check explicitly

Signed-off-by: Xiang Xiao <[email protected]>

Make top Make.defs symlink to board Make.defs instead

Symlink to board Make.defs for top Make.defs, so top Make.defs
syncs in realtime.

Signed-off-by: liuhaitao <[email protected]>

riscv/riscv_exception_commin.S: Don't call riscv_hartid in single core
mode.

Signed-off-by: Abdelatif Guettouche <[email protected]>

riscv/riscv_exception_common.S: Allow chips to define the exception
section.

Signed-off-by: Abdelatif Guettouche <[email protected]>

riscv/esp32c3: Use the common exception handler.

Signed-off-by: Abdelatif Guettouche <[email protected]>

riscv/bl602/chip.h: Add assembly guards for standard includes.

tools/mkdeps: Extend MAX_SHQUOTE to 3072

Signed-off-by: nietingting <[email protected]>

audio: Return audio_lowerhalf_s pointer instead error code in audio_comp_initialize

audio: Don't register audio device if name isn't given in audio_comp_initialize

Signed-off-by: Xiang Xiao <[email protected]>

Fixes some issues with the implementation of the balance
functionality. In function "wm8904_hw_reset" the priv->balance
is initialized with b16HALF, indicating a range from
0 to b16ONE. In function "wm8904_setvolume" the assumed
range for priv->balance is between 0 and 1000. The changes
now make this consistent for 0 to b16ONE-1. Furthermore,
in wm8904_configure the change of balance was not implemented.

Minor fix, function name was wm8994_setvolume instead of
wm8904_setvolume.

Fixed source code format errors.

Revert "mm_heap: heapsize align with MM_MIN_CHUNK."

This reverts commit 69e69740b5f578e035befc762538b282d91ed1ba.

mm_initialize: malloc() return aligend pointer.

malloc() should return aligned (with MM_MIN_CHUNK) pointer, but
pr #5906 destroy that, this pr find a better method to solve
these questions.

Signed-off-by: YAMAMOTO Takashi <[email protected]>
and
Signed-off-by: wangbowen6 <[email protected]>

arch/riscv: Add mtimer driver

Signed-off-by: Xiang Xiao <[email protected]>

sched/note: include-able from C++ files

Signed-off-by: chao.an <[email protected]>

drivers/sensors: Add new driver for scd41 sensor module

Add Sensirion's SCD41 CO2, temperature and humidity sensor driver.

drivers/sensors/scd30: Fix invalid parameter check

Fix invalid parameter check and redundant conditions.

drivers/sensors/sgp30: Fix redundant parameter check

Fix redundant conditions.

littelfs: deal with block devices w/o ioctl

Note: Some block devices has ioctl == NULL. eg. drivers/loop

netdb/lib_dnsaddserver.c: Do not insert the duplicate DNS address

Signed-off-by: songlinzhang <[email protected]>

graphics/nxterm: Avoid accessing freed memory

Fix accessing freed priv data.

drivers/syslog: update description if Kconfig

Signed-off-by: Petro Karashchenko <[email protected]>

libc/lib_localtime:fix deadcode

isdst always is false

Signed-off-by: anjiahao <[email protected]>

RISC-V: Combine 3 variables that depend on CPU amount into one

IRQ_NSTACKS, ARCH_CPU_COUNT, CONFIG_SMP_NCPUS all relate to each
other. However, a bit of clean up can be done and everything can
be merged into SMP_NCPUS.

The MPFS bootloader case works also as it requires only 1 IRQ stack
for the hart that executes as bootloader.

RISC-V: Remove riscv_cpuindex.c from platforms that don't need it

riscv_mhartid is no longer called by exception_common, so can remove
this file from platforms that don't need it.

Also fixes make warning:
Makefile:123: target 'riscv_cpuindex.o' given more than once in the same rule

RISC-V: Add setintstack for k210 and qemu

This fixes CI issue, and I think the old implementation with SMP
shared 1 IRQ stack for multiple CPUs.

sched/init: drivers_initialize() should be late than up_initialize()

up_initialize
|
 ->up_serialinit
   |
    ->uart_register  /* ("/dev/console", &CONSOLE_DEV); */

drivers_initialize
|
 ->syslog_console_init
   |
    ->register_driver /* ("/dev/console", &g_consoleops, 0666, NULL); */

Signed-off-by: chao.an <[email protected]>

arch: cxd56xx: update loader and gnssfw version

Update loader and gnssfw to version 2.2.20585

cxd56xx/cxd56_emmc.c: Fix compile warning

Add necessary include header named debug.h for using ferr and
finfo.

arch: cxd56xx: Fix critical section in scu driver

Add critical section to scu one-shot sequencer.

boards: cxd56xx: Fix an issue i2c tool not working

It caused i2c tool not to work due to i2c uninitializing processing.
Since this process is not necessary in the normal case, we will
move it to the error case.

boards: cxd56xx: Make board_late_initialize a weak function

Add a weak_function to the board_late_initialize function so that
it can be replaced by another file, such as a user application.

board/spresense: Add pin selection of ILI934x

Add Kconfig choice for selecting RST and DC pins on ILI934x LCD.

boards: cxd56xx: Add board function for scd41 sensor driver

Add board function for SCD41 CO2, temperature and humidity sensor driver.

cxd56/spresense: Add callback mechanism to notice SDCard injection

Add a mechanism to callback to an application to notice the SDCard
status is changed (inserted or ejected).

.github/gcc.json: Fix space/tab inconsistency

sim: bt: Add specific bluetooth HCI number id

Add option for attached the local bluetooth device use
specific bluetooth HCI number id.

Signed-off-by: Lingao Meng <[email protected]>

lib_localtime:fix unsigned compare with zero

Signed-off-by: anjiahao <[email protected]>

arch/risc-v: Apply common mtime driver to mtime based chps

Signed-off-by: Huang Qi <[email protected]>

risc-v/c906: fix build break

chip/c906_timerisr.c: In function 'up_timer_initialize':
Error: chip/c906_timerisr.c:71:3: error: implicit declaration of function 'DEBUGASSERT' [-Werror=implicit-function-declaration]
   DEBUGASSERT(lower);
   ^~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: chao.an <[email protected]>

libc/lib_glob:use strlcpy instead of memcpy

Signed-off-by: anjiahao <[email protected]>

libc/net:use strlcpy instead of strncpy

Signed-off-by: anjiahao <[email protected]>

arch/risc-v: Add missing DMB to mtimer / setmtimecmp

The memory mapped mtimecmp lives in I/O space so must add barrier
to make sure the value sticks. Otherwise a new IRQ might fire
at once.

arch/risc-v: Apply misaligned access handler for k210/bl602

Signed-off-by: Huang Qi <[email protected]>

arch/riscv: Move toolchain config to arch/risc-v/Kconfig like xtensa

Signed-off-by: Xiang Xiao <[email protected]>

riscv/riscv_schedulesigaction.c: Remove the duplicate state saving.

Signed-off-by: Abdelatif Guettouche <[email protected]>

arch/arm: Move FPU initialization to common place

Signed-off-by: Xiang Xiao <[email protected]>

arch/stack_color: correct the end address of stack color

The different optimization of compilers will cause ambiguity in
obtaining sp through up_getsp() in arm_stack_color(), if compile
with clang and enable the optimization flag (-Ofast), up_getsp()
call will be earlier than push {r0-r9,lr}, the end address of color
stack will overlap with saved registers.

Compile line:
clang --target=arm-none-eabi -c "-Ofast" -fno-builtin -march=armv8.1-m.main+mve.fp+fp.dp \
-mtune=cortex-m55 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -D__NuttX__ -common/arm_checkstack.c -o  arm_checkstack.o

Assembler code:
llvm-objdump -aS arm_checkstack.o
------------------------------------
|00000000 <arm_stack_color>:
|;   start = INT32_ALIGN_UP((uintptr_t)stackbase);
|       0: c2 1c         adds  r2, r0, #3
|       2: 22 f0 03 02   bic r2, r2, #3
|;   end   = nbytes ? INT32_ALIGN_DOWN((uintptr_t)stackbase + nbytes) :
|       6: 19 b1         cbz r1, 0x10 <arm_stack_color+0x10> @ imm = #6
|       8: 08 44         add r0, r1
|       a: 20 f0 03 00   bic r0, r0, #3
|       e: 00 e0         b 0x12 <arm_stack_color+0x12> @ imm = #0
|;   __asm__
|      10: 68 46         mov r0, sp                               <--- fetch the sp before push {r7 lr}
|      12: 80 b5         push  {r7, lr}                           <--- sp changed
|;   nwords = (end - start) >> 2;
|      14: 80 1a         subs  r0, r0, r2
|      16: 80 08         lsrs  r0, r0, #2
|; }
|      18: 08 bf         it  eq
|      1a: 80 bd         popeq {r7, pc}
|      1c: 4b f6 ef 63   movw  r3, #48879
|      20: cd f6 ad 63   movt  r3, #57005
|      24: a0 ee 10 3b   vdup.32 q0, r3
|;   while (nwords-- > 0)
|      28: 20 f0 01 e0   dlstp.32  lr, r0
|;       *ptr++ = STACK_COLOR;                                    <--- overwrite
|      2c: a2 ec 04 1f   vstrw.32  q0, [r2], #16
|      30: 1f f0 05 c0   letp  lr, 0x2c <arm_stack_color+0x2c> @ imm = #-8
|; }
|      34: 80 bd         pop {r7, pc}
------------------------------------

Signed-off-by: chao.an <[email protected]>

arm/armv8-m: indicating no low-overhead-loop predication by default

Fix usage fault on clang version 13.0.0 (-Ofast):
------------------------------------------------------------------
| arm_hardfault: Hard Fault escalation:
| arm_usagefault: PANIC!!! Usage Fault:
| arm_usagefault:  IRQ: 3 regs: 0x3c58c510
| arm_usagefault:  BASEPRI: 00000080 PRIMASK: 00000000 IPSR: 00000003 CONTROL: 00000004
| arm_usagefault:  CFSR: 00020000 HFSR: 40000000 DFSR: 00000000 BFAR: 01608050 AFSR: 00000000
| arm_usagefault: Usage Fault Reason:
| arm_usagefault:  Invalid state
| up_assert: Assertion failed at file:armv8-m/arm_usagefault.c line: 113 task: lpwork
| backtrace:
| [ 2] [<0x2c58124a>] up_backtrace+0xa/0x2e2
| [ 2] [<0x2c56f7cc>] sched_dumpstack+0x28/0x66
| [ 2] [<0x2c580cd0>] up_assert+0x62/0x254
| [ 2] [<0x2c56ab8a>] _assert+0/0xa
| [ 2] [<0x2c55575a>] nxsched_add_prioritized+0x38/0xa2
| [ 2] [<0x2c555894>] nxsched_add_blocked+0x2e/0x44
| [ 2] [<0x2c580748>] up_block_task+0x2a/0x96
| [ 2] [<0x2c5569ea>] nxsem_wait+0x64/0xb4
| [ 2] [<0x2c556a40>] nxsem_wait_uninterruptible+0x6/0x10
| [ 2] [<0x2c559b9a>] work_thread+0x1c/0x48
-------------------------------------------------------------------

usage fault on 0x2c55575a:

------------------------------------
|2c555722 <nxsched_add_prioritized>:
|; {
|2c555722: 80 b5         push  {r7, lr}
|...
|2c55575a: 2f f0 17 c0   le  0x2c555732 <nxsched_add_prioritized+0x10> @ imm = #-44
|...
------------------------------------

Arm v8-M Architecture Reference Manual:

C2.4.103 LE, LETP

B3.28 Low overhead loops:

An INVSTATE UsageFault is raised if a LE instruction is executed and FPSCR.LTPSIZE does not read as four.
When a new floating-point context is created and FPCCR.ASPEN is set to zero it is the responsibility of software
to correctly initialize FPSCR.LTPSIZE.

Signed-off-by: chao.an <[email protected]>

fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode

Signed-off-by: Jukka Laitinen <[email protected]>

libc/time: add strptime porting support

lib_strptime.c copies from android bionic/libc/tzcode.

Signed-off-by: liuhaitao <[email protected]>
Signed-off-by: anjiahao <[email protected]>

libc/strptime:_conv_num skip space

Signed-off-by: anjiahao <[email protected]>

libc/strptime: fix warning unused-value

warning: value computed is not used [-Wunused-value]
Signed-off-by: Xiang Xiao <[email protected]>
Signed-off-by: anjiahao <[email protected]>

libc/lib_strptime:change code format & add notes

Signed-off-by: anjiahao <[email protected]>

RISC-V: Move mhartid to own assembly macro+function

Hartid and cpuindex are not the same thing. Hartid is needed regardless
of SMP, for external interrupt handling etc.

SMP needs cpuindex which might not be index == hartid, so both are
needed. IMO it is clearer to provide separate API for both.

Currently the implementation of up_cpu_index is done a bit lazily,
because it assumes hartid == cpu index, but this is not 100% accurate,
so it is still missing some logic.

arch/risc-v/riscv_misaligned: Correct sw source register

If source register of sw instruction is x0, we must point it to a constant zero
since in NuttX's context,
value of index 0 is EPC.

Signed-off-by: Huang Qi <[email protected]>

arch/risc-v: Correct format of 32-bit insn in misaligned handler

FIx:
Format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int')

Signed-off-by: Huang Qi <[email protected]>

power/governor: Remove the duplicated function prototype

since they are declared include/nuttx/power/pm.h by:
commit 5ce181e6b702cedbd79790fbe40aab7d29dae7c0
Author: zhuyanlin <[email protected]>
Date:   Mon Feb 14 15:32:40 2022 +0800

    power:govorner: add govorner to per domain.

    For mult domains scene,,
    activity and greety can be used at same time.
    Let user to select domain governor.

    Signed-off-by: zhuyanlin <[email protected]>

and add static const to g_pmgovernor

Signed-off-by: zhuyanlin <[email protected]>

drivers/power: Remove activity_governor.h and greedy_governor.h

since they aren't really used anymore

Signed-off-by: Xiang Xiao <[email protected]>

MPFS: Fix mtimecmp address

MTIMECMP0 was incorrect

MPFS: Use riscv_exception_attach like the others do

Exception / fault handling goes to unexpected ISR, fix by setting the
common ISR handlers like all other RISC-V platforms do.

arch: Fix compile error when enabling CONFIG_DUMP_ON_EXIT

"error: incompatible types when assigning to type 'struct filelist *' from type 'struct filelist'
   filelist = tcb->group->tg_filelist;"

Signed-off-by: Abdelatif Guettouche <[email protected]>

arch: Move the DUMP_ON_EXIT logic after nxtask_exit.

Otherwise we will try to dump the state of the current task, however the
exit handler has already started doing some cleanup and invalidated its
group.  Accessing the group from dumponexit will crash.

Signed-off-by: Abdelatif Guettouche <[email protected]>

arch/Kconfig: Move the DUMP_ON_EXIT option out of the Bring-up group.

Signed-off-by: Abdelatif Guettouche <[email protected]>

sched/pthread_create:fix bug,delete data_sem

if a pthread set attr is detach,and when call pthread_create,
new thread exit quikly,new thread's tcb be free,then pthread_create
use new thread's tcb will crash.
Signed-off-by: anjiahao <[email protected]>

rpmsg_usrsock: Support the wireless ioctl which contain pointer 1/2

Signed-off-by: zhanghongyu <[email protected]>

fix: usrsock iovec_do skip empty iov

Signed-off-by: zhanghongyu <[email protected]>

sched/environ: Ensure tg_envp terminated by double '\0'

so we can compute the whole environ string length from it

Signed-off-by: Xiang Xiao <[email protected]>

RISC-V: Add SBI glue logic

Currently only stubs for mtime handling added, with a gentle reminder
that the actual implementation is still missing.

RISC-V: mtimer register via SBI when S-mode is in use

Cannot access the memory mapped registers directly when the kernel
runs in S-mode, must forward the access to SBI.

arch/[arm|sparc]: replace INT32_ALIGN_* to STACK_ALIGN_*

Signed-off-by: chao.an <[email protected]>

arch/stack_color: correct the stack top of running task

This PR to ensure the stack pointer is locate to the stack top

Signed-off-by: chao.an <[email protected]>

arm/rtl8720c: Remove up_getsp which is already implemented in arch/arm/arch.h

Signed-off-by: Xiang Xiao <[email protected]>

MPFS: Set correct interrupt per mode (M-/S-mode) for mtimer

libc/string: Use Byte-Shift algorithm for very long needles

Reference here:
https://github.com/taleinat/byteshift_strstr

Signed-off-by: chao.an <[email protected]>
Signed-off-by: anjiahao <[email protected]>

libc/string:delete small to big endian marco

avoid byte alignment
Signed-off-by: haopengxiang <[email protected]>
Signed-off-by: anjiahao <[email protected]>

libc/string:add LICENSE info

Signed-off-by: anjiahao <[email protected]>

Add SPIRAM to ESP32-S2

driver/mmcsdio: do not hold the semaphore on interrupt context

so we can do the full dump to mmc/sd card in the panic case

Signed-off-by: chao.an <[email protected]>

driver/mmcsdio: do not hold the semaphore in idle thread too

Signed-off-by: Xiang Xiao <[email protected]>

fs/fcntl: add O_APPEND flag judge in fcntl

Signed-off-by: liuhaitao <[email protected]>

vfs/fcntl: Minor style fix

Signed-off-by: Xiang Xiao <[email protected]>

arm/armv7-[a|r]: move fpu save/restore to assembly handler

Save/Restore FPU registers in C environment is dangerous practive,
which cannot guarantee the compiler won't generate the assembly code
with float point registers, especially in interrupt handling

Signed-off-by: chao.an <[email protected]>

arch/arm/src/sam34/sam_hsmci.c: delay required after sending command

arch/arm/src/sam34/sam_hsmci.c: DMA setup before write is required

arch/arm/src/sam34/sam_hsmci: DMA also present on SAM3X chips

arch/arm/src/sam34/sam_hsmci.c: SAM3X GPIO setup

arch/arm/src/sam34/Kconfig: fix typo in device name

boards/arm/a1x: Remove the check CONFIG_ARCH_FPU around arm_fpuconfig

forget in below change:
commit df5a8a53ae92606e2d65149c6b5159b82dfc5d76
Author: Xiang Xiao <[email protected]>
Date:   Tue Apr 12 03:18:46 2022 +0800

    arch/arm: Move FPU initialization to common place

    Signed-off-by: Xiang Xiao <[email protected]>

Signed-off-by: Xiang Xiao <[email protected]>

boards/esp32_twai: Remove arm_arch.h from comment

Signed-off-by: Xiang Xiao <[email protected]>

drivers: remove unimplemented open/close/ioctl interfaces

Signed-off-by: Petro Karashchenko <[email protected]>

arch/risc-v: Use fs status definition from csr.h

Signed-off-by: Huang Qi <[email protected]>

arch/riscv/esp32c3: esp32c3_twai.h TWAI (CAN) controller registers provided by Espressif.

File provided by Abdelatif Guettouche

Signed-off-by: Jan Charvat <[email protected]>

arch/riscv/esp32c3: ESP32C3 TWAI (CAN) controller driver.

Signed-off-by: Jan Charvat <[email protected]>

arch/riscv/esp32c3: ESP32C3 TWAI (CAN) controller included into Kconfig.

Signed-off-by: Jan Charvat <[email protected]>

boards/risc-v/esp32c3: ESP32C3 TWAI (CAN) controller bringup for DevKitM-1.

Signed-off-by: Jan Charvat <[email protected]>

boards/risc-v/esp32c3: ESP32C3 TWAI (CAN) controller config for DevKitM-1.

Signed-off-by: Jan Charvat <[email protected]>

Fixed a compile error, presumably caused by C&P error.

arch/armv[7|8]m: enhance the clang support

Signed-off-by: chao.an <[email protected]>

arch/Toolchain.defs: replace all ${/$} with $(/$)

Signed-off-by: chao.an <[email protected]>

semaphore: fix usage of NXSEM_INITIALIZER

Signed-off-by: Petro Karashchenko <[email protected]>

arch/xtensa: Remove FAR from chip and board folder

Signed-off-by: Xiang Xiao <[email protected]>

arch/ceva: Remove FAR from chip folder

Signed-off-by: Xiang Xiao <[email protected]>

arch/sim: Remove FAR from chip and board folder

Signed-off-by: Xiang Xiao <[email protected]>

arch/x86_64: Remove FAR from chip folder

Signed-off-by: Xiang Xiao <[email protected]>

arch/or1k: Remove FAR from chip folder

Signed-off-by: Xiang Xiao <[email protected]>

arch/misoc: Remove FAR from chip folder

Signed-off-by: Xiang Xiao <[email protected]>

arch/mips: Remove FAR from chip and board folder

Signed-off-by: Xiang Xiao <[email protected]>

arch/sparc: Remove FAR from chip and board folder

Signed-off-by: Xiang Xiao <[email protected]>

arm/arch: using __builtin_frame_address(0) implement up_getsp().

Signed-off-by: wangbowen6 <[email protected]>

arch/arm: Move arm_signal_dispatch.c to common folder

Signed-off-by: Xiang Xiao <[email protected]>

Remove the unneeded worker_t cast

Signed-off-by: Xiang Xiao <[email protected]>

Remove the unneeded void cast

Signed-off-by: Xiang Xiao <[email protected]>

arm/a1x: fix compile break

Signed-off-by: chao.an <[email protected]>

wireless/80211: update the 80211 header

Upstream from:
https://github.com/freebsd/freebsd-src/blob/main/sys/net80211/ieee80211.h

Signed-off-by: chao.an <[email protected]>

sched/environ: Refine the environment variables storage layout

to confirm the standard and then implement get_environ_ptr correctly

Signed-off-by: Xiang Xiao <[email protected]>

libc: Don't duplicate string in chdir and lib_restoredir

since the new layout doesn't reallocate the unchanged environ variable anymore

Signed-off-by: Xiang Xiao <[email protected]>

tools/cibuild.sh: Migrate risc-v toolchian from 8.3.0 to 10.2.0

Signed-off-by: Xiang Xiao <[email protected]>

tools/cibuild.sh: Download risc-v toolchain with --no-check-certificate

untils SiFive update their certification

Signed-off-by: Xiang Xiao <[email protected]>

arch/arm: export arm_saveusercontext()

rename arm_saveusercontext() -> up_arm_saveusercontext()

Signed-off-by: chao.an <[email protected]>

boards/ostest: remove board ostest implement

Signed-off-by: chao.an <[email protected]>

board/arch_fpu*: move arch_[get|cmp]fpu to common arch

rename the arch api:
arch_getfpu  -> up_saveusercontext
arch_cmpfpu  -> up_cmpfpu

Signed-off-by: chao.an <[email protected]>

arch/mips: Remove unneeded group_addrenv call which handled by mips_doirq

Signed-off-by: Xiang Xiao <[email protected]>

arch/misoc: Remove unneeded group_addrenv call which handled by [lm32|minerva]_doirq

Signed-off-by: Xiang Xiao <[email protected]>

arch/xtensa: Remove unneeded group_addrenv call which handled by xtensa_irq_dispatch

Signed-off-by: Xiang Xiao <[email protected]>

arch/sparc: Remove unneeded group_addrenv call which handled by up_doirq

Signed-off-by: Xiang Xiao <[email protected]>

libc/blockstream: add block out stream backend

Signed-off-by: chao.an <[email protected]>

libc/blkoutstream: Minor style fix

Signed-off-by: Xiang Xiao <[email protected]>

arch/arm: Remove unneeded group_addrenv call which handled by arm_doirq

Signed-off-by: Xiang Xiao <[email protected]>

arch/risc-v: Remove FAR from chip and board folder

Signed-off-by: Xiang Xiao <[email protected]>

arch/arm: Remove FAR and CODE from common/ and arm*/ folder

Signed-off-by: Xiang Xiao <[email protected]>

Revert "tools/cibuild.sh: Download risc-v toolchain with --no-check-certificate"

This reverts commit 3b97e37b525d50d8a78765f85276f900129dade5.

arch/arm: Remove all lazy fpu related code

since it is broken and inefficient, and then removed by:
commit dc961baaea17107109d94575e9bb5d9fb725b801
Author: chao.an <[email protected]>
Date:   Thu Apr 14 18:07:14 2022 +0800

    arm/armv7-[a|r]: move fpu save/restore to assembly handler

    Save/Restore FPU registers in C environment is dangerous practive,
    which cannot guarantee the compiler won't generate the assembly code
    with float point registers, especially in interrupt handling

    Signed-off-by: chao.an <[email protected]>

commit 8d66dbc0680cb81f91674ace814b2b8a94c49cd2
Author: chao.an <[email protected]>
Date:   Thu Apr 7 13:48:04 2022 +0800

    arm/armv[7|8]-m: skip the fpu save/restore if stack frame is integer-only

    Signed-off-by: chao.an <[email protected]>

Signed-off-by: Xiang Xiao <[email protected]>

arch/armv[7|8]-m: Compare all FPU registers in up_fpucmp

Signed-off-by: Xiang Xiao <[email protected]>

arch/armv7-[a|r]: correct the handing of group env switch

This PR resolved 2 issues:
1. CURRENT_REGS is not set correctly on swint handling
2. group env is not changed properly

Signed-off-by: chao.an <[email protected]>

fs:oflag need consistent with psock

if don't consistent with psock,call fcntl will have differet flag
Signed-off-by: anjiahao <[email protected]>

arm/arm_assert.c Fix dumping of status from ISR

The status dump did not work if the first fault triggers before
the first context switch (during nx_start()).

risc-v/riscv_assert.c Fix dumping of status from ISR

The status dump did not work if the first fault triggers before
the first context switch (during nx_start()).

fs:fs_getfilep changes fd judgment method

if a fd was closed,need return EBADF
Signed-off-by: anjiahao <[email protected]>

arch/armv8-m: Unify the toolchain definition of eabi/clang for linux and windows

Signed-off-by: chao.an <[email protected]>

arch/armv7-m: Unify the toolchain definition of eabi/clang/iar for linux and windows

Signed-off-by: chao.an <[email protected]>

arch/arm/armv6-m: Unify the toolchain definition of eabi for linux and windows

Signed-off-by: chao.an <[email protected]>

arch/armv7-a/r: Unify the toolchain definition of eabi for linux and windows

Signed-off-by: chao.an <[email protected]>

arch/risc-v: Unify the toolchain definition of RVG for linux and windows

Signed-off-by: chao.an <[email protected]>

arch/misoc: Unify the toolchain definition of GNU for linux and windows

Signed-off-by: chao.an <[email protected]>

arch/z80: Unify the toolchain definition of SDCC for linux and windows

Signed-off-by: chao.an <[email protected]>

armv7/r:cp15_cache_all: fix error in LineSize 'r5' mask

r5 = r3 & r1

Signed-off-by: zhuyanlin <[email protected]>

arch/sparc,xtensa: Control output by $(Q) as other arch

Signed-off-by: Huang Qi <[email protected]>

LICENSE: document missing armv7-x files

add missing armv7-a/armv7-r files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing lpc files

add missing lpc files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing samdxxx files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing am335x files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

arch: arm: cxd56xx: Add Apache license to files

In the initial contribution those files were missing the license

Signed-off-by: Alin Jerpelea <[email protected]>

arch: arm: imxrt: Add Apache license to files

In the initial contribution those files were missing the license

Signed-off-by: Alin Jerpelea <[email protected]>

arch: arm: lpc43xx: Add Apache license to files

In the initial contribution those files were missing the license

Signed-off-by: Alin Jerpelea <[email protected]>

arch: arm: phy62xx: Add Apache license to files

In the initial contribution those files were missing the license

Signed-off-by: Alin Jerpelea <[email protected]>

arch: arm: stm32l4: remove empty files

during contribution empty files have been pushed.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing tiva files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

arch: arm: mor1kx: remove empty files

during contribution empty files have been pushed.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing mor1k files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

arch: arm: sama5: Add Apache license to files

In the initial contribution those files were missing the license

Signed-off-by: Alin Jerpelea <[email protected]>

arch: arm: stm32: Add Apache license to files

In the initial contribution those files were missing the license

Signed-off-by: Alin Jerpelea <[email protected]>

boards: sim: Add Apache license to files

In the initial contribution those files were missing the license

Signed-off-by: Alin Jerpelea <[email protected]>

drivers: leds: ncp5623c: migrate the license to Apache

Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing mtd files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

drivers: mtd: gd5f: migrate the license to Apache

Xiaomi has submitted the SGA
as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <[email protected]>

drivers: sensors: mlx90614: migrate the license to Apache

Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing bcm43xxx files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing nfs files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

include: himem: Add Apache license to files

In the initial contribution those files were missing the license

Signed-off-by: Alin Jerpelea <[email protected]>

include: leds: ncp5623c: migrate the license to Apache

Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing uIP files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing bluetooth files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

include: wireless: bluetooth: migrate the license to Apache

Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing sixlowpan files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing igmp files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing wireless files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

LICENSE: document missing libc files

add missing files to the LICENSE file.

Signed-off-by: Alin Jerpelea <[email protected]>

arch/risc-v: Change riscv_savefpu/riscv_loadfpu to macro

Signed-off-by: Huang Qi <[email protected]>

arch/armv6-m: add support of LLVM Clang

Signed-off-by: chao.an <[email protected]>

arch/clang: add support for Clang LTO

add support of Clang's Link Time Optimization (LTO) on NuttX build system

Reference:
https://gcc.gnu.org/onlinedocs/gccint/LTO-Overview.html
https://llvm.org/docs/LinkTimeOptimization.html

Signed-off-by: chao.an <[email protected]>

arch/xtensa: Use syscall interface for xtensa_save/restore_context.

Signed-off-by: Abdelatif Guettouche <[email protected]>

arch.h: Fix up_exit prototype.

Signed-off-by: Abdelatif Guettouche <[email protected]>

arch/xtensa: Move xtensa_save_context to up_saveusercontext for
consistency with other archs.

Signed-off-by: Abdelatif Guettouche <[email protected]>

arm/armv[7|8]m: compare of hardware fp registers should skip REG_FP_RESERVED

Fix fpu test break

Signed-off-by: chao.an <[email protected]>

arch/risc-v: Don't clear reserved bits in fcsr in riscv_fpuconfig

Signed-off-by: Huang Qi <[email protected]>

pipe: Increase buffer size by one byte to ompensate the full indicator

Signed-off-by: Xiang Xiao <[email protected]>

boards/sim: support rc.sysinit

Follow: http://glennastory.net/boot/sysinit.html

This is first script that init runs is rc.sysinit. This
script does serval initialization tasks about basic service.

The boot sequence currently provided to the board level is:
board_earlyinitialize->
    board_lateinitialize(Peripherals driver, core driver, ...)->
	run rcS script(mount fs, run service) ->
	    board_appinitialize->

After this patch:
The boot sequence currently provided to the board level is:
board_earlyinitialize->
    board_lateinitialize(core driver,...)->
	run rc.sysinit script(mount fs, run core service) ->
	    board_appinitialize(Peripherals driver)->
		run rcS script(run other service)->

So, Peripheral drivers can do more with the file system and
core services.

Signed-off-by: Jiuzhu Dong <[email protected]>

arch/arm: Switch the context of save and restore from assembler to c

Signed-off-by: Xiang Xiao <[email protected]>

arch/arm: Move the duplicated assembly code to common folder

Signed-off-by: Xiang Xiao <[email protected]>

binfmt_execmodule: add errout_with_args exit point

Ensures that when errout_xx is taken, args are freed

env_dup: Fix copying of env between address environments

If address environments are in use, it is not possible to simply
memcpy from from one process to another. The current implementation
of env_dup does precisely this and thus, it fails at once when it is
attempted between two user processes.

The solution is to use the kernel's heap as an intermediate buffer.
This is a simple, effective and common way to do a fork().

Obviously this is not needed for kernel processes.

syscall: Add call gate for get_environ_ptr

Now that the environment strings are stored as an array of strings,
they can be passed from the application via char **environ, which
is really defined as a function call to get_environ_ptr().

This works as is for flat build, but protected mode and kernel mode
require a call gate, which is added here.

binfmt_execmodule: If incoming envp is NULL get parent envp

This keeps backwards compatibility with apps that do not provide
envp. The old implementation passes NULL always and this change fixes
any regression caused by it.

assert: static_assert is not support in c standard C89,C99.

Signed-off-by: wangbowen6 <[email protected]>

arch/xtensa: Color the other CPUs task when they are created.

Signed-off-by: Abdelatif Guettouche <[email protected]>

compile/opt: add config DEBUG_OPT_UNUSED_SECTIONS

Enable this option to optimization the unused input sections with the
linker by compiling with " -ffunction-sections -fdata-sections ", and
linking with " --gc-sections ".

Signed-off-by: chao.an <[email protected]>

compile/opt: add config DEBUG_LINK_MAP

Selecting this option will pass "-Map=$(TOPDIR)$(DELIM)nuttx.map" to ld
when linking NuttX ELF. That file can be useful for verifying
and debugging magic section games, and for seeing which
pieces of code get eliminated with DEBUG_OPT_UNUSED_SECTIONS.

Signed-off-by: chao.an <[email protected]>

arch/risc-v: Enable FPU for K210

K210 support rv64gc ISA, now we enable F/D extension for it.

Note: QEMU for K210 don't support FPU now.

Signed-off-by: Huang Qi <[email protected]>

sched/task: Correct the comment about environment variable

Signed-off-by: Xiang Xiao <[email protected]>

sched/environ: Remove the unneeded cast in env_dup

Signed-off-by: Xiang Xiao <[email protected]>

sched/environ: Replace get_environ_ptr with environ

Signed-off-by: Xiang Xiao <[email protected]>

environ: Don't expose get_environ_ptr in csdlib

since it isn't defined in c/c++ standard

Signed-off-by: Xiang Xiao <[email protected]>

arch/risc-v/riscv_misaligned: Implement float load/store support

Signed-off-by: Huang Qi <[email protected]>

arch: risc-v: Do not enable FPU for K210 with QEMU

Summary:
- I noticed that maix-bit:smp does not work with QEMU.
- Actually, QEMU supports sifive_u (not K210) but it works
  if FPU is disabled.
- This commit fixes this issue.

Impact:
- K210 with QEMU only

Testing:
- Tested with qemu-5.2

Signed-off-by: Masayuki Ishikawa <[email protected]>

sched/task: Implement execle and execve

Signed-off-by: Xiang Xiao <[email protected]>

libc: Implement execvp, execlp and execvpe as macro

Signed-off-by: Xiang Xiao <[email protected]>

libc: Fix typo error in execle

Signed-off-by: Xiang Xiao <[email protected]>

syscall: Fix prototype of exec() to syscall.csv

pm: Move pm_initialize call from driver_initialize to xxx_pminitialize

since it's too late with the below commit:
ommit a594a5d7a8dcd756884ca7d3449f37ba77f96af3
Author: chao.an <[email protected]>
Date:   Mon Apr 11 19:44:26 2022 +0800

    sched/init: drivers_initialize() should be late than up_initialize()

    up_initialize
    |
     ->up_serialinit
       |
        ->uart_register  /* ("/dev/console", &CONSOLE_DEV); */

    drivers_initialize
    |
     ->syslog_console_init
       |
        ->register_driver /* ("/dev/console", &g_consoleops, 0666, NULL); */

Signed-off-by: Xiang Xiao <[email protected]>

sched: remove DEBUGASSERT from nx_waitpid

Signed-off-by: Petro Karashchenko <[email protected]>

xtensa_user_handler.S: Use the `ps_setup` macro when dealing with an
exception.

Signed-off-by: Abdelatif Guettouche <[email protected]>

xtensa_user_handler.S: Fix backtrace.

Signed-off-by: Abdelatif Guettouche <[email protected]>

arch/xtensa: No need to save SP in EXCSAVE_1 when linking the interrupt
frame with the previous frame.  The SP is already saved in A12.

Signed-off-by: Abdelatif Guettouche <[email protected]>

boards/boardctl: correct boarctl return value

Summary:
- Correct boardctl function's return value
- In case of BOARDIOC_TESTSET, `ret' has 0 or 1 or an error,
  but `ret' is ignored except error.

Impact:
- boardctl return value except errors

Testing:
- custom Cortex-A9 board

Signed-off-by: Oki Minabe <[email protected]>

libc/string: strcmp/strncmp cast unsigned char

Summary:
- Cast to unsigned char for strcmp and strncmp
- strcmp and strncmp are described following by opengroup.org

  The sign of a non-zero return value shall be determined by the sign
  of the difference between the values of the first pair of bytes
  (both interpreted as type unsigned char) that differ in the strings
  being compared.

  https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcmp.html
  https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncmp.html

Impact:
- strcmp and strncmp return value

Testing:
- ostest on sabre-6quad:smp w/ qemu

Signed-off-by: Oki Minabe <[email protected]>

compiler.h: optimization option is not supported before GCC 4.6

-fno-tree-loop-distribute-patterns is not supported before
GCC 4.6

Signed-off-by: wangbowen6 <[email protected]>

libs/libc/string: unify implementation across the functions

Signed-off-by: Petro Karashchenko <[email protected]>

tools:fix parsememdump.py match error

Signed-off-by: anjiahao <[email protected]>

libc/fixedmatch: Avoid "divide by zero" error

Signed-off-by: Xiang Xiao <xiaoxia…
  • Loading branch information
XinStellaris authored and SimonFilgis committed May 3, 2022
1 parent ec76b3f commit 8b9778d
Show file tree
Hide file tree
Showing 1,860 changed files with 38,495 additions and 31,730 deletions.
2 changes: 1 addition & 1 deletion .github/gcc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"column": 3,
"severity": 4,
"message": 5
}
}
]
}
]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ jobs:
cd nuttx
commits="${{ github.event.pull_request.base.sha }}..HEAD"
git log --oneline $commits
echo "../nuttx/tools/checkpatch.sh -g $commits"
../nuttx/tools/checkpatch.sh -g $commits
echo "../nuttx/tools/checkpatch.sh -m -g $commits"
../nuttx/tools/checkpatch.sh -m -g $commits
20 changes: 0 additions & 20 deletions DISCLAIMER-WIP

This file was deleted.

12 changes: 8 additions & 4 deletions Documentation/applications/nsh/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,10 @@ Configuration Description
registered as ``/dev/mmcsd``\ *N* where *N* is the minor number.
Default is zero.

``CONFIG_NSH_ROMFSETC`` Mount a ROMFS file system at ``/etc`` and provide a startup
script at ``/etc/init.d/rcS``.
The default startup script will mount a FAT FS RAMDISK at
``CONFIG_NSH_ROMFSETC`` Mount a ROMFS file system at ``/etc`` and provide a system init
script at ``/etc/init.d.rc.sysinit`` and a startup script at
``/etc/init.d/rcS``.
The default system init script will mount a FAT FS RAMDISK at
``/tmp`` but the logic is `easily extensible <#startupscript>`__.

``CONFIG_NSH_CONSOLE`` If ``CONFIG_NSH_CONSOLE`` is set to *y*, then a serial console
Expand Down Expand Up @@ -462,6 +463,9 @@ Configuration Description
``CONFIG_NSH_ROMFSMOUNTPT`` The default mountpoint for the ROMFS volume is ``"/etc"``,
but that can be changed with this setting. This must be a
absolute path beginning with '``/``' and enclosed in quotes.
``CONFIG_NSH_SYSINITSCRIPT`` This is the relative path to the system init script within the
mountpoint. The default is ``"init.d/rc.sysinit"``. This is a relative
path and must not start with '``/``' but must be enclosed in quotes.
``CONFIG_NSH_INITSCRIPT`` This is the relative path to the startup script within the
mountpoint. The default is ``"init.d/rcS"``. This is a relative
path and must not start with '``/``' but must be enclosed in quotes.
Expand All @@ -473,7 +477,7 @@ Configuration Description
Any value selected must be a power of 2.
============================== ==============================================================

When the default ``rcS`` file used when ``CONFIG_NSH_ROMFSETC`` is
When the default ``rc.sysinit`` file used when ``CONFIG_NSH_ROMFSETC`` is
selected, it will mount a FAT FS under ``/tmp``. The following
selections describe that FAT FS.

Expand Down
31 changes: 19 additions & 12 deletions Documentation/applications/nsh/customizing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ does the following:
~~~~~~~~~~~~~~~~~~~~

The NSH initialization function, ``nsh_initialize()``, be found in
``apps/nshlib/nsh_init.c``. It does only three things:
``apps/nshlib/nsh_init.c``. It does only four things:

#. ``nsh_romfsetc()``: If so configured, it executes an NSH start-up
script that can be found at ``/etc/init.d/rcS`` in the target file
system. The ``nsh_romfsetc()`` function can be found in
``apps/nshlib/nsh_romfsetc.c``. This function will (1) register a
ROMFS file system, then (2) mount the ROMFS file system. ``/etc`` is
the default location where a read-only, ROMFS file system is mounted
by ``nsh_romfsetc()``.
#. ``nsh_romfsetc()``: If so configured, it executes NSH system init and
start-up script that can be found at ``/etc/init.d/rc.sysinit`` and
``/etc/init.d/rcS`` in the target file system. The ``nsh_romfsetc()``
function can be found in ``apps/nshlib/nsh_romfsetc.c``.
This function will (1) register a ROMFS file system, then (2) mount
the ROMFS file system. ``/etc`` is the default location where a
read-only, ROMFS file system is mounted by ``nsh_romfsetc()``.

The ROMFS image is, itself, just built into the firmware. By default,
this ``rcS`` start-up script contains the following logic::
this ``rc.sysinit`` system init script contains the following logic::

# Create a RAMDISK and mount it at XXXRDMOUNTPOINTXXX

Expand All @@ -79,7 +79,7 @@ The NSH initialization function, ``nsh_initialize()``, be found in
- ``XXXRDMOUNTPOINTXXX`` will become the configured mount point.
Default: ``/etc``

By default, the substituted values would yield an ``rcS`` file like::
By default, the substituted values would yield an ``rc.sysinit`` file like::

# Create a RAMDISK and mount it at /tmp

Expand All @@ -96,8 +96,8 @@ The NSH initialization function, ``nsh_initialize()``, be found in

- Mount the FAT file system at a configured mountpoint, ``/tmp``.

This ``rcS`` template file can be found at
``apps/nshlib/rcS.template``. The resulting ROMFS file system can be
This ``rc.sysinit.template`` template file can be found at
``apps/nshlib/rc.sysinit.template``. The resulting ROMFS file system can be
found in ``apps/nshlib/nsh_romfsimg.h``.

#. ``board_app_initialize()``: Next any architecture-specific NSH
Expand All @@ -110,6 +110,13 @@ The NSH initialization function, ``nsh_initialize()``, be found in
#. ``nsh_netinit()``: The ``nsh_netinit()`` function can be found in
``apps/nshlib/nsh_netinit.c``.

#. The start-up script ``rcS`` is executed after the system-init script
to startup some application and other system service.

This ``rcS`` template file can be found at
``apps/nshlib/rcS.template``. The resulting ROMFS file system can be
found in ``apps/nshlib/nsh_romfsimg.h``.

NSH Commands
************

Expand Down
51 changes: 35 additions & 16 deletions Documentation/applications/nsh/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ behave as follows at NSH start-up time:

`--init.d/
`-- rcS
`-- rc.sysinit

Where ``rcS`` is the NSH start-up script.
Where ``rc.sysinit`` is the NSH system-init script.

- NSH will then mount the ROMFS file system at ``/etc``, resulting in::

Expand All @@ -71,25 +73,27 @@ behave as follows at NSH start-up time:
`--etc/
`--init.d/
`-- rcS
`-- rc.sysinit

- By default, the contents of ``rcS`` script are::
- By default, the contents of ``rc.sysinit`` script are::

# Create a RAMDISK and mount it at /tmp

mkrd -m 1 -s 512 1024
mkfatfs /dev/ram1
mount -t vfat /dev/ram1 /tmp

- NSH will execute the script at ``/etc/init.d/rcS`` at start-up
(before the first NSH prompt). After execution of the script, the
root FS will look like::
- NSH will execute the script at ``/etc/init.d/rc.sysinit`` at system
init (before the first NSH prompt). After execution of the script,
the root FS will look like::

|--dev/
| |-- ram0
| `-- ram1
|--etc/
| `--init.d/
| `-- rcS
| `-- rc.sysinit
`--tmp/

**Example Configurations**. Here are some configurations that have
Expand All @@ -105,15 +109,16 @@ provide useful examples:
- ``boards/sim/sim/sim/touchscreen``

In most of these cases, the configuration sets up the *default*
``/etc/init.d/rcS`` script. The default script is here:
``apps/nshlib/rcS.template``. (The funny values in the template like
``XXXMKRDMINORXXX`` get replaced via ``sed`` at build time). This
``/etc/init.d/rc.sysinit`` and ``/etc/init.d/rcS`` script. The default
script is here: ``apps/nshlib/rc.sysinit.template`` and
``apps/nshlib/rcS.template``. (The funny values in the rc.sysinit.template
like ``XXXMKRDMINORXXX`` get replaced via ``sed`` at build time). This
default configuration creates a ramdisk and mounts it at ``/tmp`` as
discussed above.

If that default behavior is not what you want, then you can provide your
own custom ``rcS`` script by defining ``CONFIG_NSH_ARCHROMFS=y`` in the
configuration file.
own custom ``rc.sysinit`` and ``rcS`` script by defining
``CONFIG_NSH_ARCHROMFS=y`` in the configuration file.

**Modifying the ROMFS Image**. The contents of the ``/etc`` directory
are retained in the file ``apps/nshlib/nsh_romfsimg.h`` OR, if
Expand Down Expand Up @@ -146,21 +151,34 @@ behavior, there are three things to study:
is a normal part of a complete Linux or Cygwin installation,
usually as part of the ``vi`` package).

#. The file ``apps/nshlib/rcS.template`` (OR, if
#. The file ``apps/nshlib/rc.sysinit.template`` (OR, if
``CONFIG_NSH_ARCHROMFS`` is defined
``include/arch/board/rc.sysinit.template``.

The file ``apps/nshlib/rcS.template`` (OR, if
``CONFIG_NSH_ARCHROMFS`` is defined
``include/arch/board/rcs.template``.

#. ``rcS.template``. The file ``apps/nshlib/rcS.template`` contains the
#. ``rc.sysinit.template``. The file ``apps/nshlib/rc.sysinit.template``
contains the general form of the ``rc.sysinit`` file; configured values
are plugged into this template file to produce the final ``rc.sysinit`` file.

``rcS.template``. The file ``apps/nshlib/rcS.template`` contains the
general form of the ``rcS`` file; configured values are plugged into
this template file to produce the final ``rcS`` file.

To generate a custom ``rcS`` file a copy of ``rcS.template`` needs to
To generate a custom ``rc.sysinit`` and ``rcS`` file a copy of
``rc.sysinit.template`` and ``rcS.template`` needs to
be placed at ``tools/`` and changed according to the desired start-up
behaviour. Running ``tools/mkromfsimg.h`` creates ``nsh_romfsimg.h``
which needs to be copied to ``apps/nshlib`` OR if
``CONFIG_NSH_ARCHROMFS`` is defined to
``boards/<arch>/<chip>/<board>/include``.

``rc.sysinit.template``. The default ``rc.sysinit.template``,
``apps/nshlib/rc.sysinit.template``, generates the standard, default
``apps/nshlib/nsh_romfsimg.h`` file.

``rcS.template``. The default ``rcS.template``,
``apps/nshlib/rcS.template``, generates the standard, default
``apps/nshlib/nsh_romfsimg.h`` file.
Expand All @@ -171,10 +189,11 @@ then a custom, board-specific ``nsh_romfsimg.h`` file residing in
is configured, ``include/arch/board`` will be linked to
``boards/<arch>/<chip>/<board>/include``.

All of the startup-behavior is contained in ``rcS.template``. The role
of ``mkromfsimg.sh`` script is to (1) apply the specific configuration
settings to ``rcS.template`` to create the final ``rcS``, and (2) to
generate the header file ``nsh_romfsimg.h`` containing the ROMFS file
All of the startup-behavior is contained in ``rc.sysinit.template`` and
``rcS.template``. The role of ``mkromfsimg.sh`` script is to (1) apply
the specific configuration settings to ``rc.sysinit.template`` to create
the final ``rc.sysinit``, and ``rcS.template`` to create the final ``rcS``,
and (2) to generate the header file ``nsh_romfsimg.h`` containing the ROMFS file
system image. To do this, ``mkromfsimg.sh`` uses two tools that must be
installed in your system:

Expand Down
4 changes: 3 additions & 1 deletion Documentation/applications/nsh/login.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ and containing the password file, ``passwd`` like::
/etc/init.d:
dr-xr-xr-x 0 ..
-r--r--r-- 110 rcS
-r--r--r-- 110 rc.sysinit
nsh>

Where ``/etc/init.d/rcS`` is the start-up script; ``/etc/passwd`` is a
Where ``/etc/init.d/rc.sysinit`` is the system init script and
``/etc/init.d/rcS`` is the start-up script; ``/etc/passwd`` is a
the password file. Note that here we assume that you are already using a
start-up script. We can then piggyback the passwd file into the ``/etc``
file system already mounted for the NSH start up file as described above
Expand Down
45 changes: 29 additions & 16 deletions Documentation/applications/nsh/nsh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,10 @@ NSH to behave as follows at NSH startup time:

`--init.d/
`-- rcS
`-- rc.sysinit

Where rcS is the NSH start-up script.
Where rc.sysinit is the NSH system init script.

- NSH will then mount the ROMFS file system at ``/etc``,
resulting in::
Expand All @@ -287,25 +289,27 @@ NSH to behave as follows at NSH startup time:
`--etc/
`--init.d/
`-- rcS
`-- rc.sysinit

- By default, the contents of rcS script are::
- By default, the contents of rc.sysinit script are::

# Create a RAMDISK and mount it at XXXRDMOUNTPOINTXXX

mkrd -m 1 -s 512 1024
mkfatfs /dev/ram1
mount -t vfat /dev/ram1 /tmp

- NSH will execute the script at ``/etc/init.d/rcS`` at start-up
(before the first NSH prompt). After execution of the script,
the root FS will look like::
- NSH will execute the script at ``/etc/init.d/rc.sysinit`` at
system init script(before the first NSH prompt). After
execution of the script, the root FS will look like::

|--dev/
| |-- ram0
| `-- ram1
|--etc/
| `--init.d/
| `-- rcS
| `-- rc.sysinit
`--tmp/

**Modifying the ROMFS Image**. The contents of the ``/etc``
Expand All @@ -330,28 +334,37 @@ start-up behavior, there are three things to study:
- The configuration settings then installed configuration.
- The ``genromfs`` tool (available from
http://romfs.sourceforge.net).
- The file ``apps/nshlib/rcS.template`` (OR, if
- The file ``apps/nshlib/rc.sysinit.template`` (OR, if
``CONFIG_NSH_ARCHROMFS`` is defined
``include/arch/board/rc.sysinit.template``.
The file ``apps/nshlib/rcS.template`` (OR, if
``CONFIG_NSH_ARCHROMFS`` is defined
``include/arch/board/rcs.template``.

#. ``rcS.template``: The file ``apps/nshlib/rcS.template``
#. ``rc.sysinit.template``: The file ``apps/nshlib/rc.sysinit.template``
contains the general form of the ``rc.sysinit`` file; configured
values are plugged into this template file to produce the final
``rc.sysinit`` file.

``rcS.template``: The file ``apps/nshlib/rcS.template``
contains the general form of the ``rcS`` file; configured
values are plugged into this template file to produce the final
``rcS`` file.

.. note::
``apps/nshlib/rcS.template`` generates the standard,
default ``nsh_romfsimg.h`` file. If ``CONFIG_NSH_ARCHROMFS`` is
defined in the NuttX configuration file, then a custom,
board-specific ``nsh_romfsimg.h`` file residing in the
``boards/<arch>/<chip>/<board>/include`` directory will be used.
NOTE when the OS is configured, ``include/arch/board`` will be
``apps/nshlib/rcS.template`` and ``apps/nshlib/rc.sysinit.template``
generates the standard, default ``nsh_romfsimg.h`` file.
If ``CONFIG_NSH_ARCHROMFS`` is defined in the NuttX configuration
file, then a custom, board-specific ``nsh_romfsimg.h`` file residing
in the ``boards/<arch>/<chip>/<board>/include`` directory will be
used. NOTE when the OS is configured, ``include/arch/board`` will be
linked to ``boards/<arch>/<chip>/<board>/include``.

All of the startup-behavior is contained in ``rcS.template``. The
role of ``mkromfsimg.sh`` is to (1) apply the specific
configuration settings to ``rcS.template`` to create the final
``rcS``, and (2) to generate the header file ``nsh_romfsimg.h``
All of the startup-behavior is contained in ``rc.sysinit.template``
and ``rcS.template``. The role of ``mkromfsimg.sh`` is to (1) apply
the specific configuration settings to ``rc.sysinit.template`` to create
the final ``rc.sysinit``, and ``rc.sysinit.template`` to create the final
``rcS`` and (2) to generate the header file ``nsh_romfsimg.h``
containing the ROMFS file system image.

**Further Information**. See the section on `Customizing the
Expand Down
6 changes: 2 additions & 4 deletions Documentation/guides/cpp_cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,15 @@ Creating the project
)
set(EXE_NAME hellocpp)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${AC_HW_FLAGS} ${AC_DEFINES}")
set(CMAKE_CXX_FLAGS "${AC_HW_FLAGS} ${AC_DEFINES} ${AC_COMMON_FLAGS} ${AC_CXX_EXTRA_FLAGS}")
if (PARAM_DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
endif()
set(CMAKE_SKIP_RPATH ON)
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_LINKER} ${AC_LINKER_FLAGS} -o ${EXE_NAME}.elf <OBJECTS> <LINK_LIBRARIES>")
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(src)
* hellocpp/cmake/stm32f4discovery.cmake
Expand Down
Loading

0 comments on commit 8b9778d

Please sign in to comment.