Run the bitmap converter through the Python formatter required by checkpatch so the Python 3 print syntax fix passes the project style checks.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
Use Python 3 print function syntax so bitmap_converter.py can be parsed by current Python interpreters while preserving the existing usage message and exit path.
Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
Add the initial nxpkg command, metadata and store handling, the local install/list path, and the repository export helper.
Keep the current flow scoped to local artifacts and target-qualified repository entries so it remains usable as an incremental MVP while follow-up features land separately.
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
On the sim target (Windows/macOS/Linux), hello_rust_cargo_main() ended
with an infinite `loop {}` that never returned control to NSH, so the
example could not exit and the shell prompt hung.
Introduce a Cargo `sim` feature that is enabled only when CONFIG_ARCH_SIM
is set, and use it to compile out the trailing infinite loop and return 0
instead. Other embedded targets keep the original looping behavior.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
Select the Mach-O Rust target (x86_64-unknown-nuttx-macho.json) when
building Rust apps for the simulator on x86_64 macOS.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
Add a Rust make helper that collects crate input files, and use it for
the Rust hello and slint examples.
This makes the generated Rust static libraries depend on the crate
sources, manifests, build scripts. Hook the libraries into both context
and all, so re-running make after editing Rust inputs rebuilds the crate.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
Add aarch64 Rust target specs for NuttX, including a Mach-O variant
for macOS sim builds. Use the NuttX custom targets instead of
aarch64-apple-darwin so Rust std is built with target_os=nuttx while
still producing link-compatible objects for sim.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
Remove quotes around target-pointer-width values in i486 and x86_64
target configuration files to change from string to numeric type.
This change is required due to recent rustc JSON format modifications
that expect numeric values instead of strings for target-pointer-width.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
X86 support for Rust needs more test and verification, and not
upstreamed to Rust side yet.
It's better to use custom target triples for x86 by json files for now,
and it can be upstreamed to Rust side if stable enough.
Changed the Rust target triples in the CMake configuration to reference JSON files for x86_64 and i486 architectures. This improves the build process by providing more detailed target specifications.
* Added JSON files for i486 and x86_64 targets
* Updated CMake functions to use the new target triples
* Enhanced build directory structure for Rust crates
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Replace deprecated -Zbuild-std-features=panic_immediate_abort with
-Cpanic=immediate-abort compiler flag via RUSTFLAGS.
The panic_immediate_abort feature has been stabilized as a real panic
strategy in recent Rust nightly versions. The old method of enabling
it via -Zbuild-std-features is no longer supported and triggers a
compile error in core/src/panicking.rs.
Changes:
* cmake/nuttx_add_rust.cmake: Use RUSTFLAGS with -Cpanic=immediate-abort
* tools/Rust.mk: Use RUSTFLAGS with -Cpanic=immediate-abort
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
if defined CONFIG_EXAMPLES_ELF and CONFIG_EXAMPLES_MODLUE,
elf will generated BINDIR, so generated symtab will interference.
It supports inputting multiple specified files in mksymtab.sh to
avoid interference.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Renaming "modlib" to "libelf" is more in line with the implementation content,
which makes it easier for individual developers to understand the capabilities of this module.
CONFIG_LIBC_MODLIB -> CONFIG_LIBC_ELF
Signed-off-by: chao an <anchao.archer@bytedance.com>
Set NUTTX_INCLUDE_DIR in the Rust build commands to include the necessary directories for proper compilation.
* Ensured correct include paths for Rust projects
* Improved build reliability for Rust components
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Summary:
- Added support for x86 and x86_64 architectures in the Rust build system
- Updated `nuttx_rust_target_triple` function in `cmake/nuttx_add_rust.cmake` to handle x86 and x86_64 target triples
- Updated `RUST_TARGET_TRIPLE` macro in `tools/Rust.mk` to include x86 and x86_64 target triples
Impact:
- Enables Rust crate compilation for x86 and x86_64 platforms
- No functional changes for existing architectures (ARM, RISC-V, etc.)
- Improves platform compatibility and expands Rust support in NuttX
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
System is unknown to cmake, create:
Platform/WASI to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please post that file on discourse.cmake.org.
CMake Error at CMakeLists.txt:100 (add_subdirectory):
add_subdirectory given source
/home/data/vela/tmp/apps/frameworks/security/ta/hello_world
/home/data/vela/tmp/apps/frameworks/security/ta/" which is not an
existing directory.
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
1.add complete compilation FLAGS for wasm toolchain
2.wasm build no longer traverses the native directory, saving build time
3.implement OPT and AOT process actions for wasm files
4.create a bridge interface for navtie build and wasm build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
Summary:
- Added support for `panic_immediate_abort` in Rust builds, which causes the system to abort immediately on panic instead of unwinding the stack
- Enabled `-Zbuild-std-features=panic_immediate_abort` flag for release builds when `CONFIG_DEBUG_FULLOPT` is set
- Updated both CMake and Makefile build systems to include the new flag
Impact:
- Significantly reduces binary size (e.g., from 2270605 to 84987 bytes for riscv64imc)
- Changes panic behavior to immediate abort, which may be preferred for embedded systems
- Improves system reliability by preventing undefined behavior from stack unwinding in constrained environments
- Maintains compatibility with existing Rust code while providing a more deterministic panic handling mechanism
For example, if it is enabled, the system will panic immediately:
```
NuttShell (NSH) NuttX-12.8.0
nsh> hello_rust_cargo
{"name":"John","age":30}
{"name":"Jane","age":25}
Deserialized: Alice is 28 years old
Pretty JSON:
{
"name": "Alice",
"age": 28
}
riscv_exception: EXCEPTION: Illegal instruction. MCAUSE: 0000000000000002, EPC: 0000000080027df6, MTVAL: 0000000000000000
riscv_exception: PANIC!!! Exception = 0000000000000002
dump_assert_info: Current Version: NuttX 12.8.0 8e3621e059 Jan 20 2025 14:45:00 risc-v
dump_assert_info: Assertion failed panic: at file: :0 task: hello_rust_cargo process: hello_rust_cargo 0x80020588
/* Stack dump from NuttX */
```
vs the default behavior:
```
NuttShell (NSH) NuttX-12.8.0
nsh> hello_rust_cargo
{"name":"John","age":30}
{"name":"Jane","age":25}
Deserialized: Alice is 28 years old
Pretty JSON:
{
"name": "Alice",
"age": 28
}
thread '<unnamed>' panicked at /home/huang/Work/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/src/rust/library/std/src/sys/random/unix_legacy.rs:19:10:
failed to generate random data: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
nsh>
```
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Build Rust applictions with cargo is the most commn way,
and it's more easy to cooporate with Rust ecosystem.
This example shows how to use cargo to build a simple hello world
application.
And please notice that you need to install nighly version of rustc
to support this feature, any version after https://github.com/rust-lang/rust/pull/127755
is merged, can use NuttX as cargo target directly.
Build
-----
To build hello_rust_cargo application, you can use any target that based
on RISCV32IMAC, for example:
```
cmake -B build -DBOARD_CONFIG=rv-virt:nsh -GNinja .
```
And disable ARCH_FPU in menuconfig, since the hard coded target triple
in this demo is `riscv32imac`.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Nxdiag app build scripts updated due to changes to make diagnostic
tools independent from nxdiag app. Change aims that nxdiag app does
not a reqirement to fetch system information.
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
If the experimental feature Wasm build enabled with multi thread
compiling, the COPYFILE (cp) maybe raise the error below:
```
cp: cannot create regular file 'math.h': file exists
```
This error cause by that the wasi-sdk don't provide the math.h for
non-wasi envrioment, for this case, provide a math.h for it instead of copy
file each time is better.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Introduce a new CMake based build system for Wasm.
And target the Wasm ABI to wasm32-wasi, it should
be a more commnly used and standard ABI for Wasm.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Fixes partly: https://github.com/apache/nuttx-apps/issues/2046
Also, this fixes warnings like:
```
spacetanuki% ./tools/configure.sh -E sim:wamr
Copy files
Select CONFIG_HOST_MACOS=y
Refreshing...
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory /usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
CP: arch/dummy/Kconfig to /Users/yamamoto/git/nuttx/nuttx/arch/dummy/dummy_kconf
ig
CP: boards/dummy/Kconfig to /Users/yamamoto/git/nuttx/nuttx/boards/dummy/dummy_k
config
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
/usr/local/bin/bash: line 1: /bin/clang: No such file or directory
```
And leave all intermediate file in apps/wasm,
such as .map file, entry object etc used in
wasm module build.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Try to follow current NuttX's toolchain parttern:
Wasm.mk: Provide target rule for building wasm module
WASI-SDK.defs: Provide compile flags for building
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>