Commit Graph

1146 Commits

Author SHA1 Message Date
chao an
7625126c91 Remove the remain MIN/MAX like macro
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-03 23:22:41 +08:00
Alan Carvalho de Assis
e710ae5daf esp32c3: reserve CPUINTs 5 and 8 for BLE 2023-02-03 12:24:11 +08:00
Alan Carvalho de Assis
c12a60cb5a esp32c3: Fix WiFi adapter to use WMAC instead of MAC_NMI 2023-02-03 12:24:11 +08:00
Alan Carvalho de Assis
e950e53df2 esp32c3: Always reserve CPU INT 0 and fix cpu init order
Co-author: Tiago Medicci <tiago.medicci@espressif.com>
Co-author: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-03 12:24:11 +08:00
Xiang Xiao
df102d1f06 Remove OK macro from the code base
let's use OK from sys/types.h instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-02 13:58:16 +01: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
Stuart Ianna
05c6d7c7b9 litex: Add PWM driver.
PWM driver for multiple peripherals supplied in gateware.

Only single channel frequency and duty cycle control is implemented. Pulse counting and multichannel features are not currently feasible.

Additions also include a new board configuration for arty-a7 which enables the PWM driver and example application.
2023-02-01 09:34:57 -03:00
Huang Qi
8b27d60bcd tools: Make zig available for arm/riscv/sim
Add essential compile flags to make zig available out of box.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-02-01 11:12:44 +08:00
Stuart Ianna
26ac5335e5 litex: Add GPIO driver.
GPIO driver with optional ISR support. Allows for multiple GPIO peripherals to be specified at an arbitrary addresses.
2023-02-01 11:02:03 +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
Huang Qi
570c7587c7 risc-v/Toolchain.defs: Correct indent 2023-01-31 11:19:47 +08:00
lilei19
1d8af7e105 add holder for mutex
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-01-31 12:08:05 +09:00
Nathan Hartman
6b89b6f945 Remove executable permissions from source files
* arch/arm/src/sama5/sam_flexcom_spi.h,
  arch/risc-v/src/mpfs/mpfs_ihc_sbi.c,
  drivers/usbdev/adb.c,
  libs/libc/math/lib_scalbn.c,
  libs/libc/math/lib_scalbnf.c,
  net/ipfrag/Make.defs,
  net/ipfrag/ipfrag.c,
  net/ipfrag/ipfrag.h,
  net/ipfrag/ipv4_frag.c,
  net/ipfrag/ipv6_frag.c: Remove executable permission.
2023-01-30 20:34:51 -03: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
Ville Juven
42d0e356c2 arch/addrenv: Change group_addrenv_t to arch_addrenv_t
This is preparation for moving address environments out of the group
structure into the tcb.

Why move ? Because the group is destroyed very early in the exit phase,
but the MMU mappings are needed until the context switch to the next
process is complete. Otherwise the MMU will lose its mappings and the
system will crash.
2023-01-27 23:17:01 +08:00
Gustavo Henrique Nihei
80bbb0f24c esp32c3: Fix IRQ initialization, it was crashing on DEBUG_ASSERTIONS
Co-author: Alan C. Assis <alan.carvalho@espressif.com>
2023-01-27 13:15:39 +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
Ville Juven
686b990a85 arch/ARCH_KERNEL_STACK: Fix signal handling with kernel stack
There were two issues with signal handling:
- With a kernel stack the "info" parameter was passed from kernel memory.
  This is fixed by making a stack frame to the user stack and copying it
  there.
- If the signal handler uses a system call, the kernel stack was completely
  and unconditionally destroyed, resulting in a crash in the user application

There is also no need to check ustkptr, it is always NULL. Why ? Because
signal delivery is deferred when a system call is being executed.
2023-01-26 20:41:42 +08:00
Petro Karashchenko
f952b8456c assert: switch from ASSERT(0/false) to PANIC
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-26 10:15:34 +08:00
Stuart Ianna
34fdc3da0d litex: Allow custom peripheral memory mapping and IRQ. 2023-01-25 14:11:06 +08:00
Ville Juven
9b88f8ea5c riscv/riscv_exception.c: Print the EPC value always
The value printed by assert() cannot always be trusted to be correct,
as it relies on the stack / stack pointer not being corrupt.

The CPU register always points to the faulting instruction so print it
out in the exception handler.
2023-01-25 00:55:07 +08:00
Stuart Ianna
f49c20d28f litex: System clock frequency selectable from Kconfig. 2023-01-24 08:20:16 +01: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
Jukka Laitinen
e2a7cee5ed arch/mpfs: Make selection of SBI boot or direct boot run-time configurable
Allow bootloader to select run-time whether the payload binary is booted with
SBI or directly by jumping to entrypoint address.

- Use just one bitmask to select sbi or direct boot for each hart
- Add mpfs_set_use_sbi function to allow selecting how to boot
- Initialize the bitmask by default according to the configuration flags
- Add a header file for including the function prototypes in bootloader code

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-20 00:08:51 +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
Masayuki Ishikawa
dc454765fb Revert "add holder for mutex"
This reverts commit fc176addeb.
2023-01-19 06:04:48 +09:00
Ville Juven
0922121bc0 riscv/addrenv: Do not free physical memory for SHM area
SHM area is just mapped memory, the physical backup is not owned by the
process, so the process must not free it.

In ARM this is already handled as the regions are destroyed one by one,
while this implementation does a page directory walk instead.
2023-01-18 21:59:55 +08:00
lilei19
fc176addeb add holder for mutex
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-01-18 17:40:58 +08:00
Ville Juven
58b5a0412e riscv/addrenv_shm: Add missing sanity check to up_shmdt()
A missing sanity check, make sure the last level page table actually exists
before trying to clear entries from it.
2023-01-18 02:45:04 +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
Jukka Laitinen
70de321de3 arch/Kconfig: remove virtual memory allocator dependency from MM_SHM
The dependency should be vice versa; the MM_SHM should depend on the
existence of the virtual memory range allocator.

Create a new CONFIG flag CONFIG_ARCH_VMA_MAPPING, which will define that
there is a virtual memory range allocator. Make MM_SHM select that flag

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-13 02:20:13 +08:00
chao an
eef818e51f risc-v/esp32c3: correct receive buffer size
1. correct receive buffer size, d_len should keep the l2 header size
2. fix race condition issue of de/enqueue rx queue

Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-10 11:28:06 -03: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
Xiang Xiao
d3872e0479 arch/esp32c3: Fix the compiler error in esp32c3_spi.c
which is made by:
commit 87a1f69a3c
Author: Alan Carvalho de Assis <acassis@gmail.com>
Date:   Fri Dec 16 15:23:39 2022 -0300

    Modify the IRQ APIs to be compatible with ESP32/S2/S3

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-31 14:57:47 +02:00
Alan Carvalho de Assis
87a1f69a3c Modify the IRQ APIs to be compatible with ESP32/S2/S3 2022-12-31 12:47:41 +08:00
Alan Carvalho de Assis
1b58542dd4 esp32c3: 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
Masayuki Ishikawa
2f80a05eae arch: qemu-rv: Fix qemu_rv_mtimer_interrupt() for BUILD_KERNEL
Summary:
- I noticed that rv-virt:ksmp64 sometimes stops during boot.
- Finally, I found that it posts the Supervisor Software Interrupt
  before the OS finishes hardware initialization.
- This commit fixes this issue.

Impact:
- None

Testing:
- Tested with QEMU-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-12-24 11:25:39 -03: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
Ville Juven
5fb3a960f5 riscv/addrenv: Test that satp contents make sense
Check that satp (the page directory root) is not 0, which means it has
not been set.
2022-12-23 10:47:04 +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
Gustavo Henrique Nihei
7114cc2978 risc-v/esp32c3: Revert aes_cypher name change introduced in #6920
"aes_cypher" is a function from NuttX crypto, so better use instead of
defining a new interface in the driver.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-12-16 16:19:47 +02: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