Commit Graph

1172 Commits

Author SHA1 Message Date
Alan Rosenthal
57a19de451 Improve dirlinks dependencies for Makefile.win
This PR improved dirlinks dependencies for Makefile.unix: https://github.com/apache/incubator-nuttx/pull/5069

This PR copies the changes into Makefile.win
2022-01-05 02:03:08 +08:00
Alan Rosenthal
0951f70df6 Improve dependencies for include/nuttx/version.h
`include/nuttx/version.h` is dependent on `.version`, which needs to run for every invocation of make, since git info can update at any time.
Currently the `.version` target is PHONY, thus making `include/nuttx/version.h` and `context` targets (and every target that depends on `context`) have to run every time.

This PR modifies `.version` so it's a real rule. Additionally, `tools/version.sh` is run every invocation of make. This maintains the current behavior while preventing some targets from needlessly running every time
2022-01-04 17:49:39 +01:00
Eero Nurkkala
b4d2944df7 tools/mpfs: prepare OpenSBI image
Polarfire Icicle board has only (128K - 256) bytes for the bootloader
in the non-volatile eNVM. This space is barely enough for running NuttX.
If OpenSBI is selected, it will be placed in DDR. This all means the
nuttx.bin file grows into gigabyte size, filling the unused space (ddr -
envm) with zeroes.

The memory layout is as follows:

MEMORY
{
    ddr  (rx)          : ORIGIN = 0x80000000, LENGTH = 4M
    envm (rx)          : ORIGIN = 0x20220100, LENGTH = 128K - 256
    l2lim  (rwx)       : ORIGIN = 0x08000000, LENGTH = 1024k
    l2zerodevice (rwx) : ORIGIN = 0x0A000000, LENGTH = 512k
}

OpenSBI library is used as a separate binary, which is stored into
eMMC or SD-card. It is then loaded into its precise location in DDR.

Thus, we separate OpenSBI from NuttX and end up with two images
by utilizing the objcopy options:

  --only-section=sectionpattern (-j in short)
  --remove-section=sectionpattern (-R in short)

This is only valid when CONFIG_MPFS_OPENSBI is set.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-01-04 19:45:14 +08:00
Alan Rosenthal
2366795786 Improve dependencies for dirlinks.
This PR updates the dependencies for `dirlinks` so they're all real files. This allows `dirlinks` rule to not have to be rerun every time.
This PR also changes the name from `dirlinks` to `.dirlinks`, since a file named `.dirlinks` is created to denote that all symlinks have been created

Changes:
* tools/link.sh
  * link.sh now detects broken symlinks. Previously, it would return `0` if the symlink existed, but didn't point to anything.

* tools/Makefile.unix
  * Added dependencies to symlinks as order-only prerequisites. See https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html
  * Removed `touch` from symlink recipes by specifying them as order only prerequisites.
  * Check Kconfig variables before adding directories as symlinks
  * Added rule for `$(TOPDIR)/arch/dummy/Kconfig`
  * Added rule for `$(ARCH_SRC)/board/board`
  * Added pattern rule (similar to `CONTEXTDIRS_DEPS`) for external folder dirlink dependencies
  * Use $(APPDIR) instead of $(CONFIG_APPS_DIR), since on line 64 $(APPDIR) is validated and `realpath` is called on the path
  * Added a rule `clean_dirlinks` to cleanup the symlinks in the correct order

* .gitignore
  * Added ignore rule for `.dirlinks`

Testing
Step 1: configure nuttx:
```
$ (cd tools && ./configure.sh -a ../incubator-nuttx-apps stm32f3discovery:nsh)
```
part of the configure step ends up calling `.dirlinks`.

Step 2: We can confirm that `.dirlinks` doesn't need to be run again by running with the question flag: `--question`
```
$ make .dirlinks --question
$ echo $?
0
```

Step 3: confirm `make` succeeds.
```
make
```
2022-01-03 17:12:18 +01:00
ligd
75aec04330 serial: add CONFIG_TTY_LAUNCH support
this allow user start new program from tty

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-01-01 20:38:26 +08:00
Gustavo Henrique Nihei
9e5e60ba48 esp32s2/esp32c3: Build MCUboot bootloader with Flash Encryption support 2022-01-01 20:37:44 +08:00
zhouliang3
1f53a058fa nuttx:Change fs strncpy to strlcpy to avoid losing'\0'
Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
2021-12-30 18:06:00 +08:00
Alan Rosenthal
88f07bd229 Remove .clean_context
These changes are from this PR: https://github.com/apache/incubator-nuttx/pull/5069
However I felt they were better as a stand only change.

The `.clean_context` dependency didn't make sense. It was a workaround to ensure that `context` was cleaned when the `.config` changed.
Rather than having a work around, this PR ensures that `clean_context` is run when the `olddefconfig` target is run

Verified locally by running: `tools/testbuild.sh -j 100 -e '-Wno-cpp -Werror' tools/ci/testlist/arm-01.dat`
2021-12-30 12:05:00 +08:00
Huang Qi
c2e8c92b25 arch/risc-v: Refine Toolchain.defs
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-28 00:30:10 -06:00
Petro Karashchenko
3ccb657dc2 nuttx: remove space befone newline in logs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-27 21:01:19 -06:00
ligd
10ccba6671 init: move USERMAIN_XX out of INIT_ENTRYPOINT
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-24 08:23:30 -06:00
Alan Rosenthal
5d07dc96a8 Improve Makefile.[unix|win]::context's dependencies
This pull request improves the dependencies for Makefile.unix::context rule.
* `include/math.h`, `include/float.h`, `include/stdarg.h`, `include/setjmp.h` are only added to `context`'s dependency if the Kconfig value is set. This prevents `context` from trying to make `include/math.h` only to find out there's no command to create the file.
* Instead of executing $(CONTEXTDIRS) in a for loop in the `context` rule, $(CONTEXTDIRS) are added as a dependency to `context` and a rule is created to create the targets. Real files are used, to prevent needlessly rebuilding the same `context` over and over and over again.
* Instead of making the directory `staging`, add it as an order-only dependency for `context`. this ensures the directory is only created if it doesn't exist.

Tested by running:
```
(cd tools && ./configure.sh -a ../incubator-nuttx-apps stm32f3discovery:nsh)
make context
```

First time running context:
```
➜  incubator-nuttx git:(improve-make-context) time make context
make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx/tools'
make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/tools'
make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx'
make[2]: Entering directory '/home/user/code/fitbit/incubator-nuttx/boards'
make[2]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/boards'
make[2]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps'
make[3]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
make[3]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
make[3]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps/builtin'
make[3]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps/builtin'
make[2]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps'
make[2]: Entering directory '/home/user/code/fitbit/incubator-nuttx/graphics'
make[3]: Entering directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
make[3]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
make[3]: Entering directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
make[3]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
make[3]: Entering directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
make[3]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
make[2]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/graphics'
make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx'
Create .version
make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx/tools'
make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/tools'
Create version.h
LN: include/arch to arch/arm/include
LN: include/arch/board to /home/user/code/fitbit/incubator-nuttx/boards/arm/stm32/stm32f3discovery/include
LN: include/arch/chip to arch/arm/include/stm32
LN: arch/arm/src/board to /home/user/code/fitbit/incubator-nuttx/boards/arm/stm32/stm32f3discovery/../common
LN: arch/arm/src/board/board to /home/user/code/fitbit/incubator-nuttx/boards/arm/stm32/stm32f3discovery/src
LN: arch/arm/src/chip to arch/arm/src/stm32
LN: /home/user/code/fitbit/incubator-nuttx/drivers/platform to /home/user/code/fitbit/incubator-nuttx/drivers/dummy
make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx/boards'
make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/boards'
make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps'
make[2]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
LN: platform/board to /home/user/code/fitbit/incubator-nuttx-apps/platform/dummy
make[2]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps'
make context  0.95s user 0.45s system 109% cpu 1.281 total
```
second time running context:
```
➜  incubator-nuttx git:(improve-make-context) time make context
Create .version
Create version.h
LN: include/arch/board to /home/user/code/fitbit/incubator-nuttx/boards/arm/stm32/stm32f3discovery/include
make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx/boards'
make[1]: Nothing to be done for 'dirlinks'.
make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/boards'
make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps'
make[2]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
LN: platform/board to /home/user/code/fitbit/incubator-nuttx-apps/platform/dummy
make[2]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps'
make context  0.30s user 0.20s system 121% cpu 0.414 total
```
2021-12-22 16:10:13 -03:00
Gustavo Henrique Nihei
1c8e84b341 risc-v/esp32c3: Add Secure Boot support on top of MCUboot
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-21 07:02:40 -06:00
Gustavo Henrique Nihei
f542ab4564 xtensa/esp32s2: Add Secure Boot support on top of MCUboot
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-21 07:02:40 -06:00
Gustavo Henrique Nihei
d22a2aa7a0 xtensa/esp32: Refactor makefiles for compliance to Function Call Syntax
According to Make documentation:
- "Commas and unmatched parentheses or braces cannot appear in the text
  of an argument as written";
- "Leading spaces cannot appear in the text of the first argument as
  written".

Although in the current state it was not resulting in parsing issues, it
is better to fix it.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-21 07:02:40 -06:00
Gustavo Henrique Nihei
6c3223289f xtensa/esp32: Add Secure Boot support on top of MCUboot
This adds the capabitlity of building signed images on NuttX.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-21 07:02:40 -06:00
chao.an
d20bd62e08 libc/allsyms: Load all symbols for debugging
let the nuttx print out symbolic crash information and
symbolic stack backtraces. This increases the size of the nuttx
somewhat, as all symbols have to be loaded into the nuttx image.

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-13 08:31:13 -06:00
Xiang Xiao
1ba1f3f24b tools/size_report.py: Fix the lint error
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-05 16:55:52 +01:00
Xiang Xiao
9bc00c4b58 tools: Rename size_report to size_report.py
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-05 16:55:52 +01:00
Lingao Meng
5ed85ef476 tools: Adapt Zephyr/zephyr to Nuttx/nuttx
Adapt Zephyr/zephyr to Nuttx/nuttx

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-03 08:16:52 -06:00
Lingao Meng
87772796e3 tools: Add size report script
Add a resource statistics script, which can be used to
analyze the resource occupation of ELF files, including
BSS, data, ROM, etc.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>

LICENSE: Add size_report to license file

Declare license for intel Corporation.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-03 08:16:52 -06:00
Aaron Rumpler
422b596987 tools/rp2040: Compile with C++14 2021-12-01 06:54:41 -06:00
Petro Karashchenko
298c372afa tools/nxstyle: fix nxstyle check for pointer to function types
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-11-26 14:55:34 -03:00
Xiang Xiao
36a6f4cd09 tools/checkrelease.sh: Launch nuttx after build
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-23 17:17:24 +01:00
Xiang Xiao
403b09fa60 tools/release.sh: Build sim:asan instead of sim:nsh
since sim:asan could do more check

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-23 17:17:24 +01:00
chao.an
33044cdd10 tools/gdbinit: fix symbol mismatch if BOARD_LATE_INITIALIZE disable
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-11-22 21:58:06 -06:00
chao.an
6268fbd208 tools/gdbinit: add sim:x86-m32 support
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-11-22 21:58:06 -06:00
zhuyanlin
407bc04934 tools: add gdbplugin for JLinkGDBServer nuttx thread aware
Use `JLinkGDBServer -rtos libnuttxplugin` to add this plugin.
Then in gdb can use command:
  - `info threads` to show all threads infos
  - `thread (id) ` to switch thread.
  - `bt` to show thread backtrace.

Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2021-11-10 14:31:10 -03:00
Xiang Xiao
eee85faab1 tools/mkconfig: Remove the redundant skip_space
the same thing is already done at line 136
and remove the redundant cast too

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-07 18:47:14 +01:00
Xiang Xiao
e81182df14 tools/mkconfig: Handle string with escape character correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-07 18:47:14 +01:00
Xiang Xiao
df877a8a91 boards/sim: Add new config for KASan
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-02 13:32:47 -03:00
chenwei23
39cdd99d77 mm: Support the kernel address sanitizer
Signed-off-by: chenwei23 <chenwei23@xiaomi.com>
2021-11-02 13:32:47 -03:00
yinshengkai
ee17ae5ba1 tool: add code coverage tool 2021-10-29 19:21:23 +02:00
liucheng5
d1ebdf6e65 fix: nxstyle: fix a bug after "'\'"
When nxstyle.c detects a "\'", it seeks the other "\'", records the index as "endndx", then skip the "'x'". But it makes the index "n" as "endndx+1".Then it comes to the "n++" in "for()". So the character after "'x'" will be skipped, causing some errors.
For example, "{"devid", no_argument, NULL, 'i'},", the "}" will be skipped, causing a lot of error reports.
Now it's fixed.

Signed-off-by: liucheng5 <liucheng5@xiaomi.com>
2021-10-28 09:59:36 -05:00
Tomasz 'CeDeROM' CEDRO
2abe1e9282 configure/sethost: Add BSD host (-B switch) + MAKECMD (make vs gmake).
This patch adds -B switch to select BSD host platforms.

Linux uses GNU Make as default, command is `make`.
BSD uses BSD Make as default, command is also `make`.
BSD can also use GNU Make, but the command is `gmake`.
This patch uses `make` on GNU platforms and `gmake` on BSD platforms.

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>

tools/sethost.sh: Add BSD host (-B switch) + MAKECMD (make vs gmake).

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>

tools/configure.c: Add BSD host (-B switch).

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
2021-10-25 16:39:13 -03:00
Gustavo Henrique Nihei
eb889b0884 xtensa/esp32s2: Enable Partition Table allocation at custom offset
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-10-25 16:34:58 -03:00
Gustavo Henrique Nihei
eb7ffd014e risc-v/esp32c3: Enable Partition Table allocation at custom offset
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-10-25 16:34:58 -03:00
Gustavo Henrique Nihei
9d7b9821b3 xtensa/esp32: Enable Partition Table allocation at custom offset
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-10-25 16:34:58 -03:00
Gustavo Henrique Nihei
0299e7d35d tools/esp32: Refactor generation of QEMU-compatible image
Use the merge_bin builtin function from esptool.py.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-10-19 23:23:43 +02:00
Xiang Xiao
8b67944c75 sched: Remove pidhash_s and move ticks to tcb_s
simplify the code logic and reduce memory a little bit

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-10-16 06:19:17 -03:00
Alan C. Assis
e0389ce1fb build: Replace 'make download' with 'make flash' 2021-10-14 16:33:27 -03:00
Abdelatif Guettouche
04a6e1cc29 tools/configure.sh: Copy output to stderr on errors.
This helps when redirecting stdout to /dev/null (as in the CI for example) and still be able to catch error output.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-10-06 07:47:45 -07:00
Alin Jerpelea
38fa30ee2a tools: 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-09-28 08:05:59 -06:00
Dave Marples
a8ddb6e7af Copyright transfer
This code is herby transferred from my copyright to Greg Nutt. The
comments at the head of the file have been updated accordingly.
2021-09-28 15:43:03 +02:00
Gustavo Henrique Nihei
3c63cb522c risc-v/esp32c3: Enable booting from MCUboot bootloader
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-09-27 18:22:29 -07:00
Gustavo Henrique Nihei
17ec1d04c0 tools/esp32: Remove unneeded variable initialization
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-09-27 18:22:29 -07:00
Gustavo Henrique Nihei
800678ca78 xtensa/esp32s2: Enable booting from MCUboot bootloader
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-09-27 18:21:53 -07:00
Abdelatif Guettouche
44268bac1f tools/ci/Docker: Download the latest ESPxx Xtensa toolchain 2021-09-24 18:17:22 -03:00
Abdelatif Guettouche
6526966987 tools/ci/cibuild.sh: Update the downloaded ESP Xtensa toolchain.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-09-24 18:17:22 -03:00
Gustavo Henrique Nihei
86518bdf25 tools: Trigger clean_bootloader on distclean for supported chips
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-09-24 10:48:19 -07:00