Commit Graph

1345 Commits

Author SHA1 Message Date
Dong Heng
f47cb67da6 xtensa/common: Fix Xtensa interrupt stack context restore issue 2023-02-28 16:36:55 -03:00
Huang Qi
8a389a06e1 Don't download tarball if a local git repo found
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-02-27 23:55:23 +08:00
Xiang Xiao
2c5f653bfd Remove the tail spaces from all files except Documentation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-26 13:24:24 -08:00
Tiago Medicci Serrano
173212ebc9 esp32s3: Define syscall table to enable using ROM functions 2023-02-24 04:06:50 +08:00
Xiang Xiao
8b4ecac6c2 libc: Move math library from libs/libc/math to libs/libm/libm
to prepare the support of other implementation e.g.:
https://github.com/JuliaMath/openlibm
https://gitlab.com/gtd-gmbh/libmcs

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-23 10:40:07 +02:00
Fotis Panagiotopoulos
85ceb7920e Typo fixes. 2023-02-17 11:17:11 -03:00
Lucas Saavedra Vaz
1fb6dcec3b arch/xtensa/esp32s2: Fix function header 2023-02-09 02:39:54 +08:00
Lucas Saavedra Vaz
b29198a62a arch/xtensa/esp32s3: Add support for touch pad interrupts 2023-02-09 02:39:54 +08:00
Ville Juven
9ac3e841da group_addrenv: Fix call to group_addrenv for targets that don't need it 2023-02-09 00:14:52 +08:00
Alan Carvalho de Assis
63a847ebca esp32s3-devkit: Add support LED PWM initialization 2023-02-08 11:02:19 +08:00
Alan Carvalho de Assis
453d9688c7 esp32s3: Add support to PWM using LEDC 2023-02-08 11:02:19 +08:00
Alan Carvalho de Assis
94970f32d7 esp32s2-saola-1: Add initialization to LEDC PWM 2023-02-08 10:56:32 +08:00
Alan Carvalho de Assis
39729bb635 esp32s2: Add support to LEDC PWM 2023-02-08 10:56:32 +08:00
Lucas Saavedra Vaz
d7b66adbeb arch/xtensa/esp32s3: Add support for RTC IRQs 2023-02-08 10:56:15 +08:00
Lucas Saavedra Vaz
21d9163aae arch/xtensa/esp32s2: Add support for touch pad interrupts 2023-02-07 12:19:41 +08:00
Lucas Saavedra Vaz
247aad82f2 arch/xtensa/esp32s2: Fix touch function typo 2023-02-07 12:19:41 +08:00
Nathan Hartman
5f9cb6faf4 drivers/serial: Fix docstrings on UART interrupt handlers 2023-02-07 04:41:36 +08:00
Lucas Saavedra Vaz
1e3af48fff arch/xtensa/esp32s2: Add support for RTC IRQs 2023-02-04 18:28:10 -03:00
chao an
4c8d244fae sched/getpid: replace syscall getpid/tid/ppid() to kernel version
NuttX kernel should not use the syscall functions, especially after
enabling CONFIG_SCHED_INSTRUMENTATION_SYSCALL, all system functions
will be traced to backend, which will impact system performance.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 10:33:01 +08:00
Gustavo Henrique Nihei
e6b204f438 nuttx: Use MIN/MAX definitions from "sys/param.h"
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-01 23:47:44 +08:00
zhuyanlin
96a70b908f arch:xtena: modify timer interrupt level large to XCHAL_IRQ_LEVEL level.
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-02-01 14:04:44 +08:00
Lucas Saavedra Vaz
f07885541c arch/xtensa/esp32: Propagate RTC IRQ status register to lower levels 2023-02-01 00:45:52 +08:00
Xiang Xiao
9f027208d4 fs: Add model field to geometry and mtd_geometry_s
the model is very useful to track the device info

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-31 11:50:28 -03:00
yinshengkai
3f97a87162 tools: add separate flags parameter for COMPILE/COMPILEXX
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-31 13:42:33 +08:00
zhangyuan21
e6d2f0623a backtrace: use CURRENT_REGS when in interrupt context
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-01-29 02:48:00 -08:00
Alan Carvalho de Assis
e0cb643545 Update arch/xtensa/src/esp32s3/esp32s3_rng.c
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-27 13:16:35 +08:00
Alan Carvalho de Assis
2d635be05f Update arch/xtensa/src/esp32s3/esp32s3_rng.c
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-27 13:16:35 +08:00
Alan Carvalho de Assis
b27351828a esp32s3: Add RNG driver
Fix multiplier noticed by Tiago

Co-author: Tiago Medicci <tiago.medicci@espressif.com>
2023-01-27 13:16:35 +08:00
chao an
931a4f6969 arch/EXTRA_LIBS: link all staging library
Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-27 01:08:26 +02:00
Lucas Saavedra Vaz
eee4396b06 arch/xtensa/esp32: Add support for touch pad interruptions 2023-01-26 14:33:08 -03:00
Lucas Saavedra Vaz
c4aa37ee2f arch/xtensa: Fix 'interruption' typos 2023-01-26 14:33:08 -03:00
Lucas Saavedra Vaz
07fd4b564d arch/xtensa/esp32: Fix SENS_TOUCH_XPD_WAIT definition 2023-01-26 14:33:08 -03:00
zhuyanlin
3c6b844fcd arch:xtensa:toolchain: add -Wno-atmoic-alignment flags for xcc
see a bug here:
https://bugs.llvm.org/show_bug.cgi?id=43603

Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2023-01-26 17:11:54 +02:00
Petro Karashchenko
c4cf1eeb2b arch/xtensa/esp32s2: switch from semaphore to mutex for exclusive access
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-26 10:24:05 +08:00
Petro Karashchenko
c415ce518f arch/xtensa/esp32: style fixes in SPI driver
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-26 10:24:05 +08:00
Xiang Xiao
d7ee492fc4 board/arch: Remove FAR decorator
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-25 13:05:07 +02:00
Gustavo Henrique Nihei
e77e12e145 espressif: Stabilize MCUboot support on Espressif chips
MCUboot support is no longer behind EXPERIMENTAL for the following
chips:
- ESP32
- ESP32-S2
- ESP32-S3
- ESP32-C3

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-01-24 08:44:22 +09:00
Lucas Saavedra Vaz
39162ebafb arch/xtensa/esp32: Add support for RTC IRQs 2023-01-21 12:27:35 +08:00
Alan Carvalho de Assis
2bdb7c0e8d esp32s2: Add support to EFUSE 2023-01-20 15:41:13 +08:00
Alan Carvalho de Assis
adc5f52fcf esp32s3: Add support to EFUSE 2023-01-20 15:40:46 +08:00
Max Kriegleder
57034f483d esp32: fix lower half oneshot for usage with nxsched_oneshot_start 2023-01-20 15:39:47 +08:00
Xiang Xiao
fd64e38072 build: Add STACK_USAGE(-fstack-usage) to assist the stack analysis
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-19 10:35:20 -03:00
Gustavo Henrique Nihei
a4c9da9280 xtensa/esp32: Fix ESP32_SPIRAM_USER_HEAP under Protected mode
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-01-18 17:41:09 +08:00
Gustavo Henrique Nihei
e451b43798 xtensa/esp32: Improve Wi-Fi driver to support MM_KERNEL_HEAP
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-01-18 17:41:09 +08:00
Gustavo Henrique Nihei
705e29fb27 xtensa/esp32: Support allocation of userspace heap into External RAM
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-01-18 17:41:09 +08:00
Dong Heng
f35f32d4ee xtensa/esp32: Fix SPI bugs
1. Fix SPI master/slave clock init/deinit error
2. Fix SPI slave RX process error
2023-01-18 12:23:08 +08:00
Xiang Xiao
f64da13e9b libxx: Add CXX_STANDARD to select -std=c++??
and default to "c++17"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-16 15:41:57 +02:00
Dong Heng
118222ba46 xtensa/esp32: Partition device supports encryption mode 2023-01-16 09:55:44 -03:00
Alan Carvalho de Assis
97402f9121 esp32: Fix QEnconder reset position and small typo
The PCNT RST bit needs to be set to zeroing the counter and then
this same bit needs to be cleared to returning counting.
2023-01-16 09:41:46 +08:00
ssssenai
077ad5b45f arch: xtensa/esp32: Add esp32_himem_chardev.c
Summary:
- It is applicable to esp32 products and uses the himem part
  of 8M psram by creating character devices.

Impact:
- None

Testing:
- Use esp32-wrover series products for more than 1000 functional verifications.
2023-01-14 14:07:46 +08:00
Lucas Saavedra Vaz
674b480198 arch/xtensa/esp32s2: Add initial support for touch pad polling 2023-01-12 22:23:42 +08:00
Lucas Saavedra Vaz
749d0dfe84 arch/xtensa/esp32s2: Add RTC GPIOs configuration functions 2023-01-12 22:23:42 +08:00
Lucas Saavedra Vaz
cdd0787b54 arch/xtensa/esp32: Fix typo and check PU/PD registers 2023-01-12 22:23:42 +08:00
Lucas Saavedra Vaz
3dad6b273e arch/xtensa/esp32s2: Add missing SENS and RTCCNTL registers 2023-01-12 22:23:42 +08:00
Lucas Saavedra Vaz
2b7d8981e2 arch/xtensa/esp32s3: Add initial support for touch pad polling 2023-01-11 02:00:41 +08:00
Lucas Saavedra Vaz
24995f6918 arch/xtensa/esp32s3: Add RTC GPIOs configuration functions 2023-01-11 02:00:41 +08:00
Lucas Saavedra Vaz
c8dd4b068d arch/xtensa/esp32s3: Add missing registers and definitions 2023-01-11 02:00:41 +08:00
Dong Heng
07342f7957 xtensa/esp32: SPI support to configure as R/W/RW mode 2023-01-11 01:54:36 +08:00
Dong Heng
67ccee2c4f xtensa/esp32: ESP32 SPI Flash encryption supports 16-bytes align writing 2023-01-10 01:10:10 +08:00
chenwen@espressif.com
eed2cce3f2 xtensa/esp32: Optimize WLAN device buffer 2023-01-07 13:46:37 +08:00
chenwen@espressif.com
933d1a0a80 xtensa/esp32: Add Wi-Fi softap event 2023-01-06 12:25:36 -03:00
Dong Heng
f137a7b552 xtensa/esp32: Fix macro "CONFIG_NETDEV_IOCTL" control range error 2023-01-06 20:40:53 +08:00
Dong Heng
7097cfd000 xtensa/esp32: Add option to enable ETH PHY reset pin 2023-01-06 20:40:53 +08:00
anjiahao
c02fea36d8 arch:change tcbinfo regs num
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-05 23:36:12 +08:00
Xiang Xiao
779a610ca3 Remove the unnecessary NULL fields in global instance definition of file_operations
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:32:13 +02:00
Alan Carvalho de Assis
e3748be0e5 esp32s3: Clear the timer interrupt to avoid losing the next one 2022-12-28 09:45:29 +08:00
Alan Carvalho de Assis
e67b968f15 esp32s2: Clear the timer interrupt to avoid losing the next one 2022-12-28 09:45:29 +08:00
Alan Carvalho de Assis
1ab8c1ea01 esp32: Clear the timer interrupt to avoid losing the next one 2022-12-28 09:45:29 +08:00
Xiang Xiao
b9d7d00943 arch: Remove the unused arch color function variant
up_check_tcbstack_remain, up_check_stack, up_check_stack_remain and up_check_intstack_remain

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-24 22:40:52 +02:00
zhangyuan21
45394eb6dc arch: save user context in assert common code
This is the work continue with #7875

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2022-12-24 13:02:56 +08:00
Petro Karashchenko
3e36f40130 compiler.h: rename printflike to printf_like
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-12-21 10:56:45 +08:00
Petro Karashchenko
b107e4f417 nuttx: unify MIN, MAX and ABS macro definition across the code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-12-21 09:31:28 +08:00
Xiang Xiao
fd0d6a9bf5 compiler.h: Add _ between format|printf|syslog|scanf|strftime and like
align with other macro naming style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-21 01:05:19 +02:00
Xiang Xiao
d5689e070b net/arp: Remove nuttx/net/arp.h
1.move ARPHRD_ETHER to netinet/arp.h
1.move arp_entry_s to net/arp/arp.h
2.move arp_input to nuttx/net/netdev.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-16 22:10:59 +02:00
zhangyuan21
453a1a7332 arch: move stack and task dump to common code
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2022-12-17 01:59:35 +08:00
zhangyuan21
632d87ee71 arch: remove up_release_pending function
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2022-12-16 21:29:57 +08:00
Lucas Saavedra Vaz
077c790830 arch: Make REG_[GET/SET]_FIELD thread safe for ESP SOCs 2022-12-16 13:32:43 +08:00
Almir Okato
8f3c425067 xtensa/esp32s3: Enable booting from MCUboot bootloader
Add support for booting from MCUboot bootloader on ESP32-S3.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-12-15 00:42:13 +08:00
Lucas Saavedra Vaz
773e3fad43 arch/xtensa/esp32: Add initial support for touch pad polling 2022-12-14 22:38:10 +08:00
Lucas Saavedra Vaz
b8ef8daef9 arch/xtensa/esp32: Add missing macros to iomux 2022-12-14 22:38:10 +08:00
Lucas Saavedra Vaz
2280b33eea arch/xtensa/esp32: Add functions to get RTC clock 2022-12-14 22:38:10 +08:00
Lucas Saavedra Vaz
f9a9512d3c arch/xtensa/esp32: Fix typo in SENS registers 2022-12-14 22:38:10 +08:00
Lucas Saavedra Vaz
15dadd0099 arch/xtensa/esp32: Remove redundant RTC registers 2022-12-14 22:38:10 +08:00
chao an
47fbfa215e fs/hostfs: mode_t of mkdir(2) should use the nuttx prototype
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-13 18:16:20 +08:00
田昕
0382b63f5d move common assert logic together.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-12-12 17:05:02 +08:00
Alan Carvalho de Assis
fbdd246878 esp32: Fix maximum I2C FIFO size (now SSD1306 will work) 2022-12-09 02:23:28 +08:00
Gustavo Henrique Nihei
236ee5c80d xtensa/esp32: Rename linker scripts into more meaningful names
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-12-08 21:55:29 +08:00
Gustavo Henrique Nihei
1ecaa4e672 xtensa/esp32s3: Configure the PMS peripheral for Protected Mode
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-12-07 03:07:45 +08:00
Gustavo Henrique Nihei
bfc40c74d0 xtensa/esp32s3: Add support for Protected Mode
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-12-07 03:07:45 +08:00
Lucas Saavedra Vaz
4320eed4a1 arch/xtensa/esp32: Optimize macros and ensure overwrite protection 2022-12-07 00:02:28 +08:00
Lucas Saavedra Vaz
9cdbec3769 arch/xtensa/esp32: Modify REG_[GET/SET]_FIELD to use [get/set]reg32 2022-12-06 10:53:06 +08:00
Xiang Xiao
c6e9edcbb6 net: Rename arp_arpin to arp_input
align with other similar function(e.g. ipv4_input and ipv6_input)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-04 20:39:21 +08:00
Xiang Xiao
6d30726a1b Remove the unnecessary "return;" at the end of function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 22:23:50 +01:00
chao an
6fa60627eb net/devif/ip: build l2 header on the IP layer
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-27 12:13:45 +08:00
chao an
8850dee746 net/devif: move preprocess of txpoll into common code
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-27 12:11:12 +08:00
Tiago Medicci Serrano
d3ffeb40a7 libc/machine/xtensa: make longjmp safe against context switch
In order to turn longjmp context-switch safe, it's necessary
to disable interrupts before modifying windowbase and windowstart.
Otherwise, after a context switch, windowstart and windowbase
would be different, leading to a wrongly set windowstart bit due to
longjmp writing it based on the windowbase before the context switch.
This corrupts the registers at the next window overflow reaching
that wrongly set bit.

*Background:*
This PR is related to an issue first observed on ESP-IDF
https://github.com/espressif/esp-idf/issues/5229 and it was, then,
checked on NuttX using a test application.

*The test application:*
To check if the problem affects ESP32, ESP32-S2 and ESP32-S3 on
NuttX, it was created an application based on:
https://en.cppreference.com/w/c/program/longjmp

The application creates 16 tasks (`#define NUMBER_OF_TASKS  16`)
that implements the following daemon:

```
static int setjmp_longjmp_daemon(int argc, char *argv[])
{
  for (int i = 0; i < NUMBER_OF_TASKS * 2; i++)
    {
      jmp_buf env;

      volatile int count = 0;
      if (setjmp(env) != UINT16_MAX)
        {
          foo(&env, ++count);
        }
    }

  sem_post(&g_sem);

  return EXIT_SUCCESS;
}
```

The main function also initializes a semaphore to avoid application
exiting before tasks return successfully:

```
  sem_init(&g_sem, 0, -NUMBER_OF_TASKS);
```

Finally, the round-robin interval was lowered to 1ms to raise the
chances of the longjmp being interrupted by a context switch
(`CONFIG_RR_INTERVAL=1).

This setup was able to reproduce the problem prior to this patch
being applied.
2022-11-22 19:34:44 +01:00
zhangyuan21
d8051ba979 nuttx/sched: merge up_block_task and up_unblock_task 2022-11-22 22:59:08 +08:00
zhangyuan21
a8fa51e6bf arch: rename arch special function name 2022-11-22 16:27:56 +08:00
zhangyuan21
5c1b518314 nuttx/sched: move reprioritize process to public function 2022-11-22 15:29:00 +09:00
zhangyuan21
08f7152d9f nuttx/sched: remove nxsched_remove_readytorun from up_block_task
It takes about 10 cycles to obtain the task list according to the task
status. In most cases, we know the task status, so we can directly
add the task from the specified task list to reduce time consuming.
2022-11-22 15:29:00 +09:00