Skip to content

Commit 53d66b8

Browse files
Merge branch 'master' of github.com:apache/nuttx into hpwork_static
2 parents 557fcbd + 9cf7d80 commit 53d66b8

911 files changed

Lines changed: 34108 additions & 8486 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22450,7 +22450,6 @@ sched/sched/sched_removeblocked.c [email protected] masayuki.ishikawa@gmail
2245022450
2245122451
sched/sched/sched_reprioritize.c [email protected] [email protected]
2245222452
22453-
2245422453
2245522454
sched/sched/sched_rrgetinterval.c [email protected] [email protected]
2245622455
sched/sched/sched_self.c [email protected]

.github/workflows/build.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ name: Build
1515
on:
1616
pull_request:
1717
paths-ignore:
18-
- 'AUTHORS'
19-
- 'CONTRIBUTING.md'
20-
- '**/CODEOWNERS'
21-
- 'Documentation/**'
22-
- 'tools/ci/docker/linux/**'
23-
- 'tools/codeowners/*'
18+
- "AUTHORS"
19+
- "CONTRIBUTING.md"
20+
- "**/CODEOWNERS"
21+
- "Documentation/**"
22+
- "tools/ci/docker/linux/**"
23+
- "tools/codeowners/*"
2424
push:
2525
paths-ignore:
26-
- 'AUTHORS'
27-
- 'CONTRIBUTING.md'
28-
- 'Documentation/**'
26+
- "AUTHORS"
27+
- "CONTRIBUTING.md"
28+
- "Documentation/**"
2929
branches:
30-
- 'releases/*'
30+
- "releases/*"
3131
tags:
3232

3333
permissions:
@@ -38,7 +38,6 @@ concurrency:
3838
cancel-in-progress: true
3939

4040
jobs:
41-
4241
# Fetch the source from nuttx and nuttx-apps repos
4342
Fetch-Source:
4443
runs-on: ubuntu-latest
@@ -153,7 +152,6 @@ jobs:
153152
boards: ${{ fromJSON(needs.Linux-Arch.outputs.selected_builds) }}
154153

155154
steps:
156-
157155
- name: Show Disk Space
158156
run: df -h
159157

@@ -229,6 +227,13 @@ jobs:
229227
./cibuild.sh -c -A -N -R -S testlist/${{matrix.boards}}.dat
230228
fi
231229
230+
- name: Run host_info sanity check
231+
uses: ./sources/nuttx/.github/actions/ci-container
232+
with:
233+
run: |
234+
cd sources/nuttx
235+
make host_info
236+
232237
- name: Post-build Disk Space
233238
if: always()
234239
run: df -h
@@ -331,7 +336,7 @@ jobs:
331336
# https://github.com/cython/cython/issues/4500
332337
- uses: actions/setup-python@v6
333338
with:
334-
python-version: '3.10'
339+
python-version: "3.10"
335340
- name: Run Builds
336341
run: |
337342
echo "::add-matcher::sources/nuttx/.github/gcc.json"
@@ -448,7 +453,7 @@ jobs:
448453
- name: Set up Python and install kconfiglib
449454
uses: actions/setup-python@v6
450455
with:
451-
python-version: '3.10'
456+
python-version: "3.10"
452457
- name: Install kconfiglib
453458
run: |
454459
pip install kconfiglib

CMakeLists.txt

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ endif()
6565
set(CMAKE_CXX_EXTENSIONS OFF)
6666
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
6767
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
68+
set(CMAKE_USER_MAKE_RULES_OVERRIDE
69+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/nuttx_overrides.cmake)
6870

6971
# Setup build type (Debug Release RelWithDebInfo MinSizeRel Coverage). Default
7072
# to minimum size release
@@ -626,18 +628,22 @@ process_all_directory_romfs()
626628
# Get linker script to use
627629
get_property(ldscript GLOBAL PROPERTY LD_SCRIPT)
628630

629-
# Pre-compile linker script
631+
# Pre-compile linker script(s)
630632
if(NOT CONFIG_ARCH_SIM)
631-
get_filename_component(LD_SCRIPT_NAME ${ldscript} NAME)
632-
set(LD_SCRIPT_TMP "${CMAKE_BINARY_DIR}/${LD_SCRIPT_NAME}.tmp")
633+
set(ldscript_tmp_list)
634+
foreach(ld ${ldscript})
635+
get_filename_component(LD_SCRIPT_NAME ${ld} NAME)
636+
set(LD_SCRIPT_TMP "${CMAKE_BINARY_DIR}/${LD_SCRIPT_NAME}.tmp")
633637

634-
nuttx_generate_preprocess_target(SOURCE_FILE ${ldscript} TARGET_FILE
635-
${LD_SCRIPT_TMP})
638+
nuttx_generate_preprocess_target(SOURCE_FILE ${ld} TARGET_FILE
639+
${LD_SCRIPT_TMP})
636640

637-
add_custom_target(ldscript_tmp DEPENDS ${LD_SCRIPT_TMP})
638-
add_dependencies(nuttx ldscript_tmp)
641+
add_custom_target(ldscript_tmp_${LD_SCRIPT_NAME} DEPENDS ${LD_SCRIPT_TMP})
642+
add_dependencies(nuttx ldscript_tmp_${LD_SCRIPT_NAME})
639643

640-
set(ldscript ${LD_SCRIPT_TMP})
644+
list(APPEND ldscript_tmp_list -T ${LD_SCRIPT_TMP})
645+
endforeach()
646+
set(ldscript ${ldscript_tmp_list})
641647
endif()
642648

643649
# Perform link
@@ -677,7 +683,6 @@ if(NOT CONFIG_ARCH_SIM)
677683
target_link_libraries(
678684
nuttx
679685
PRIVATE ${NUTTX_EXTRA_FLAGS}
680-
-T
681686
${ldscript}
682687
$<$<NOT:$<BOOL:${DISABLE_LINK_GROUP}>>:-Wl,--start-group>
683688
${nuttx_libs}
@@ -809,14 +814,19 @@ if(CONFIG_BUILD_PROTECTED)
809814

810815
get_property(user_ldscript GLOBAL PROPERTY LD_SCRIPT_USER)
811816

812-
# Pre-compile linker script
813-
get_filename_component(LD_SCRIPT_USER_NAME ${user_ldscript} NAME)
814-
set(LD_SCRIPT_USER_TMP "${CMAKE_BINARY_DIR}/${LD_SCRIPT_USER_NAME}.tmp")
815-
nuttx_generate_preprocess_target(SOURCE_FILE ${user_ldscript} TARGET_FILE
816-
${LD_SCRIPT_USER_TMP})
817-
add_custom_target(user_ldscript_tmp DEPENDS ${LD_SCRIPT_USER_TMP})
818-
add_dependencies(nuttx_user user_ldscript_tmp)
819-
set(user_ldscript ${LD_SCRIPT_USER_TMP})
817+
# Pre-compile linker script(s)
818+
set(user_ldscript_tmp_list)
819+
foreach(ldscript ${user_ldscript})
820+
get_filename_component(LD_SCRIPT_USER_NAME ${ldscript} NAME)
821+
set(LD_SCRIPT_USER_TMP "${CMAKE_BINARY_DIR}/${LD_SCRIPT_USER_NAME}.tmp")
822+
nuttx_generate_preprocess_target(SOURCE_FILE ${ldscript} TARGET_FILE
823+
${LD_SCRIPT_USER_TMP})
824+
add_custom_target(user_ldscript_tmp_${LD_SCRIPT_USER_NAME}
825+
DEPENDS ${LD_SCRIPT_USER_TMP})
826+
add_dependencies(nuttx_user user_ldscript_tmp_${LD_SCRIPT_USER_NAME})
827+
list(APPEND user_ldscript_tmp_list -T ${LD_SCRIPT_USER_TMP})
828+
endforeach()
829+
set(user_ldscript ${user_ldscript_tmp_list})
820830

821831
# reset link options that don't fit userspace
822832
get_target_property(nuttx_user_LINK_OPTIONS nuttx_user LINK_OPTIONS)
@@ -846,8 +856,7 @@ if(CONFIG_BUILD_PROTECTED)
846856

847857
target_link_libraries(
848858
nuttx_user
849-
PRIVATE -T
850-
${user_ldscript}
859+
PRIVATE ${user_ldscript}
851860
$<$<NOT:$<BOOL:${DISABLE_LINK_GROUP}>>:-Wl,--start-group>
852861
${nuttx_system_libs}
853862
${nuttx_apps_libs}

Documentation/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,19 @@
2424
# You can set these variables from the command line, and also
2525
# from the environment for the first two.
2626
# Ignore the _tags directory as per sphinx-tags docs to avoid infinite loop
27-
SPHINXOPTS ?= -j 1 -W -A nuttx_versions="latest,${NUTTX_VERSIONS}"
28-
SPHINXAUTOOPTS ?= -j 8 -W --ignore "_tags/*"
27+
SPHINXOPTS ?= -j auto -W -A nuttx_versions="latest,${NUTTX_VERSIONS}"
28+
SPHINXAUTOOPTS ?= -j auto -W --ignore "_tags/*"
2929
SPHINXBUILD ?= sphinx-build
3030
SPHINXAUTOBUILD ?= sphinx-autobuild
3131
SOURCEDIR = .
3232
BUILDDIR = _build
3333

3434
# Put it first so that "make" without argument is like "make help".
3535
help:
36+
$(info =>)
37+
$(info => Use `make autobuild` to build live preview of the documentation.)
38+
$(info => You can then watch live edit changes at http://localhost:8000.)
39+
$(info =>)
3640
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
3741

3842
.PHONY: help Makefile
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
==================================
2+
BOARDIOC_SPINLOCK Spinlock Example
3+
==================================
4+
5+
Overview
6+
========
7+
8+
This example demonstrates the usage of the BOARDIOC_SPINLOCK board control
9+
interface for managing hardware spinlock operations in NuttX. The BOARDIOC_SPINLOCK
10+
interface provides a low-level mechanism to synchronize access to shared resources
11+
across multiple threads or CPUs using spinlock primitives.
12+
13+
What is BOARDIOC_SPINLOCK?
14+
==========================
15+
16+
BOARDIOC_SPINLOCK is a board control request that allows applications to perform
17+
atomic spinlock operations through the boardctl() interface.
18+
19+
The BOARDIOC_SPINLOCK interface supports three primary operations:
20+
21+
* **BOARDIOC_SPINLOCK_LOCK** - Acquire a spinlock (blocks until available)
22+
* **BOARDIOC_SPINLOCK_TRYLOCK** - Try to acquire a spinlock (non-blocking)
23+
* **BOARDIOC_SPINLOCK_UNLOCK** - Release a spinlock
24+
25+
Prerequisites
26+
=============
27+
28+
The following configuration options must be enabled:
29+
30+
.. code-block:: bash
31+
32+
# Enable board spinlock support
33+
CONFIG_BOARDCTL_SPINLOCK=y
34+
35+
36+
Basic Usage
37+
===========
38+
39+
Header Files
40+
------------
41+
42+
Include the following headers in your application:
43+
44+
.. code-block:: c
45+
46+
#include <sys/boardctl.h> /* For boardctl() interface */
47+
#include <nuttx/spinlock.h> /* For spinlock types */
48+
49+
Data Structures
50+
---------------
51+
52+
The BOARDIOC_SPINLOCK interface uses the following structure:
53+
54+
.. code-block:: c
55+
56+
struct boardioc_spinlock_s
57+
{
58+
int action; /* Operation: LOCK, TRYLOCK, or UNLOCK */
59+
spinlock_t *lock; /* Pointer to the spinlock variable */
60+
void *flags; /* Optional flags (reserved, set to NULL) */
61+
};
62+
63+
Actions
64+
-------
65+
66+
The following action values are supported:
67+
68+
.. code-block:: c
69+
70+
BOARDIOC_SPINLOCK_LOCK /* Acquire lock (blocks if unavailable) */
71+
BOARDIOC_SPINLOCK_TRYLOCK /* Try to acquire (non-blocking) */
72+
BOARDIOC_SPINLOCK_UNLOCK /* Release lock */
73+
74+
Return Values
75+
^^^^^^^^^^^^^
76+
77+
* **0** - Success
78+
* **Negative value** - Error code (converted to errno)
79+
80+
Simple Lock Example
81+
-------------------
82+
83+
Here's a basic example of acquiring and releasing a spinlock:
84+
85+
.. code-block:: c
86+
87+
spinlock_t my_lock;
88+
struct boardioc_spinlock_s spinlock_op;
89+
int ret;
90+
91+
/* Initialize the spinlock */
92+
spin_lock_init(&my_lock);
93+
94+
/* Acquire the spinlock */
95+
spinlock_op.action = BOARDIOC_SPINLOCK_LOCK;
96+
spinlock_op.lock = &my_lock;
97+
spinlock_op.flags = NULL;
98+
99+
ret = boardctl(BOARDIOC_SPINLOCK, (uintptr_t)&spinlock_op);
100+
if (ret == 0) {
101+
printf("Spinlock acquired successfully\n");
102+
} else {
103+
printf("Failed to acquire spinlock: %d\n", ret);
104+
}
105+
106+
printf("Inside spinlock\n");
107+
108+
/* Release the spinlock */
109+
spinlock_op.action = BOARDIOC_SPINLOCK_UNLOCK;
110+
ret = boardctl(BOARDIOC_SPINLOCK, (uintptr_t)&spinlock_op);
111+
if (ret == 0) {
112+
printf("Spinlock released successfully\n");
113+
}
114+
115+
116+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
===========================================
2+
``bare`` Binary Application Record Encoding
3+
===========================================
4+
5+
BARE is a simple binary representation for structured application data, see
6+
https://baremessages.org/.
7+
8+
BARE implementation ported to NuttX is ``cbare``, see
9+
https://git.sr.ht/~fsx/cbare.
10+
11+
BARE_ is similar to other binary formats like CBOR_, BSON_, or `Protocol
12+
Buffers`_.
13+
14+
.. _BARE: https://baremessages.org/
15+
.. _CBOR: https://cbor.io/
16+
.. _BSON: https://bsonspec.org/
17+
.. _Protocol Buffers: https://protobuf.dev/
18+
19+
BARE at glance, from its web page:
20+
21+
- Messages are encoded in binary and compact in size. Messages do not contain
22+
schema information — they are not self-describing.
23+
24+
- BARE is optimized for small messages. It is not optimized for encoding large
25+
amounts of data in a single message, or efficiently reading a message with
26+
fields of a fixed size. However, all types are aligned to 8 bits, which does
27+
exchange some space for simplicity.
28+
29+
- BARE's approach to extensibility is conservative: messages encoded today will
30+
be decodable tomorrow, and vice-versa. But extensibility is still possible;
31+
implementations can choose to decode user-defined types at a higher level and
32+
map them onto arbitrary data types.
33+
34+
- The specification is likewise conservative. Simple implementations of message
35+
decoders and encoders can be written inside of an afternoon.
36+
37+
- An optional DSL is provided to document message schemas and provide a source
38+
for code generation. However, if you prefer, you may also define your schema
39+
using the type system already available in your programming language.

Documentation/applications/nsh/nsh.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,26 @@ Command Overview
8989
(NSH) is a simple shell application. NSH supports the following
9090
commands forms:
9191

92-
=============================== ======================================
92+
=============================== ==========================================
9393
Simple command ``<cmd>``
94-
Command with re-directed output ``<cmd> > <file> <cmd> >> <file>``
94+
Command with re-directed input ``<cmd> < <file>``
95+
Command with re-directed output ``<cmd> > <file>`` ``<cmd> >> <file>``
96+
Command with re-directed error ``<cmd> 2> <file>`` ``<cmd> 2>> <file>``
97+
Redirect stderr to stdout ``<cmd> > <file> 2>&1``
9598
Background command ``<cmd> &``
96-
Re-directed background command ``<cmd> > <file> & <cmd> >> <file> &``
97-
=============================== ======================================
99+
Re-directed background command ``<cmd> > <file> &`` ``<cmd> >> <file> &``
100+
=============================== ==========================================
98101

99102
Where:
100103

101104
* ``<cmd>`` is any one of the simple commands listed later.
102-
* ``<file>`` is the full or relative path to any writable object in the file system name space (file or character driver). Such objects will be referred to simply as files throughout this document.
105+
* ``<file>`` is the full or relative path to any readable or writable object in the file system name space (file or character driver). Such objects will be referred to simply as files throughout this document.
103106

104107
``nice`` **'d Background Commands**. NSH executes at the
105108
mid-priority (128). Backgrounded commands can be made to execute
106109
at higher or lower priorities using ``nice``::
107110

108-
[nice [-d <niceness>>]] <cmd> [> <file>|>> <file>] [&]
111+
[nice [-d <niceness>>]] <cmd> [< <file>] [> <file>|>> <file>] [2> <file>|2>> <file>|2>&1] [&]
109112

110113
Where ``<niceness>`` is any value between -20 and 19 where lower
111114
(more negative values) correspond to higher priorities. The

0 commit comments

Comments
 (0)