Commit Graph

52605 Commits

Author SHA1 Message Date
Ville Juven 2bed7c4646 arm64_mmu: Add data synchronization barrier after page tables are written
The page tables must be committed to system memory before we can proceed
enabling the MMU. ISB() is not enough to do this.
2024-03-19 15:46:51 -03:00
Radek Pesina 8f9c337c66 drivers/can/sja1000: Add SJA1000 CAN driver support
This driver is based on ESP32 TWAI CAN drivers currently available
in Nuttx, and captures the differences currently present across the
TWAI drivers for easy future adaption to remaining ESP32 platforms
with no loss of support/function. Also provides a generic SJA1000 CAN
driver solution that is CPU-architecture independent.

Changes:
- Low-level driver re-written to allow usage independent of CPU
architecture, and support both SJA1000 and TWAI CAN controllers.
- Platform-specific settings abstracted away to be provided by board
layer.
- Support for multiple instances of SJA1000 driver.
2024-03-19 15:45:53 -03:00
simbit18 21572864e7 Minor improvement for tools/ci: Fixed cmake build of bloaty and installation in darwin.sh script.
function bloaty() Add  -D CMAKE_INSTALL_PREFIX="${NUTTXTOOLS}"/bloaty.
Improves workflow execution time because it is now cached.

Changed reference file to calculate the hash for key of actions/cache@v4. Now it is darwin.sh.
2024-03-19 20:52:40 +08:00
TaiJu Wu 23d65cb97f shced:sem: replace mutex with spinlock
The overhead of spinlok is less than mutext (mutex need to call
enter_critical section.)
After this patch, `down_write_trylock` and `down_read_trylock` can be
use in interrupt context.

The instruction is protected with mutex only one instruction so using
spinlock is better.

Signed-off-by: TaiJu Wu <tjwu1217@gmail.com>
2024-03-19 18:06:12 +08:00
Philippe Leduc a7389c0057 Fix: typo in the if condition. 2024-03-19 18:04:18 +08:00
ligd 327d0789e4 arch: add ARCH_TRUSTZONE_DISABLED choice
We can decide whether use trustzone

After this patch, we can support the following mode:

                             ARCH_HAVE_TRUSTZONE   ARCH_TRUSTZONE_DISABLED  ARCH_TRUSTZONE_SECURE  ARCH_TRUSTZONE_NONSECURE

Without Security Extensions         n                       n                       n                         n
CHIP have NO trustzone

With Security Extensions            y                       y                       n                         n
Only one bin in sec mode

With Security Extensions            y                       n                       y                         n
TEE bin in sec mode

With Security Extensions            y                       n                       n                         y
REE bin in non-sec mode

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-19 18:24:42 +09:00
zhangyuan21 9c0d2e1a3c armv7-a/gicv2: move IRQ to group1 and group0 as the FIQ
Purpose: make the the os crash when busyloop with interrupt disable

Follow the arm gicv2 spec, if we want to use the IRQ and FIQ
simultaneously when not using the processor Security Externsions.
We should:
1. IRQ to Group 1 and FIQ to Group 0;
2. Set CICC_CTLR.FIQEn to 1;

Then in NuttX:
1. implement the arm_decodefiq and directly crash in it;
2. provide interface to change the IRQ to FIQ, e.g. change the
   watchdog IRQ to FIQ, so the watchdog can trigger even with the
   interrupt disabled (up_irq_save() called);

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-19 18:24:42 +09:00
chao an d4d49e9645 stdio/file: unify group file list to common single queue
unify group file list to common single queue

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-18 19:32:49 +08:00
Jorge Guzman 8e0bf9a0b4 stm32h7/linum-stm32h753bi: Add buzzer support
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2024-03-18 13:48:59 +08:00
Rodrigo Sim a7ba822389 board/stm32f401rc-rs485: Add support to Quadrature Encoder
Signed-off-by: Rodrigo Sim <rcsim10@gmail.com>
2024-03-17 10:00:57 -03:00
Adam Comley b4407b529a RP2040: Implement board_uniqueid() 2024-03-17 10:00:25 -03:00
GC2020 7e07d23af1 boards/arm/stm32/stm32f429i-disco add CAN driver support
Standardize code formatting
2024-03-16 12:43:15 -03:00
wangmingrong 52a349ab13 memdump: Enhance memdump
The method of passing in parameters to memdump is modified and the
incoming address is added. After traversing the node to which the
address belongs, the memdump command will end.

Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-03-15 17:46:48 +08:00
Philippe Leduc ac7433eb5a Fix export: startups files are not added at link step
Add variables that describe NuttX current build (board, arch, chip)
2024-03-15 17:40:50 +08:00
Yanfeng Liu ea8682572c build/cmake: add initial KERNEL mode support
Currently only FLAT mode development can enjoy cmake build system. This
patch tries to add initial kernel mode support. It can build NuttX kernel
and libproxies.a, the latter will be further checked though.

This can already help to build an AMP remote node image as it can share
userland apps living in the AMP master node.

Major changes:

- in top folder:
  - CMakeLists.txt    adjust for KERNEL mode, separate from PROTECTED mode.
- in `syscall`:
  - CMakeLists.txt    add mksyscall target for stubs/proxies generation
- in `syscall/stubs`:
  - CMakeLists.txt    use dependency to mksyscall
- in `syscall/proxies`:
  - CMakeLists.txt    use dependency to mksyscall
- in `arch`:
  - CMakeLists.txt    separate KERNEL from PROTECTED mode.
- in `arch/risc-v/src`:
  - CMakeLists.txt    separate from PROTECTED mode, add sub folders.
- in `arch/risc-v/common`:
  - CMakeLists.txt    add sources and sub-folders for KERNEL mode.
- in `arch/risc-v/k230`:
  - CMakeLists.txt    add sources for KERNEL mode.
- in `boards/risc-v/k230/canmv230/src`:
  - CMakeLists.txt    adjust k230 specific scripts for kernel mode.

New additions:

- in `arch/risc-v/src/nuttsbi/`           add CMakeLists.txt
- in `arch/risc-v/src/common/supervisor/` add CMakeLists.txt

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-15 16:21:23 +08:00
raiden00pl 8bf6b17cc0 sensors/bmi270: fix accel and gyro data position
accel registers are DATA_8 to DATA_13
gyro registers are DATA_14 to DATA_19
2024-03-14 21:16:46 -03:00
xuxin19 2c9d46f176 cmake:enable libxx for CMake build
distinguish whether to add the CXX header file search path
according to the target Language.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-03-15 01:28:53 +08:00
chao an 2b4002d9ad sched/signal: move unblock signal info to stack
struct tcb_s will reduce by 24 bytes

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-15 01:10:55 +08:00
wangmingrong d2fd043575 mm: Using Macros Instead of Memory to Fill Labels
Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-03-14 22:48:19 +08:00
wangmingrong 737b9c843d .gitignore: add ignore
Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-03-14 22:47:55 +08:00
wangmingrong d4b5991589 libcxxabi: Path <cxxabi.h> not found
./helloxx_main.cxx:29:10: fatal error: cxxabi.h: No such file or directory
   29 | #include <cxxabi.h>
      |          ^~~~~~~~~~
CONFIG_LIBCXXABI is turned on, but the library include is not linked to nuttx/include, causing the compilation to fail.

Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-03-14 22:47:55 +08:00
chao an 6843b26a66 binfmt/loadmodule: replace kmm_free() to lib_free()
replace kmm_free() to lib_free() unify alloc and free method

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-14 01:00:25 -04:00
dongjiuzhu1 e0c18c05e8 fs/driver: using nx_unlink to call unlink ops to release some resource
if driver complete unlink ops, we need to call it to release some resource,
otherwise, it will only remove inode.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-03-14 11:53:30 +08:00
xucheng5 3b79363041 mtd_config_fs : optimize nvs
Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2024-03-14 00:11:41 +08:00
xucheng5 cd80900646 mtd_config_fs : support algin size
Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2024-03-14 00:11:41 +08:00
Yanfeng Liu ea7dbdc8ac risc-v/k230: fix k230_hart_is_big issue
This patch fixes the issue that k230_hart_is_big() doesn't work in
S-mode. It also adds convenient debug macros to ease debugging process

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-14 00:05:06 +08:00
zhanghongyu 3956a52c58 net/tcp: return true only when send window updates
return true even when window has not changed will cause delayed ack cannot take effect.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-03-13 22:24:04 +08:00
zhanghongyu e93bdfe089 tun: in tun_write, try to release iob before iob_prepare
io_pktlen will incorrect when two packets are received in a row and the packet length decreases.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-03-13 22:23:52 +08:00
chao an df30a1f8d3 sched/pthread/join: refactor pthread join to support join task
1. add support to join main task

| static pthread_t self;
|
| static void *join_task(void *arg)
| {
|   int ret;
|   ret = pthread_join(self, NULL);          <---  /* Fix Task could not be joined */
|   return NULL;
| }
|
| int main(int argc, char *argv[])
| {
|   pthread_t thread;
|
|   self = pthread_self();
|
|   pthread_create(&thread, NULL, join_task, NULL);
|   sleep(1);
|
|   pthread_exit(NULL);
|   return 0;
| }

2. Detach active thread will not alloc for additional join, just update the task flag.
3. Remove the return value waiting lock logic (data_sem),
   the return value will be stored in the waiting tcb.
4. Revise the return value of pthread_join(), consistent with linux
   e.g:
       Joining a detached and canceled thread should return EINVAL, not ESRCH

   https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_join.html

   [EINVAL]
      The value specified by thread does not refer to a joinable thread.

NOTE:

This PR will not increase stack usage, but struct tcb_s will increase 32 bytes.

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-13 18:06:56 +09:00
Yanfeng Liu 1fa2559f00 riscv/k230: add ARCH_HAVE_RESET revise logging
This patch adds board_reset and revises debug logging.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-13 13:46:02 +08:00
shizhenghui 9f056fdd47 sim/nxcamera: add CONFIG_SIM_FBBPP=32
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-03-13 12:33:07 +08:00
shizhenghui 255090d594 Refactor nuttx v4l2
Adjust the v4l2 framework to support both capture and v4l2m2m,
and can easily add other v4l2 features.

Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-03-13 09:51:08 +08:00
yaojingwei c3a3f79741 video: extend imgsensor_s interface for getting sensor device params.
Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2024-03-13 09:51:08 +08:00
Tiago Medicci Serrano 2b18917a6b Revert "assert/panic: disable panic message to save the code size"
This reverts commit 9b1c451f2f.
2024-03-13 09:44:51 +08:00
Michał Łyszczek 87cec8d5c7 stm32f40xxx_pinmap: add 3rd alternate mapping for USART6
Some stm32 has alternate USART6 pinout on G9/G14 but others have it
on A12/A11. Unfortunately it's very difficult to make proper ifdefs for
this since position is based on package (and pincount) and not chip
itself. Creating such list would take a lot of time. Because of that
I just added another possible config for this pin and moved responsibility
of proper selection onto board code.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
2024-03-12 10:09:59 -03:00
Michał Łyszczek 02dc6fa219 stm32_serial.c: fix compilation of onewire driver mode
Onewire driver wants to use "struct up_dev_s *priv", which is extracted
from "struct uart_dev_s" and "struct inode". But inode and uart dev are
only declared when TERMIOS or BSDCOMPAT is also enabled. Without these
driver fails to compile with missing declaration errors. Adding some
additional "#if defined()" to these declarations fix the issue and driver
compiles and works properly (tested with ds18b20 temp sensor).

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
2024-03-12 13:45:41 +01:00
Alan Carvalho de Assis 73576e0d02 Fix cmake-format wrong execution order 2024-03-12 20:03:15 +08:00
Yanfeng Liu 5bf6ea0c20 fs/mount: harden nx_mount logic
This adds variables initialization and empty device path checks to
harden logic of nx_mount.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-12 19:44:48 +08:00
Yanfeng Liu 813f67f93b mm_heap/mm.h: revising comments
Revising comments to be in line with code

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-12 19:44:48 +08:00
Marco Casaroli 1be1149fdd arch/esp32 bringup openeth 2024-03-12 08:31:06 -03:00
Marco Casaroli 9af8299af5 arch/esp32 add config for qemu-openeth 2024-03-12 08:31:06 -03:00
Marco Casaroli d048caf1d2 arch/esp32 add openeth mac driver
This driver is used with QEMU, to make it possible
to use networking.

This is not the MAC in ESP32, however, it can be used with QEMU.

The code was shamelessly copied from 31dac92e5f
2024-03-12 08:31:06 -03:00
p-szafonimateusz 768c5a28a1 arch/x86_64: move common Make.defs to common
cosmetic change to simplify intel64 Make.defs

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-03-12 08:30:37 -03:00
chenwen@espressif.com 277ca97b44 xtensa/esp32: Fix wrong interrupt number
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-03-12 14:36:50 +08:00
Nicolas Lemblé 63782c7ff2 arch/xmc4 Add tickless support 2024-03-11 13:56:07 -03:00
chao an be482cd830 sched/pthread: replace pthread_sem_give() to nxsem_post() to unify the post method
replace pthread_sem_give() to nxsem_post() to unify the post method

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-11 22:57:26 +08:00
Eren Terzioglu 61689237f6 docs/esp32c6: Add spiflash docs for esp32c6
docs/esp32c6: Remove sotest docs esp32c6
docs/esp32c3: Add spiflash docs esp32c3
docs/esp32c3: Remove sotest docs esp32c3
docs/esp32h2: Add spiflash docs esp32h2
docs/esp32h2: Remove sotest docs esp32h2
2024-03-11 22:57:10 +08:00
SPRESENSE bac0228825 drivers/video/isx012: Fix buffer overrun of isx012_putreg()
The maximum size of ISX012 register is 4 bytes.
So, extend temporary buffer size.

Detected by CodeSonar 141893
2024-03-11 15:44:39 +01:00
SPRESENSE 3419f018a4 drivers/video/isx019: Delete unnecessary code
Because of misunderstanding spec, unnecessary codes exist.
Delete them.
2024-03-11 15:44:39 +01:00
SPRESENSE baa2dc5cad drivers/video/isx019: Store initial gamma value
Set initial gamma value to enable application to get
the correct initial gamma value.
2024-03-11 15:44:39 +01:00