Commit Graph

43464 Commits

Author SHA1 Message Date
ChenWen
6ce335fa84 xtensa/esp32: Fix some Wi-Fi issues
1. Fix the issue that Wi-Fi can't connect to some special routers occasionally.
    2. Update Wi-Fi driver code to fix issue of failure to send pkt.
    3. Replace software random with hardware random
2021-12-28 23:48:25 -06:00
chao.an
7ed0b97414 make/allsyms: skip the unnecessary link operation
For incremental compilation, skip the stage 1 dummy link
operation if nuttx elf has been generated

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-28 23:47:10 -06:00
Xiang Xiao
186ac17f1f arch: Select ARCH_HAVE_BACKTRACE in Kconfig for supported arch
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 13:34:02 +08:00
Xiang Xiao
dd942f0b04 sched/backtrace: Dump the complete stack regardless the depth
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 12:09:54 +08:00
Xiang Xiao
9eecd4c5e2 libc: Prefix the address with 0 to the specified width in sched_dumpstack
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 12:09:54 +08:00
chao.an
7f2c5be07a libs/dumpstack: add support for print symbol name
ap> mw -1
[ EMERG] arm_usagefault: PANIC!!! Usage Fault:
[ EMERG] arm_usagefault:       IRQ: 6 regs: 0x3c24fa48
[ EMERG] arm_usagefault:       BASEPRI: 000000e0 PRIMASK: 00000000 IPSR: 00000006 CONTROL: 00000004
[ EMERG] arm_usagefault:       CFSR: 01000000 HFSR: 00000000 DFSR: 00000000 BFAR: 40101000 AFSR: 00000000
[ EMERG] arm_usagefault: Usage Fault Reason:
[ EMERG] arm_usagefault:       Unaligned access
[ EMERG] up_assert: Assertion failed at file:armv8-m/arm_usagefault.c line: 113 task: init
[ EMERG] backtrace|10:  0x2c325bde 0x2c319b98 0x2c3261cc 0x2c316b20 0x2c32699c 0x2c303a50 0x2c326072 0x2c3206ea
[ EMERG] backtrace|10:  0x2c3428cc 0x2c33ed14 0x2c342e8e 0x2c34403a 0x2c344ac0 0x2c319b60 0x2c3080ba
[ EMERG]  [10][ 0] [<0x2c325bde>] up_backtrace+0xa/0x13c
[ EMERG]  [10][ 1] [<0x2c319b98>] sched_dumpstack+0x10/0xc0
[ EMERG]  [10][ 2] [<0x2c3261cc>] up_assert+0x48/0x414
[ EMERG]  [10][ 3] [<0x2c316b20>] _assert+0x4/0x10
[ EMERG]  [10][ 4] [<0x2c32699c>] arm_usagefault+0xa8/0x138
[ EMERG]  [10][ 5] [<0x2c303a50>] irq_dispatch+0x1c/0x40
[ EMERG]  [10][ 6] [<0x2c326072>] arm_doirq+0x1a/0x2c
[ EMERG]  [10][ 7] [<0x2c3206ea>] exception_common+0x4a/0xac
[ EMERG]  [10][ 8] [<0x2c3428cc>] cmd_mw+0xec/0x11c
[ EMERG]  [10][ 9] [<0x2c33ed14>] nsh_parse_command+0x684/0xcf0
[ EMERG]  [10][10] [<0x2c342e8e>] nsh_session+0x92/0x168
[ EMERG]  [10][11] [<0x2c34403a>] nsh_consolemain+0x1e/0x38
[ EMERG]  [10][12] [<0x2c344ac0>] nsh_main+0x30/0x50
[ EMERG]  [10][13] [<0x2c319b60>] nxtask_startup+0x40/0x68
[ EMERG]  [10][14] [<0x2c3080ba>] nxtask_start+0x46/0x60

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-29 12:09:54 +08:00
Xiang Xiao
20bbdd0997 libc: Add backtrace_symbols[_fd] functions
specified here:
https://linux.die.net/man/3/backtrace_symbols

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 12:09:37 +08:00
Xiang Xiao
f302e8fd40 arch/sim: Implement up_backtrace
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 11:03:08 +08:00
Xiang Xiao
f061766801 video/fb: Fix typo error in include/nuttx/video/fb.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-28 17:21:18 -03:00
Xiang Xiao
f768e1268b boards/sim: Remove sim_tsc_setup
since all NX and VNC initialization should be initiated from
user space through BOARDIOC_NX_START and BOARDIOC_VNC_START

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-28 17:14:04 -03:00
Huang Qi
e75321e61c arch/risc-v: Move riscv_blocktask.c to common
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-28 11:32:15 -06:00
Alan C. Assis
7b1135500b doc/esp32: Add documentation about BLE for ESP32 2021-12-28 07:31:02 -06:00
Norman Rasmussen
baafd33cbe Fix a typo in description of pwm_expired 2021-12-28 06:27:51 -06:00
Norman Rasmussen
934a79736a Use userspace chosen channel numbers when starting bl602 pwm
commit 2889315c20 added support for pwm
but didn't read the channel numbers provided by user-space. They should
be, otherwise it's not possible to start a sub-set of channels that are
not the first "n" channels.
2021-12-28 06:27:51 -06:00
chao.an
cf2dfa8985 arch/arm/assert: move the arm_assert to common code
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-28 05:09:30 -06:00
Huang Qi
d71cfc178a arch/risc-v: Remove unneeded kconfigs
CONFIG_RV32IM_HW_MULDIV can be safely removed since this behavior is
controlled by M extension.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-28 05:02:42 -06:00
Norman Rasmussen
48311cc61f Fix unaligned memory access when creating ICMP Port Unreachable messages
commit 3b69d09c80 corrected the
unreachable handling for net/udp/icmp but introduced an unaligned store.
This splits the uint32_t data field into a two element uint16_t data
field to avoid the unaligned store.
2021-12-28 03:51:53 -06:00
chao.an
579738c8fa arch/arm: move the backtrace implement to common code
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-28 03:02:01 -06:00
Norman Rasmussen
1e2f067181 pwm: add option to break the loops when using multiple PWM channels
commit 7354ab187e added an option to break
the loops when using multiple PWM channels to arm pwm drivers. This adds
the same support to the risc-v pwm drivers.
2021-12-28 03:01:27 -06: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
zhuyanlin
1f87ded9c2 driver:clk: clk pending on semaphore waiting on IPC ready
Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2021-12-27 23:25:28 -06:00
zhuyanlin
a22dae19c1 regulator/rpmsg: pending in wait ept ready for regulator client
Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2021-12-27 23:25:28 -06:00
chao.an
cbd82f1c1b compile/flags: remove redundant -fomit-frame-pointer from board flags
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-27 22:31:27 -06:00
chao.an
a42aa8415d compile/flags: add FRAME_POINTER into Toolchain.defs
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-27 22:31:27 -06:00
chao.an
8eb999ff03 arch/arm: select ARM_THUMB by default for Cortex-M
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-27 22:30:53 -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
Alexander Lunev
e68ffb9f99 net/tcp(unbuffered): fixed an issue with unackseq calculation.
Wrong unackseq calculation locked conn->tx_unacked at non-zero values
even if all ACKs were received. Thus unbuffered psock_tcp_send() never completed.
2021-12-27 20:59:48 -06:00
Xiang Xiao
8f72c7626c driver/rwbuffer: Fix the compiler warning
rwbuffer.c: In function 'rwb_initialize':
rwbuffer.c:842:16: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
  842 |           ferr("Write buffer kmm_malloc(%d) failed\n", allocsize);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~
      |                                                        |
      |                                                        uint32_t {aka long unsigned int}
rwbuffer.c:842:42: note: format string is defined here
  842 |           ferr("Write buffer kmm_malloc(%d) failed\n", allocsize);
      |                                         ~^
      |                                          |
      |                                          int
      |                                         %ld
In file included from rwbuffer.c:36:
rwbuffer.c:846:13: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
  846 |       finfo("Write buffer size: %d bytes\n", allocsize);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~
      |                                              |
      |                                              uint32_t {aka long unsigned int}
rwbuffer.c:846:34: note: format string is defined here
  846 |       finfo("Write buffer size: %d bytes\n", allocsize);
      |                                 ~^
      |                                  |
      |                                  int
      |                                 %ld

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-27 11:05:47 -06:00
Alexander Lunev
19dc121a4f net/tcp(unbuffered): fixed an issue with tx_unacked overflow that occurred if NET_TCP_WINDOW_SCALE option was enabled.
If the remote TCP receiver advertised TCP window size greater than 64 KB
and TCP ACK packets returned to the NuttX TCP sender with a significant delay,
tx_unacked variable overflowed and further TCP send stalled forever
(until TCP re-connection).
2021-12-27 11:05:01 -06:00
Xiang Xiao
ab0f5f607d Fix ioexpander/gpio_lower_half.c:302:23: warning: too many arguments for format
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-27 11:04:11 -06:00
zhuyanlin
c5aca37f8f regulator: fix warning in RPIu32
Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2021-12-27 06:56:38 -06:00
Xiang Xiao
540c6f8c39 esp32-devkitc: Change CONFIG_USER_ENTRYPOINT to CONFIG_INIT_ENTRYPOINT
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-25 18:05:59 +08:00
Huang Qi
0751bcd4ca arch/sim: Support vncserver as display device
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-24 11:59:43 -06:00
ligd
412d030149 boards: move USERMAIN_XX out of INIT_ENTRYPOINT
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-24 08:23:30 -06:00
ligd
0bb32f27c0 init: use exec_spawn instead of exec
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-24 08:23:30 -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 C. Assis
36389dab76 Add board support to SHT3X sensor 2021-12-24 08:11:51 -06:00
Alan C. Assis
01e4e249cc Add WiFi/BLE Coexistence support
Co-authored-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Co-authored-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-12-23 20:42:23 -06:00
Eero Nurkkala
509350a614 risc-v/mpfs: update m100pfsevp board info
Update the cache settings for the Aries m100pfsevp board. This
assigns scratchpad ways for this board as well, as seen in the
commit 491ae6c.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2021-12-23 06:55:18 -06:00
chao.an
6069433d2d arch/arm/cortex-a/r: dump all registers with alias
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-23 06:54:32 -06:00
Eero Nurkkala
3394dca826 risc-v/opensbi: Make.defs: use a wildcard for file listing
The source directory contents of the OpenSBI directory lib/sbi may be
listed with a one-line wildcard. This makes the Make.defs file look
simpler. The rest of the files need to be picked one at a time.

Co-authored-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2021-12-23 02:42:09 -06:00
ligd
e5420c8eee wqueue: fix NO leave_critical_section() when only CONFIG_SCHED_HPWORK
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-23 02:27:34 -06:00
Eero Nurkkala
b128ce334f mpfs: introduce OpenSBI
OpenSBI may be compiled as an external library. OpenSBI commit d249d65
(Dec. 11, 2021) needs to be reverted as it causes memcpy / memcmp to
end up in the wrong section. That issue has yet no known workaround.

OpenSBI may be lauched from the hart0 (e51). It will start the U-Boot
and eventually the Linux kernel on harts 1-4.

OpenSBI, once initialized properly, will trap and handle illegal
instructions (for example, CSR time) and unaligned address accesses
among other things.

Due to size size limitations for the mpfs eNVM area where the NuttX
is located, we actually set up the OpenSBI on its own section which
is in the bottom of the DDR memory. Special care must be taken so that
the kernel doesn't override the OpenSBI. For example, the Linux device
tree may reserve some space from the beginning:

  opensbi_reserved: opensbi@80000000 {
      reg = <0x80000000 0x200000>;
      label = "opensbi-reserved";
  };

The resulting nuttx.bin file is very large, but objcopy is used to
create the final binary images for the regions (eNVM and DDR) using
the nuttx elf file.

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2021-12-22 20:48:12 -06:00
Eero Nurkkala
491ae6cc53 mpfs: cache: assign ways to L2 zero device
Assign ways to L2 zerodevice. L2 zero device is used for
the scratchpad functionality. The area may be used for the
harts communicating to each other.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2021-12-22 20:48:12 -06:00
Diego Herranz
e6bd444fd3 drivers/sensors/isl29023.c: fix compilation error and warnings
- "op_mode" instead of "mode" (compilation error)
- CONFIG_ISL29023_I2C_FREQUENCY instead of CONFIG_LM75_I2C_FREQUENCY
(probably a leftover)
- Fix a couple of format warnings: now using PRIu32
- Also minor comment changes
2021-12-22 20:44:52 -06:00
David Sidrane
74e692b3c1 stm32f7:sdmmc invalidate before DMA to avoid eviction overwrite
For FAT the same buffer is used for read and writes, there
  is a possibility a cache line is dirty. But the fs is
  not dirty and will not write the sector to disk. This can
  be seen  https://github.com/PX4/NuttX/pull/175

  When the system is busy that cache line can be evicted after the
  RX DMA has completed and overwrite the data in memory. The solution
  is to invalidate before the DMA to prevent an evection causing an
  overwite, and after the DMA it to insure coherency.
2021-12-22 20:44:04 -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
chao.an
fe2830ec94 xtensa: enhance the task dump
add irq stack information
add cpu loading

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-22 11:46:02 -03:00
chao.an
362fe2c6f8 arch/risc-v: enhance the task dump
add irq stack information
add cpu loading

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-22 11:46:02 -03:00
chao.an
a0b61bbf6f arm/cortex-a/r: enhance the task dump
add irq stack information
add cpu loading

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-22 11:46:02 -03:00