Commit Graph

107 Commits

Author SHA1 Message Date
xuxin19
a3bbea86ff remove the check that progname matches mainsrc
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-10-10 01:02:50 +08:00
chao an
1f96e32fcd makefile/archive: fix build break if object target is split to multi-part
Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-13 17:15:05 +08:00
chao an
52353a7eb2 apps/build: Restore ARLOCK to improve compile speed in incremental case
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>
2023-09-12 21:55:39 +08:00
xuxin19
55647b8458 Application.mk:upgrade warning to error
for the case where MAINSRC and PROGNAME do not match

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-09-11 16:37:05 +08:00
xuxin19
a2e6e6c243 Application.mk:execute archive in batches
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-31 11:41:04 +08:00
SPRESENSE
5058a0dba7 Application.mk: Remove warning that program names mismatch
Avoid warning when PROGNAME contains space blank.
2023-08-26 01:18:10 +08:00
xuxin19
4765cc3411 Application.mk:define main entry MAINNAME relatively
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>
2023-08-24 23:36:30 +08:00
fangxinyong
b0933fe431 builtin: uid and gid configuration for builtin app
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>
2023-08-14 11:47:55 +08:00
xuxin19
8e71885ee5 Enhance Makefile to avoid "Argument list too long"
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>
2023-08-10 11:16:07 +08:00
Huang Qi
56a20a202d Move Wasm.mk to end of file since it need definition from Application.mk itself.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-07-20 08:10:52 +02:00
Huang Qi
3d5183f404 tools: Merge WASM_BUILD and WASM_BUILD_ONLY
By make WASM_BUILD as a three state variable: y , n or both.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-07-17 23:14:47 +08:00
Huang Qi
b4ec3d7d4a tools: Don't register app into nsh if WASM_BUILD_ONLY == y
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-07-14 01:29:54 +08:00
SPRESENSE
86efbcbee7 Change the way of definition of SUFFIX
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.
2023-06-26 10:20:40 +02:00
Stuart Ianna
40886698fb mk: Attempt to silence "Nothing to be done for xx" messages.
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.
2023-06-23 17:05:56 +08:00
Xiang Xiao
a2f01f5e64 build: Replace "$(shell $(DEFINE) $(CC) ...)" with $(DEFINE_PREFIX)
to unify the way to define macros in Makefile

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-22 23:27:26 +03:00
Huang Qi
23948824b2 tools: Disable wasm build if no wasm runtime enabled
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-05-19 20:21:23 +08:00
Huang Qi
dec2cd9635 tools/Wasm: Decouple the wasm compilation and runtime specific AOT compilation
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-05-13 10:15:40 -03:00
Huang Qi
f99209215d tools: Provide a defualt RUSTELFFLAGS if not defined
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-05-13 10:15:40 -03:00
Xiang Xiao
503b4ccf82 Fix the indent issue found in build script
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-17 12:00:17 -03:00
chao an
d33c9d3669 application.mk: add extera objects into $(OBJS) depends
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>
2023-03-08 18:53:03 +02:00
chao an
7ad9525c35 Application: fix multiple main target mismatch during incremental compile
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>
2023-03-08 08:56:09 +01:00
chao an
4f11f38c38 interpreters/wamr: add compile role of WebAssembly
Add compilation rules to support WebAssembly(WASM/WAMR):

1. Compile Toolchain
 1> Download WASI sdk and export the WASI_SDK_PATH path:

$ wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz
$ tar xf wasi-sdk-19.0-linux.tar.gz
Put wasi-sdk-19.0 to your host WASI_SDK_PATH environment variable, like:
$ export WASI_SDK_PATH=`pwd`/wasi-sdk-19.0

 2> Download Wamr "wamrc" AOT compiler and export to the PATH:
$ mkdir wamrc
$ wget https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-1.1.2/wamrc-1.1.2-x86_64-ubuntu-20.04.tar.gz
$ tar xf wamrc-1.1.2-x86_64-ubuntu-20.04.tar.gz
$ export PATH=$PATH:$PWD

2. Configuring and running

 1> Configuring sim/wamr and compile:

nuttx$ ./tools/configure.sh  sim/wamr
nuttx$ make
...
Wamrc Generate AoT: /home/archer/code/nuttx/n5/apps/wasm/hello.aot
Wamrc Generate AoT: /home/archer/code/nuttx/n5/apps/wasm/coremark.aot
LD:  nuttx

 2> Copy the generated wasm file(Interpreter/AoT)

nuttx$ cp ../apps/wasm/hello.aot .
nuttx$ cp ../apps/wasm/hello.wasm .
nuttx$ cp ../apps/wasm/coremark.wasm .

 3> Run iwasm

nuttx$ ./nuttx
NuttShell (NSH) NuttX-10.4.0
nsh> iwasm /data/hello.wasm
Hello, World!!
nsh> iwasm /data/hello.aot
Hello, World!!
nsh> iwasm /data/coremark.wasm
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 12000
Total time (secs): 12.000000
Iterations/Sec   : 5.000000
Iterations       : 60
Compiler version : Clang 15.0.7
Compiler flags   : Using NuttX compilation options
Memory location  : Defined by the NuttX configuration
seedcrc          : 0xe9f5
[0]crclist       : 0xe714
[0]crcmatrix     : 0x1fd7
[0]crcstate      : 0x8e3a
[0]crcfinal      : 0xa14c
Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 5.000000 / Clang 15.0.7 Using NuttX compilation options / Defined by the NuttX configuration

Co-Authored-By: Huang Qi <huangqi3@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-03-06 13:23:44 +02:00
Xiang Xiao
21bc466a2b Remove the tail space char from all files
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-03 00:18:36 +02:00
chao an
9ccff7b349 apps/Application.mk: silent all compile output
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 22:12:49 +08:00
Huang Qi
a275567ad0 Application.mk: Provide a default ZIGELFFLAGS if not defined
Avoid add ZIGELFFLAGS to each board level Make.defs by default value.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-02-01 11:12:15 +08:00
zouboan
776136a113 Fix various error in Windows native build 2022-12-08 13:22:13 +08:00
yinshengkai
bd2efd9f51 tools: replace DEFINE to DEFINE_PREFIX
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-11 01:18:32 +08:00
Ville Juven
f844db5194 libapps.a: Add the static application library always to the target libraries
This error was made by me a long time ago, not understanding how the kernel
mode build is expected to work. So partially revert PR#946.
2022-10-18 22:58:13 +08:00
Huang Qi
5d972ba6d5 Application.mk: Fix Zig build break
Correct wrong make variable name for Zig main source,
and update compile command for latest compiler.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-09-10 11:09:22 +08:00
Ville Juven
e2f0ae3816 import/Make.defs: Fix C++ library linkage with CONFIG_BUILD_KERNEL
Encapsulate link libraries with start/end group
2022-04-29 12:09:15 +03:00
chao.an
ab5e7496d5 Makefile/Application: correct COMPILER_RT_LIB PATH
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-16 00:33:00 +08:00
Matheus C. França
2796187bdf Update Application.mk 2022-03-16 19:59:08 +02:00
Matheus Catarino França
cdb04f6172 Zig hello-example
rename example - fix

confusion-rename fixed

zigflags added

rm zigflag single-threaded

zig rules added
2022-03-16 12:18:01 +08:00
Alin Jerpelea
0208f6469b apps: examples: Omni Hoverboards Inc. update licenses to Apache
Gregory Nutt has submitted the SGA
Omni Hoverboards Inc. has submitted the SGA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2022-03-08 17:04:01 +02:00
Xiang Xiao
bc5d1165aa Replace cygpath with CONVERT_PATH
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-20 16:08:10 +01:00
Piet
df6b892c4b apps: Enable Rust based application. 2022-02-19 17:59:13 +08:00
YAMAMOTO Takashi
09d778558c Application.mk: Link the compiler runtime for ELF modules
An alternative is to have symbols like __udivdi3 in
the symbol table explicitly when loading the module.
But I feel it's too cumbersome to maintain.
2022-02-04 04:05:44 +08:00
Ville Juven
d1bcd2977c Fix link error due to missing libapps.a in KERNEL build
The import target for kernel build now fails, due to setting libapps.a
as the default value for the BIN variable.

The fail happens when the ELFLD function passes the LDLIBS parameter
(which contains BIN / libapps.a) for the linker. There is no rule to
create libapps.a in the case of the kernel build, so the linker gives
an error due to it being missing.

This commit patches this behavior so that BIN is not appended to
LDLIBS. Another option would be to implement a dummy rule to create
libapps.a, but looking at the git history this is no longer wanted
behavior, thus the error is patched like this.
2021-12-29 06:54:36 -06:00
ligd
b72b4e4bad Application.mk: correct depends file generated
wrong: file.c => file.dir.o
right: file.c => file.c.dir.o

Change-Id: I5dff2c05c88d4c5d7678acdcce15e87caa23bdaf
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-12 17:52:10 -03:00
ligd
b831e1192e Application.mk: correct depends file generated
wrong: file.c => file.dir.o
right: file.c => file.c.dir.o

Change-Id: I5dff2c05c88d4c5d7678acdcce15e87caa23bdaf
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-06 07:03:03 -05:00
Xiang Xiao
9b7fe15bfb Generate c source code dependence with c compiler and flags
It's wrong to invoke the c++ compiler with c++ flags

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2536daa764275221ca530fd5abfc7568af921570
2021-07-06 07:03:03 -05:00
ligd
4f68f43cc2 apps/Application.mk: support compile same prefix file in one folder
example:
one folder has aa.s aa.c aa.cpp, then only compile one file.

fix:
add .s/S/c/cxx/cpp to $(SUFFIX)

Change-Id: I6dbc66dda2c10415a698513285313f59f7dda054
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-03 01:50:42 -05:00
Xiang Xiao
7e983490e8 build: Remove the redundant check from Applicaiton.mk
it's better to report error if user forget set PRIORITY or STACKSIZE

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-04-06 08:26:21 +01:00
Gustavo Henrique Nihei
a1df2c634f build: Fix deplist regeneration after config update 2021-03-25 10:23:33 +01:00
Xiang Xiao
d656982f7a build: Remove the null assignment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-03-24 18:38:04 +01:00
ligd
df389bc332 apps/Application.mk: fix compile assmbely error
Change-Id: Ia611ed0753dbfd861cc8f5e2bff71bc305a47657
2020-09-21 09:16:02 +02:00
dongjiuzhu
d635fcb2d8 application.mk: fix multi MAINSRC match suffix in single Makefile
Change-Id: I998defe7208e4f3a9ae6aede33c54297ee27bd5f
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-09-19 08:05:47 -07:00
ligd
3c4089ef30 apps/MAKE: Add register staging to context
context -> context
           register

Change-Id: Ief13064cd2faac31fbaf7140ae2e144d0881b2a1
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-09-19 10:44:17 -03:00
Huang Qi
e5e3c36b35 build: Support both .s & .S files
Change-Id: I61d213f28e542d7a5df388312281b7601af2f86a
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-09-15 15:07:27 +08:00
Matias N
18137c0fec 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.
2020-09-14 15:55:06 +08:00