Do not define nx_priority for applications that use SCHED_PRIORITY_DEFAULT. The ELF loader already uses its scheduler default when the symbol is absent, avoiding the invalid priority-zero value previously encoded by Application.mk.
Keep emitting nx_priority, and retaining it through stripping, for explicit numeric priorities.
Assisted-by: Zed:GPT-5.6 Terra
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
Emit --defsym for nx_stacksize, nx_priority (and nx_uid/nx_gid/nx_mode
under CONFIG_SCHED_USER_IDENTITY) into MODLDFLAGS so the ELF binary
loader can recover the application's configured attributes at load time.
Also skip builtin registration for separately-built module ELFs
(BUILD_MODULE instead of DYNLIB).
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Program names containing '-' (e.g. renaming hello to hello-world via
PROGNAME) previously generated an invalid identifier <PROGNAME>_main
when constructing internal entry-point symbols. This caused build
failures for C/C++ applications due to invalid identifiers in compiler
definitions and generated builtin_proto.h.
Introduce PROGSYM, a sanitized copy of PROGNAME with '-' replaced by
'_', and use it wherever an internal C/Zig identifier is constructed
(the -Dmain= defines, the Zig RENAMEMAIN rule, and the REGISTER
call's entry-point argument). Preserve the original PROGNAME for the
registered NSH command name and builtin registry entry, where hyphens
are valid and expected.
The Zig RENAMEMAIN path is also updated to use PROGSYM for consistency.
The current hello_zig and leds_zig examples do not exercise this path,
since neither uses a literal 'fn main' entry point, but the change
keeps symbol generation consistent for future Zig applications.
Testing (WSL2 Ubuntu, x86_64, sim:nsh):
- CONFIG_EXAMPLES_HELLO_PROGNAME="hello-world": clean build,
'hello-world' runs and prints 'Hello, World!!'
- Reverted to default PROGNAME="hello": clean build, no regression
- Confirmed by inspection that RENAMEMAIN's sed substitution does not
fire on either current .zig source (generated _tmp.zig is
byte-identical to the source)
Fixes#19447
Signed-off-by: Ansh Rai <anshrai331@gmail.com>
The current distclean implementation has two issues:
1. Application.mk does not remove .kconfig on distclean, so stale
config fragments from earlier builds can pollute subsequent ones.
2. Several external-library Makefiles (lame, libshvc, libulut) run
"make -C <subdir> distclean" without checking whether the
subdirectory exists. When the library was never downloaded (common
in CI partial-build environments), distclean fails with "No such
file or directory".
Fix:
- Application.mk: add $(call DELFILE, .kconfig) to the distclean
target so that .kconfig is cleaned along with .built, .depend, etc.
- audioutils/lame/Makefile: guard the distclean recipe with
"if [ -d $(DST_PATH) ]; then ...; fi" and use $(MAKE) instead
of bare make.
- netutils/libshvc/Makefile, netutils/libulut/Makefile: same
directory-existence guard for their distclean recipes.
- crypto/wolfssl/Makefile: change "distclean:" to "distclean::"
(double-colon) so it does not override the distclean:: rule
inherited from Application.mk.
Signed-off-by: hanzhijian <hanzhijian@zepp.com>
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>
PREFIX needs to be added to Make.dep to avoid Make.dep regeneration during incremental compilation
AROBJSRULES is just the .o file in the copy archive. Its output content is worthless, so we hide it by default.
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
we can build a module like app,
use 'DYNLIB' mark current path is a loadable module
and CFLAGSELF and CMODFLAGS can act on
these compiled as loadable module
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
by defining the `PREFIX` variable and setting it to an external path,
`make -C /some/app` can be called independently to build a separate application out_tree.
modify Make.defs and Application.mk so that their dependent variables can be overwritten.
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
according to the dependency of the .depend target, Make.dep is always generated additionally when src is modified.
this will cause the Make.dep file to gradually increase in size during each incremental compilation, causing the Makefile to take longer to load.
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This requires nuttx/pull/11548 to work.
- Zig apps can use normal entrance "main()" now as we
- added RENAMEMAIN for none BUILD_MODULE case.
- enabled Zig program building in BUILD_MODULE case.
Note the Zig main source need to have "fn main(" pattern as
renaming is implemented via `sed`.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
when there are too many target files in archive and need to be processed in batches,
in order to avoid file replacement due to duplicate names,
we dynamically rename the target files here.
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
To solve the issue of carrying object files from previous builds,
Matias changed the archiving process to re-archive libapps.a on every compilation,
if libapps.a carries more object files, incremental compilation will waste too
many time in re-archiving, compared with the previous implement, this is a degradation
of the build system. Referring to mature engineering projects such as cmake, if there
is configuration or source file changed, the best solution should be to reconfigure
the environment.
Revert this PR to ensure the compilation speed during incremental compilation.
| commit 18137c0fec
| Author: Matias N <matias@protobits.dev>
| Date: Sat Sep 12 00:36:23 2020 -0300
|
| Fix: ensure archive files do not carry object files from prior builds
|
| This is the corresponding change to the one on main NuttX repo. In this
| case this involves splitting the build of libapps.a into: a) building
| all applications (which is safely parallelizable), b) adding each
| application's object files to the archive in turns (serial by nature).
|
| This removes the need for the flock used to protect the parallel build.
Testing:
sim:nsh
-------------------------------
| Patched | Current
-------------------------------
|$ time make | $ time make
|real 0m1.270s | real 0m1.728s
|user 0m0.971s | user 0m1.276s
|sys 0m0.363s | sys 0m0.530s
-------------------------------
Private project (20+ 3rd library needs archive to libapps.a)
-------------------------------
| Patched | Current
-------------------------------
|$ time make | $ time make
|real 0m21.181s | real 0m39.721s
|user 0m14.638s | user 0m24.837s
|sys 0m6.919s | sys 0m14.394s
-------------------------------
Signed-off-by: chao an <anchao@xiaomi.com>
when a program has multiple MAINSRC for incremental compilation,
the PROGNAME of the compiled file may generate errors
-------------------- compile definition error ---------------------
cc -c -g CFLAGS INCLUDEDIR -Dmain=funA_main funB.c -o funB.c.path.o
^^^^ ^^^^^^ ^^^^
-------------------------------------------------------------------
use the MAINOBJ:PROGNAME mapping variable to define the main entry name
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
File uid and gid configuration for builtin fs, if set-user-ID bit is set
in the file permissions, then the euid of process set as file uid. Use
the confiuration to emulate builtin app set.
MODE must octal number and use similar with linux chmod OCTAL-MODE FILE
UID = 2000
GID = 3000
MODE = 06555
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
define a macro for split long variable and redefine variable in batch.
see details in `apps/Make.defs` `SPLITVARIABLE`.
replace the variable reference that caused the error.
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
When archiving, if the number of files is large, the full path
in SUFFIX may exceed the command line limit for Cygwin and other
programs. To avoid this, the SUFFIX can be changed in the Makefile
in each application or library.
When rebuilding, it's not really useful to see reams of "Nothing to be done for" for every application being built. This change attempts to silence these messages.
Added support for extra object files to describe compilation rules
in private libraries to support some special compilers, especially
they contain some special compilation rules (eg: X86 nasm/yasm)
Signed-off-by: chao an <anchao@xiaomi.com>
MAINSRC will fail to match with PROGNAME if one of main source is changed in incremental compilation
this PR will correct this issue.
Signed-off-by: chao an <anchao@xiaomi.com>