Commit Graph

140 Commits

Author SHA1 Message Date
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
Xiang Xiao
69cad3c287 build: Remove the annoy warning from distclean
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-22 23:15:02 +08:00
yinshengkai
0e823eadca Makefile: adjust compilation flags order
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-31 16:36:10 +08:00
Xiang Xiao
b94c26fefc build: Generate a staging folder like kernel side
so the user could generate the separate library through BIN.
Here is the similar code snippet copied from nuttx/tools/Unix.mk:
context: include/nuttx/config.h include/nuttx/version.h .dirlinks $(CONTEXTDIRS_DEPS) | staging

staging:
	$(Q) mkdir -p $@

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-27 01:08:11 +02:00
zouboan
776136a113 Fix various error in Windows native build 2022-12-08 13:22:13 +08:00
Ville Juven
bca94fce5a CONFIG_BUILD_KERNEL/libapps.a: Allow creation of libapps.a separately
Add rule to create libapps.a for CONFIG_BUILD_KERNEL=y, there is no
reason to disallow this.

The behavior of make import remains the same, so no regression is expected.
2022-10-18 22:58:13 +08:00
Xiang Xiao
893387b2c5 Fix the minor style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 19:07:16 +02:00
Ville Juven
8c1c0efabc make export: Fix make export for CONFIG_BUILD_KERNEL=y
The condition:
[ -f "$${f}" ] && cp -f "$${f}" "${EXPORTDIR}"$(DELIM)registry ;

Fails if the first part of the condition returns empty / false, stopping
make for no reason due to the error.
2022-10-05 03:13:39 +08:00
YAMAMOTO Takashi
5ee2e6348f Use -fno-builtin for SYMTABOBJ
The code generated by tools/mksymtab.sh uses
```
extern void *var;
```
for ~everything.

After the recent removal of -fno-builtin, [1]
it ends up with warnings:
* -Wbuiltin-requires-header for clang
* -Wbuiltin-declaration-mismatch for gcc

It also generates errors like the following for clang:
```
symtab_apps.c:125:14: error: redefinition of 'strdup' as different kind of symbol
extern void *strdup;
```
I couldn't find a way to disable it.
(it's err_redefinition_different_kind in clang source)

This commit works it around by restoring -fno-builtin
when building SYMTABOBJ.

[1] https://github.com/apache/incubator-nuttx/pull/5476
2022-05-12 23:12:39 +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
Masayuki Ishikawa
7d4b2a517b Makefile, import/Make.defs: Fix undefined symbols for CONFIG_BUILD_KERNEL=y
Summary:
- I noticed that applications made by 'make import' contain
  undefined symbols such as printf for CONFIG_BUILD_KERNEL=y
- This commit fixes this issue by adding user libraries.
- Also, this commit generates libapps.a which is used for init

Impact:
- CONFIG_BUILD_KERNEL=y only

Testing:
- Build (mkimport, make import) with sama5d4-ek:knsh

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-01-27 11:07:20 +08:00
Masayuki Ishikawa
9ea52c1d83 Makefile: Fix make export for CONFIG_BUILD_KERNEL=y
Summary:
- I noticed that 'make export' does not work with swama5d4-ek:knsh
- This commit fixes this issue by always creating the registry directory
  but not copying pdat files for CONFIG_BUILD_KERNEL=y
- This commit also fixes the delimiter issue on Windows
- NOTE: nuttx needs to be updated as well

Impact:
- CONFIG_BUILD_KERNEL=y only

Testing:
- Build (make and make export) with sama5d-ek:knsh

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-01-25 20:26:46 +08:00
Alin Jerpelea
55364e92a8 Makefile: Uros Platise: update licenses to Apache
Gregory Nutt is has submitted the SGA

Uros Platise has submitted the ICLA

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
chao.an
b5692d8034 style/code: remove unnecessary trailing whitespace
N/A

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-28 12:20:10 +01: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
Matias N
053ca8fcca export APPDIR using 'export' keyword (TOPDIR already exported by nuttx/) 2020-09-16 06:20:06 -07: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
chao.an
fde8f24f2a make/import: add post build support
support post processing after binary install

Change-Id: Ifc587f6a8a29372298261c99a4510b680cbb8ec1
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-07-03 23:48:00 -05:00
chao.an
aaa61346c9 make/import: move the binary install to the top Makefile
move the binary install to the main Makefile to support
link extra libraries

Change-Id: I6db8a244ec9975163ea0c21fec6468e215c5aedb
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-07-03 23:48:00 -05:00
chao.an
51388de7a1 make/import: add incdir into import build
fix import build break caused by 'incdir' not found:

$ make import -j12
...
/bin/sh: 1: /home/archer/code/apps/import/tools/incdir: not found
/bin/sh: 1: /home/archer/code/apps/import/tools/incdir: not found

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-07-01 07:17:58 -05:00
chao.an
c81a1f9711 make/import: support install nuttx binary in flat build
Change-Id: Iaffa86ee9ebd77380424e6d4a0777262685c989f
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-30 00:52:07 +01:00
chao.an
13df7aca41 make/import: support depend context on import build
Change-Id: Ia390a2defdb6a71a60a5f3c261b806d13810626e
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-30 00:52:07 +01:00
Xiang Xiao
d03ff1bde6 build: Remove the duplicated mksymtab.sh
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-24 08:26:55 -06: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
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
YAMAMOTO Takashi
779502b4d9 Clean *.bdat and *.pdat on clean_context target 2020-03-26 22:29:28 -05:00
Xiang Xiao
1511403fdf Revert "Don't generate .depend anymore"
This reverts commit cc5ad09caa.
2020-03-22 23:09:40 -05:00
Xiang Xiao
f074d7f376 Makefile: let install depend on the target binary
to ensure the binary get built and install once
2020-03-22 22:42:13 +00:00
Xiang Xiao
cc5ad09caa
Don't generate .depend anymore 2020-03-22 18:15:21 +00: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
Xiang Xiao
ad552c8c7b Makefile don't change symtab_apps.c timestamp if no any change
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I55576aec46bd057bc98cf2b6579d7ac96446ae27
2020-03-21 16:50:11 +09:00
liuhaitao
06c9f9359e Makefile: remove context dependency to avoid apps context build twice
In nuttx pass1dep and pass2dep builds, context firstly would be built once.
It then call 'make -C apps depend' which would trigger the context built twice.
There is race condition between symtab.c generated by mksymtab.sh in second time
and compiling symtab.c in parallel build. So remove context dependency for apps
depend to make sure context build only one time for apps.

Parallel build break logs as below:
/home/jenkins/jenkins-slave/workspace/NuttX-Nightly-Build/apps/examples/elf/elf_main.c:357: undefined reference to `g_elf_nexports'
riscv64-unknown-elf-ld: /home/jenkins/jenkins-slave/workspace/NuttX-Nightly-Build/apps/examples/elf/elf_main.c:357: undefined reference to `g_elf_exports'
make[1]: *** [nuttx] Error 1
make: *** [pass2] Error 2

Change-Id: I2872f7036e7ec86615efc5ebd7c46cee51dc1094
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-03-20 08:30:15 +09: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
David Sidrane
119f81f30a Revert "Avoid calling ARCHIVE in multiple places"
This reverts commit 52222cb020.
2020-02-21 11:31:34 -06:00
YAMAMOTO Takashi
52222cb020 Avoid calling ARCHIVE in multiple places
Because it isn't safe to run multiple instances to libapps.a
concurrently.
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
367b4d7e5b apps/Makefile: Fix APPDIR path for native build.
A recent change gets the APPSDIR root directory path from:

        APPSDIR = $(CURDIR)

    Where CURDIR is a special variable maintained by GNU make.  In the native build, GNU make is provided by GNUWin32.  The value of CURDIR provided by the GNUWin32 CURDIR is not POSIX, but not quite windows compatible either.  It does return paths that start with C: or D:, but uses forward slashes for path segment delimiters, not backsalshes as required by Windows tools.

    This fix here is to use $(CURDIR) to get the APPSDIR path for file inclusions, that part is fine.  But then, if we find out we are doing a native build, the update the APPSDIR using shell %CD% environment variable which is the authoritative source of the current working directory under Windows.
2020-01-17 16:22:54 -03:00
Xiang Xiao
7f653a87f7 Makefile: Fix warning: jobserver unavailable: using -j1. Add '+' to parent make rule. 2019-10-29 07:55:02 -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
Gregory Nutt
3a23523147 Makefiles: This reverts part of commit cf0365ea9. It restores 'conditional' inclusion of TOPDIR/Make.defs. Otherwise all make targets fail if the board has not been configured. That is okay most of the time, but not for things like clean and distclean which should not depend on being configured. 2019-10-15 09:25:48 +08:00
Xiang Xiao
c901181a39 Makefile, Application.mk: Clean up cygpath usage
1.Remove cygpath from the related path since the conversion isn't necessary
2.Call cygpath inplace for the absolute path to avoid the confusion
2019-10-07 02:55:44 -06:00
Xiang Xiao
cf0365ea92 Clean up Makefile under apps folder no functional changes. 2019-10-04 08:35:46 -06:00
Xiang Xiao
4b49362719 apps/Makefile: Make libapps overwritable. 2019-10-03 14:07:17 -06:00
Xiang Xiao
e73ca15c99 Makefiles: Change ${shell pwd} to $(CURDIR) since pwd doesn't exist on Windows 2019-10-02 07:06:50 -06:00
Xiang Xiao
18bd9acd3d apps/Makefile: Move APPDIR set to the first and remove APPDIR from command line but ensure TOPDIR/BINDIR are always set in command line. 2019-10-01 11:46:38 -06:00