nuttx/tools
Marco Casaroli c9cd9db25f tools/nxflat: Add an Apache-licensed NXFLAT converter.
ldnxflat is the last piece of the NXFLAT toolchain that NuttX cannot carry.
It descends from elf2flt through four sets of copyright holders, so it is GPL
by that descent and not merely by its libbfd dependency.  This is a new
implementation, written from include/nxflat.h, from what binfmt/libnxflat does
with the container, and from the ELF specification.  The relocation arithmetic
is that of libs/libc/machine/arm/armv7-m/arch_elf.c, which the ELF loader runs
on the target for the same relocations, and which brings R_ARM_TARGET1 with
it.

NXFLAT is not an ARM format.  Its loader only adds a base to a 32-bit word, so
the segments, the GOT, the relocation records and the header are common to
every architecture.  An architecture supplies a table entry, an entry-point
convention and a relocation handler; an object for a machine with no entry is
refused by name.

The GOT is built here, because ld -r emits none: one entry per symbol that a
GOT-relative reference names, at the start of D-Space, each with a relocation
record of its own.  An entry may hold a function, which is what makes a
function pointer reached through the GOT work.

Two defects of the out-of-tree tool do not survive.  A GOT entry naming a .bss
object lost its section's address and pointed at the start of D-Space, the GOT
itself, so on lm3s6965-ek:qemu-nxflat the longjmp test panics with PC 0 and
the five tests after it never run.  The alignment gap before .bss went missing
from h_bssend as well, leaving D-Space short.

The tool is built and named like the rest of the toolchain.  Makefile.host
builds it, Unix.mk makes a configuration that sets CONFIG_NXFLAT depend on it
beside mknxflat, and LDNXFLAT points at the tool in the tree rather than one
on PATH.

All eight C modules of apps/examples/nxflat/tests convert and run to
completion under qemu-system-arm -M lm3s6965evb.

Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-09-27 11:25:12 -03:00
..
ameba arch/arm/ameba: resolve the asdk toolchain per-IC 2026-07-17 08:30:47 -03:00
bcm2711 arch/bcm2711, boards/raspberry-pi-4b: Add preliminary support for the BCM2711 and Raspberry Pi 4B. 2024-12-17 16:43:17 +08:00
bl602
ci riscv/erbium: Add standalone Minion emulator support. 2026-09-24 15:38:14 +08:00
codeowners docs/codeowners: Add preliminary code owner file 2025-09-05 19:53:06 -04:00
cxd56 tools/cxd56/mkspk: proper resources free on error. 2026-08-17 14:17:37 +08:00
esp32 tools/espressif: Add UF2 output support 2026-05-27 14:29:35 -04:00
esp32c3 tools/espressif: add esptool version check to Espressif build system 2024-10-15 20:42:57 +02:00
esp32s2 tools/espressif: Add UF2 output support 2026-05-27 14:29:35 -04:00
esp32s3 tools/espressif: Add UF2 output support 2026-05-27 14:29:35 -04:00
espressif cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
imx9 arch/arm64/imx9: Support for imx9 edgelock enclave 2025-03-17 21:35:25 +02:00
imxrt1180 tools/imxrt1180: Add a standalone C program for simple AHAB container creation 2026-09-19 22:38:45 +08:00
licensing tools: escape Python string backslashes 2026-08-21 20:07:26 +08:00
lwl docs/guides/lwl: move lwl's README.txt to lwl.rst 2025-12-23 15:20:06 +01:00
mpfs
nix tools/nix: move nix flakes to tools/ 2025-08-28 10:04:01 +08:00
nxflat tools/nxflat: Add an Apache-licensed NXFLAT converter. 2026-09-27 11:25:12 -03:00
pic32
pynuttx tools/pynuttx: Update the preemption field annotations. 2026-09-07 21:06:53 +08:00
rp23xx tools/rp{2040,23xx}: Ensure that picotool is found or built 2025-08-22 00:30:28 +08:00
rp2040 tools: rp2040: Drop uninitialized name length check 2026-07-10 12:39:44 +08:00
simwifi fix(udhcpc): missing interface name in log message 2025-05-05 09:32:31 +08:00
zds style: Fix "the the" typo across the codebase. 2026-03-23 11:07:49 +01:00
.gitignore tools/nxflat: Add an Apache-licensed NXFLAT converter. 2026-09-27 11:25:12 -03:00
aarch64-unknown-nuttx-macho.json tools: Enable Rust sim builds on Intel Macs 2026-06-08 21:22:45 +08:00
aarch64-unknown-nuttx.json tools/rust: Move NuttX Rust target specs into nuttx 2026-06-01 00:02:41 +08:00
abi_check.py abi_check.py:Check ABI compatibility between different ELF versions. 2026-01-28 18:32:39 +01:00
b16.c
bdf-converter.c tools/bdf-converter: Fix loop termination condition. 2025-03-18 10:12:23 -03:00
board_romfs_mkpasswd.sh sched,fs,docs: support setuid sudo helper 2026-08-18 15:57:52 +08:00
btdecode.sh arch/risc-v/espressif/esp32p4: Support ESP32-P4 on NuttX 2026-03-09 21:40:25 +01:00
build-globals.sh libc/elf: rename modlib to libelf 2025-04-11 09:43:22 +08:00
callstack.py
cfgdefine.c libc/elf: rename modlib to libelf 2025-04-11 09:43:22 +08:00
cfgdefine.h
cfgparser.c
cfgparser.h
check_passwd_keys.sh !boards: enforce secure ROMFS passwd and TEA key setup 2026-07-09 22:41:11 +08:00
checkkconfig.py tools[feat]: add config check tool 2026-01-14 17:50:18 +01:00
checkpatch.sh tools/checkpatch.sh: Enhance stdin support for patch checking 2026-03-09 11:08:52 +08:00
checkrelease.sh
CMakeLists.txt tools/CMakeLists.txt: Add mkpasswd binaries 2026-04-16 01:45:48 +08:00
cmpconfig.c
cnvwindeps.c
Config.mk tools: pass TOPDIR in SDIR_template and MAKE_template 2026-09-17 13:49:05 +08:00
configure.bat
configure.c style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
configure.sh !tools/mkpasswd: PBKDF2 host tool and ROMFS passwd build integration 2026-07-21 20:19:14 +08:00
configure_completion.bash
convert-comments.c
copydir.bat style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
copydir.sh style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
coredump.py coredump.py:bug fix python file not have rename 2024-10-30 12:29:22 +08:00
csvparser.c
csvparser.h tools/mksyscall: fix 106: Unexpected end of line: "FAR char * co" 2025-03-08 12:39:24 +08:00
D.defs debug symbol level: Use config instead 2024-12-04 22:36:45 +08:00
define.bat style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
define.sh style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
detab.c
Directories.mk libbuitin/compiler_rt: Supports separate builtin rt.builtins or rt.profile 2024-11-12 16:12:53 +08:00
discover.py
doreleasenotes.py tools/doreleasenotes: remove deprecater API 2025-05-27 20:34:54 +08:00
Export.mk tools: Export LLVM flags for kernel build 2025-01-26 20:22:35 +08:00
find_symbol_callers.sh toos/scipts: add script to find symbol caller 2025-12-31 08:47:23 -03:00
flash_writer.py fix misspelled names in locally scoped code 2025-05-15 10:12:12 +08:00
FlatLibs.mk libbuitin/compiler_rt: Supports separate builtin rt.builtins or rt.profile 2024-11-12 16:12:53 +08:00
gcov.py gcov: Refactoring the implementation framework of gcov 2025-07-03 00:17:58 +08:00
gdbserver.py gdbserver.py:add x86_64 arch 2026-01-24 23:31:43 +08:00
gen_passwd_keys.sh boards: add CI ROMFS passwd credentials and refresh docs 2026-07-09 22:41:11 +08:00
gencromfs.c
host_info_dump.py tools: add build path support on host_info tool 2026-05-20 13:12:38 -04:00
host_info_parse.py tools: fix make host_info flag parsing and config string escaping 2026-02-05 14:23:19 +01:00
i486-unknown-nuttx.json tools/rust: Fix softfloat abi target spec name 2026-08-13 12:41:54 +02:00
ide_exporter.py tools: escape Python string backslashes 2026-08-21 20:07:26 +08:00
incdir.bat
incdir.c
incdir.sh
indent.sh
initialconfig.c
jlink-nuttx.c
kasan_global.py kasan/globals: fix compile error 2024-12-05 20:37:47 +08:00
kconfig.bat
kconfig2html.c tools: kconfig2html: Explain blank-line guard 2026-08-21 20:08:18 +08:00
KernelLibs.mk libbuitin/compiler_rt: Supports separate builtin rt.builtins or rt.profile 2024-11-12 16:12:53 +08:00
LibTargets.mk clang:libclang_rt.builtins-xxx.a supports builtin 2024-10-28 16:38:45 +08:00
link.bat
link.sh
lowhex.c
macar-qcs.sh tools/macar-qcs.sh: migrate license to ASF 2024-12-16 14:14:55 +08:00
Make.defs tools: Rename apps-or-nuttx-Make.defs to Make.defs 2024-10-17 07:55:02 +08:00
Makefile.host tools/nxflat: Add an Apache-licensed NXFLAT converter. 2026-09-27 11:25:12 -03:00
merge_config.py install kconfiglib using apt repo 2024-12-02 13:43:29 +08:00
mkallsyms.py libs/libc/symtab: fix bogus symbol names for out-of-range addresses 2026-08-05 21:51:25 +08:00
mkallsyms.sh sim: fix mkallsyms for Objective-C symbols on macOS 2026-05-08 19:51:39 +08:00
mkconfig.c
mkconfigvars.sh
mkctags.sh
mkdeps.c tools/mkdeps: increase MAX_BUFFER from 16384 to 65536 2024-10-31 08:55:07 +08:00
mkexport.sh build/export: Fix missing gnu-elf.ld copy and toolchain script. 2025-09-14 10:44:51 +08:00
mkfsdata.pl
mkfsdata.py style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
mknulldeps.sh
mkpasswd.c !tools/mkpasswd: PBKDF2 host tool and ROMFS passwd build integration 2026-07-21 20:19:14 +08:00
mkromfsimg.sh
mksymtab.c
mksyscall.c tools:mksyscall fix compilation warning 2026-05-09 09:42:58 +08:00
mkversion.c tools/mkversion: Fix missing free in case of error. 2026-08-14 08:03:15 +02:00
mkwindeps.sh
netusb.sh
noteinfo.c
nxstyle.c tools/nxstyle: allow the OpenGL and TinyGL identifier prefixes 2026-09-25 18:18:10 +08:00
nxstyle_sweep.sh tools/nxstyle: add a script to check a whole tree at once 2026-07-28 02:43:24 +08:00
nxtagspkgsfetch.sh tools/nxtagspkgsfetch.sh: Fetch tags packages for NuttX and Apps. 2025-12-17 08:12:44 -03:00
parsecallstack.py
parsememdump.py mm: dump node overheadp during memdump 2024-11-25 00:42:34 +08:00
parsetrace.py tools/parsetrace.py: Fix get_typesize bug in parsetrace.py 2026-01-26 23:22:41 +01:00
passwd_keys.mk !tools/mkpasswd: PBKDF2 host tool and ROMFS passwd build integration 2026-07-21 20:19:14 +08:00
pre-commit
process_config.py cmake(enhance):include-style defconfig can modified via menuconfig 2026-01-15 15:42:17 -03:00
process_config.sh tools/process_config.sh: Fix sed errors 2025-07-03 09:41:56 -03:00
promptpasswd.sh !tools/mkpasswd: PBKDF2 host tool and ROMFS passwd build integration 2026-07-21 20:19:14 +08:00
ProtectedLibs.mk libbuitin/compiler_rt: Supports separate builtin rt.builtins or rt.profile 2024-11-12 16:12:53 +08:00
refresh.sh tools/refresh.sh: Fix multi-argument parsing 2026-09-10 16:26:53 +02:00
rmcr.c
Rust.defs tools: Enable Rust sim builds on Intel Macs 2026-06-08 21:22:45 +08:00
sethost.sh tools: Enable Rust sim builds on Intel Macs 2026-06-08 21:22:45 +08:00
showsize.sh tools/showsize.sh: support pass custom nuttx executable 2024-10-13 02:11:12 +08:00
simbridge.sh
simhostroute.sh
simlaunch.sh sim:support sim elf and dynamic libs package in post build 2024-11-06 01:56:44 +08:00
size_report.py
splashscreen_converter.py drivers/video/fb.c: Add startup splashscreen option 2025-04-30 06:38:05 -03:00
stackusage.py tools/stackusage.py: use toolchain binaries instead of Python libraries 2026-03-17 11:26:44 -03:00
stm32_pinmap_tool.py fix misspelled names in locally scoped code 2025-05-15 10:12:12 +08:00
Swift.defs debug symbol level: Use config instead 2024-12-04 22:36:45 +08:00
testbuild.ps1 tools/ci: Added esptool for Windows Native 2026-04-13 23:55:10 +08:00
testbuild.sh testbuild.sh: CMake Added -DNXTMPDIR 2026-04-22 06:22:36 +08:00
toolchain.cmake.export tools/export: prefix each linker script in toolchain.cmake. 2026-09-01 17:41:42 +08:00
uncrustify.cfg tools/uncrustify: Update uncrustify for better support 2026-07-17 15:00:06 -03:00
Unix.mk tools/nxflat: Add an Apache-licensed NXFLAT converter. 2026-09-27 11:25:12 -03:00
unlink.bat
unlink.sh
update_romfs_password.sh sched,fs,docs: support setuid sudo helper 2026-08-18 15:57:52 +08:00
version.sh
Win.mk libc: add support for C23 stdbit.h with bit manipulation macros 2026-03-02 09:09:40 -03:00
x86_64-unknown-nuttx-macho.json tools: Enable Rust sim builds on Intel Macs 2026-06-08 21:22:45 +08:00
x86_64-unknown-nuttx.json tools/rust: Fix softfloat abi target spec name 2026-08-13 12:41:54 +02:00
xmlrpc_test.py
Zig.defs tools/Zig.defs: Fix Zig builds on sim:x86_64 2026-07-20 09:36:56 +08:00
zipme.sh