Commit Graph

66 Commits

Author SHA1 Message Date
xuxin19
4439b242d8 Application.mk:ensure that the order when AROBJS is compiled multiple times
sort the target files to ensure that the files in each batch are the same every time
and clean AROBJS.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-10-27 11:52:29 +08:00
xuxin19
efa1f51915 archive:create a copy rule for the ojbs with the same name
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>
2023-10-27 11:52:29 +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
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
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
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
zouboan
776136a113 Fix various error in Windows native build 2022-12-08 13:22:13 +08:00
yinshengkai
ee4d8b738f Makefile: replace INCDIR to INCDIR_PREFIX
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-10 02:38:58 +08: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
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
Alin Jerpelea
ec339bc49a Makefiles: Gregory Nutt: update licenses to Apache
Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-07 21:35:33 -05: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
Ouss4
1dae12ba05 Don't run preconfig, clean or distclean when it's not necessary. 2020-07-25 07:50:28 -06:00
Xiang Xiao
deaa6c5b7b build: Replace $(TOPDIR)/Make.defs with $(APPDIR)/Make.defs
and move NUTTXLIB defintion to the common place

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-09 15:17:37 -03:00
liuhaitao
40c325adfe build: Remove some duplicated definitions
Unified the duplicated definitions into nuttx/tools/Config.mk.

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-05-22 14:18:17 +01:00
Xiang Xiao
ead498a788 build: Remove the workaround for the inexistence of .config/Make.defs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-21 17:43:42 +01:00
Xiang Xiao
36bce2959a build: Remove the duplicated definition
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-19 14:53:21 -06:00
Xiang Xiao
6a26547dec build: Move INCDIROPT to common place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-18 15:37:24 -06:00
Xiang Xiao
d232823e63 build: Replace WINTOOL with CYGWIN_WINTOOL Kconfig
so the correct value can be determinated by Kconfig system automatically

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-18 15:37:24 -06:00
Xiang Xiao
0a6f978771 app/builtin: simplify the application registraion flow
Change-Id: I6b92385e72d0e1a30123f12dbb9c4fd3e90b0315
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-18 09:51:09 -06:00
Xiang Xiao
6ddf347178
Move MAKE_template and SDIR_template to Make.defs (#135)
So Directory.mk and Makefile can share the same definition
2020-03-22 10:06:37 -06:00
YAMAMOTO Takashi
38f006464b Put back libapps to the default LDLIBS, even for KERNEL build
This is a partial revert of b5cfd93444
("apps/: Modification to build system: Unified application compilation rules")
2020-02-26 01:04:52 -06:00
YAMAMOTO Takashi
9d59f5e524 Revert "Remove libapps.a from LDLIBS"
It was necessary for PROTECTED build.

This reverts commit 4ee39e2080.
2020-02-26 01:04:52 -06:00
Xiang Xiao
f774e8ee72 build: Use flock to serialize ar steps as workaround
Use flock to serialize ar steps to avoid parallel build break
sometimes.
2020-02-22 07:43:06 -06:00
YAMAMOTO Takashi
4ee39e2080 Remove libapps.a from LDLIBS
I don't understand how it's supposed to work.
(As libapps.a is likely not fully baked at that point.)

I don't understand why it's necessary either.
2020-02-21 07:37:51 -06:00
YAMAMOTO Takashi
698f0edbaa Revert "build: Use flock to serialize ar steps as workaround"
This reverts commit 6707bfae86.
2020-02-21 07:37:51 -06:00
Xiang Xiao
6707bfae86 build: Use flock to serialize ar steps as workaround
Use flock to serialize ar steps to avoid parallel build break
sometimes.
2020-02-20 13:14:53 -06:00
Gregory Nutt
57f99a6fb7 Make.defs: When building MODULES under Cygwin, the path to libapps.a that is passed to the Windows linker must first be converted with cygpath. 2019-12-04 11:01:43 -06:00
Xiang Xiao
b4482370cf Make.defs: Fix nuttxtoolsunlink.sh: Command not found. 2019-11-11 09:04:10 -06:00
Xiang Xiao
75cd1dfd74 apps/: Move the common variable definitions from other build-related files into apps/Make.defs. 2019-10-17 11:40:39 -06:00
Xiang Xiao
4b49362719 apps/Makefile: Make libapps overwritable. 2019-10-03 14:07:17 -06:00
Xiang Xiao
5d6681dc9f Remove the duplicated build script files from apps/impor/tools. These will now be copied from nuttx/tools when the export package is created. 2019-10-01 07:51:01 -06:00
anchao
b5cfd93444 apps/: Modification to build system: Unified application compilation rules 2018-09-03 09:29:56 -06:00
anchao
220653f21c Squashed commit of the following:
Author: anchao <anchao@pinecone.net>

     apps/, most main() function: Correct CONFIG_BUILD_LOADABLE usage
     Loadable apps/: Correct loadable symbol table generate
     apps/system/ubloxmodem:  Fix build break
     apps/examples/ostest: start restart/waitpid/user test from main loop
     apps/nshlib:  Expand reboot and poweroff commands to include a second, optional mode argument

    Author: Gregory Nutt <gnutt@nuttx.org>

     An attempt to fix build issues.  Does not work.
     apps/examples/ostest:  Fix some inappropriate renaming of static functions introduced with recent patches.
     apps/builtin/exec_builtin.c:  Fix a error introduced by recent comments.  Found in build testing.

    Author: anchao <anchao@pinecone.net>

     apps/builtin/exec_builtin.c:  Try posix_spawn if builtin apps do not have have an entry point.
     apps/Application.mk: introduce MODULE config to simplify tristate(m)
     apps/nsh:  Change the nuttx shell module type to tristate
     apps:  Add loadable application support
     script/mksymtab:  Generate symbol table name by default
     apps/builtin:  Allow loadable applications can register with apps/builtin.
2018-08-23 11:06:15 -06:00
Gregory Nutt
23066a71f0 Grr.. last commit unreverted some changes. I think it is right now. 2018-08-22 12:19:36 -06:00
Gregory Nutt
0bdb179160 Move a copy of define.bat and sh from nuttx/tools to apps/tools so that they will be availalbe for the import build. 2018-08-22 12:08:31 -06:00
Gregory Nutt
2f982e9c77 Revert "Squashed commit of the following:"
This reverts commit 25b92edd9f.
2018-08-22 12:06:32 -06:00
anchao
25b92edd9f Squashed commit of the following:
apps/builtin/exec_builtin.c:  Try posix_spawn if builtin apps do not have have an entry point.
    apps/Application.mk: introduce MODULE config to simplify tristate(m)
    apps/nsh:  Change the nuttx shell module type to tristate
    apps:  Add loadable application support
    script/mksymtab:  Generate symbol table name by default
    apps/builtin:  Allow loadable applications can register with apps/builtin.
2018-08-22 09:30:38 -06:00
Gregory Nutt
922283ee5d Squashed commit of the following:
Merged in masayuki2009/nuttx.apps/loadable_app (pull request #148)

    loadable app support

    * apps: Introduce a build system for loadable apps for nsh.

        This PR consits of following changes. (NOTE: Changes to each
        application will be provided separately)

        apps/nshlib/Kconfig:
        Add 'option modules' to NSH_FILE_APPS so that a user can change
        an application configuration to tristate (y/n/m)

        apps/Make.defs:
        Override COMPILE and COMPILEXX macros to compile loadable apps.
        To make loadable apps, -DLOADABLE_APP is added to the flags.
        Also, introduce ELFLD to link a lodable app.
        Please note that the variable 'LOADABLE' must be defined in
        each application Makefile if you want to make a loadable app.

        apps/Application.mk:
        Add .build target in case of 'LOADABLE=y' which is used to
        link a final loadable application and install the app to
        apps/bin.

        apps/Makefile:
        Add SYMTABSRC and SYMTABOBJ variables for loadable apps which
        will be generated under the apps directory.
        Add make_symbols target which will be called when all applications
        are installed to generate symtab_app.c which is used for
        nsh to inform symbol information to the NuttX kernel.

        Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

    * apps/examples/hello: Apply changes to support a lodable app.

        Kconfig:
        Change the application state from bool to tristate

        Make.defs:
        Change the condition to build. By default, the application is
        not selected (i.e. 'n'), so if other states (i.e. y/m) are
        selected, the application will be compiled.

        Makefile:
        If the application is specified to 'm', the variable 'LOADABLE'
        must be defined here. Also note that other variables (PRIORITY
        and STACKSIZE) can only be used for built-in apps.

        hello_main.c
        Add LOADABLE_APP condition to main().

        Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

    * apps/examples/helloxx: Apply changes to support a lodable app.

        Kconfig:
        Change the application state from bool to tristate

        Make.defs:
        Change the condition to build. By default, the application is
        not selected (i.e. 'n'), so if other states (i.e. y/m) are
        selected, the application will be compiled.

        Makefile:
        If the application is specified to 'm', the variable 'LOADABLE'
        must be defined here. Also note that other variables (PRIORITY
        and STACKSIZE) can only be used for built-in apps.

        helloxx_main.c
        Add LOADABLE_APP condition to main().

        Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

    Approved-by: GregoryN <gnutt@nuttx.org>
2018-08-03 12:05:01 -06:00
Gregory Nutt
cb9e9510d9 apps/Make.defs: Improve the symtab target. tools/mksymtab.sh: Fix a typo. 2018-07-17 11:42:23 -06:00
Gregory Nutt
272bdc0d6e apps Makesystem: Fix an error when building apps/ withtout nuttx/, using only the NuttX export package only and assuming that the nuttx/ directory in not even present. In this case, the problem fixed where the apps/Make.defs file was selecting tools from the /tools directory which does not exist because TOPDIR=apps/import. Instead, for this build case, I have not thought of any option but to duplicate scripts as necessary in the apps/tools directory. Also added a top-level target to compile the symbol table. Misc fixes: quoting in scripts, some errors in script syntax. 2018-07-17 10:42:15 -06:00
Gregory Nutt
e4a30d55ee apps/Make.defs: Simplify last fix 2018-06-11 13:22:52 -06:00
Gregory Nutt
bf232771f6 apps/Make.defs: Fix an error introduced with recent chagne. MKKCONFIG may not be defined resulting in failure to create apps/Kconfig. 2018-06-11 10:21:22 -06:00
Gregory Nutt
0509c48ca3 Various fixes necessary to build the simulator under MSYS. 2018-05-31 13:26:18 -06:00
Gregory Nutt
d2800049a3 Make.defs: Using wrong link script if native window tool used with Cygwin 2016-11-17 07:22:32 -06:00
Gregory Nutt
11012a6c3e Add DIRLINK and DIRUNLOBK tool definitions to Make.defs 2016-08-02 08:38:20 -06:00
Gregory Nutt
11ef5ac1b3 (1) Make.defs set the include path in CFLAGS, but not in CXXFLAGS, (2) canutils/libuavcan/Makefile should not use explication / delimiters. It should not use -I. I should use DELIM: command not found and nuttx/tools/incdir.sh 2016-07-21 11:35:13 -06:00