Commit Graph

21910 Commits

Author SHA1 Message Date
Sammy Tran
b4b7710c63 Disable interrupt during FTFC operation 2024-03-06 13:31:48 -03:00
chenwen@espressif.com
09960c5c7d xtensa/esp32s3: Fix the issue of erasing a wide range of flash sectors
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-03-06 18:13:20 +08:00
Yanfeng Liu
a66c7c3ee1 comments/docs: fix typos in comments
This fix some typos in comments.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-06 13:31:50 +08:00
trns1997
54e9e582d5 Use C++ standard lib from toolchain
Signed-off-by: trns1997 <trns1997@gmail.com>
2024-03-06 08:42:44 +08:00
ligd
113ab704c7 goldfish & qemu: handle MMU table and CONFIG_RAM_END
Reproduce:

configure:
./tools/configure.sh qemu-armv7a:nsh -j8
open kasan:
CONFIG_MM_KASAN=y
run:
qemu-system-arm -cpu cortex-a7 -nographic -machine virt,virtualization=off,gic-version=2 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
error:
run hanged

Rootcause:

In Qemu armv7a, the ram-end reserved for MMU PGTABLE:

And the up_allocate_heap()  directly use the ram-end for heap in arch/arm/src/common/arm_allocateheap.c

*heap_size  = CONFIG_RAM_END - g_idle_topstack;

Then they are conflict.
Usually, we won't use the heap end, so can't find the error.
BUT, the KASAN will use the heap end for shadow, so found the error.

Resolve:

up_allocate_heap() consider of MMU, re-define the RAM_END at chip.h

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-06 09:26:44 +09:00
raiden00pl
a20b3e8335 arch/nrf{52|53|91}/spi: fix error message
wrong parameters were passed to spierr()
2024-03-06 00:50:00 +08:00
Marco Casaroli
73c4f2f1e7 fix(esp32s3_spiflash_mtd): debug type specifiers
These log messages are wrong if we use CONFIG_FS_LARGEFILE.
2024-03-05 22:23:50 +08:00
Michal Lenc
44a087111d samv7: add support for USART TX DMA transfers
This commit adds support for TX DMA transfers for USART peripheral. Code
refactor in sam_serial.h was also required in order to have correct
defines for all possible cases (both RX and TX DMA used, just one used,
none used).

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-03-05 09:48:03 +08:00
Tiago Medicci Serrano
dcad39a962 arch: Fix style warnings regarding included header files
This commit fixes style warnings regarding including header files
outside the `Included Files` section.
2024-03-05 09:45:49 +08:00
Tiago Medicci Serrano
c67502d9b4 riscv: Implement page-fault exception and on-demand paging
When an application is being loaded `up_addrenv_create ` calls
`create_region` to create the address environment. Only the first
entry is mapped when the region is created. Virtual memory that is
not mapped will trigger an exception when accessed. Other memory
pages are allocated and mapped on-demand. This enables setting
larger heap and stack for the process without compromising the
overall system memory.
2024-03-05 09:45:49 +08:00
Tiago Medicci Serrano
ae9ef972c0 paging: Rename existing CONFIG_PAGING to CONFIG_LEGACY_PAGING
Current `CONFIG_PAGING` refers to an experimental implementation
to enable embedded MCUs with some limited RAM space to execute
large programs from some non-random access media.

On-demand paging should be implemented for the kernel mode with
address environment implementation enabled.
2024-03-05 09:45:49 +08:00
SPRESENSE
3b3f2d97e9 arch: cxd56: Follow interface change of set_buf() operation
set_buf() operation is changed to have the argument about
format. Follow the change.
2024-03-04 20:39:44 +08:00
ligd
91f0a0f1a8 Revert "goldfish & qemu: handle MMU table and CONFIG_RAM_END"
This reverts commit 2f7b107608.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-04 18:08:15 +08:00
ligd
b599fdbc0e stm32: fix compile failed
Error: chip/stm32_sdmmc.c:1911:7: error: variable 'regaddress' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
 1911 |   if (priv->base == STM32_SDMMC1_BASE)

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-04 18:08:15 +08:00
Yanfeng Liu
a4d61dea80 risc-v/k230: improvements to support K230 vendor u-boot
Previously we need turn off the PMP locks in K230 vendor u-boot to use
NuttX, this complicates the setup process. This patch supports running
NuttX with original vendor u-boot so that to reduce setup complexity.

It also enables empty NSH prompt string in AMP master config as the apps
side support is ready.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-03 12:04:14 -03:00
ligd
2f7b107608 goldfish & qemu: handle MMU table and CONFIG_RAM_END
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-03 18:57:32 +08:00
ligd
7d45afe871 armv7-a/r: use _ebss as idle stack both in SMP mode or not
It is better take the _ebss as IDLE_STACK_BASE like armv8-m

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-03 02:25:03 +08:00
p-szafonimateusz
d4b17f963d arch/intel64: add HPET timer support as oneshot timer
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-03-03 02:24:40 +08:00
ligd
51d8bbfbd9 armv7-a/r: use arm_timer to setup perf
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-03 02:19:37 +08:00
ligd
5aeab4a36c armv7-a timer:fix timer overflow.
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-03 02:19:37 +08:00
ligd
8eddf00212 armv7a/r: use register cval to set timer
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-03 02:19:37 +08:00
ligd
dabed3c7fb armv7-a/r: correct maxdelay calculating
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-03 02:19:37 +08:00
Marco Casaroli
0c50af583d feat(esp32s3-bootloader): allow 32MB flash
The scripts already support, we are just
missing the entry in the config.
2024-03-01 16:51:47 -03:00
Marco Casaroli
447cc9698f use apps-or-nuttx-Make.defs for archs
This will allow apps to tweak build configuration of NuttX
2024-03-01 12:59:16 -03:00
ligd
2241969e5a SMP: fix crash when switch to new task which is still running
cpu0 thread0:                        cpu1:
sched_yield()
nxsched_set_priority()
nxsched_running_setpriority()
nxsched_reprioritize_rtr()
nxsched_add_readytorun()
up_cpu_pause()
                                     IRQ enter
                                     arm64_pause_handler()
                                     enter_critical_section() begin
                                     up_cpu_paused() pick thread0
                                     arm64_restorestate() set thread0 tcb->xcp.regs to CURRENT_REGS
up_switch_context()
  thread0 -> thread1
arm64_syscall()
    case SYS_switch_context
     change thread0 tcb->xcp.regs
    restore_critical_section()
                                     enter_critical_section() done
                                     leave_critical_section()
                                     IRQ leave with restore CURRENT_REGS
                                     ERROR !!!

Reason:
As descript above, cpu0 swith task: thread0 -> thread1, and the
syscall() execute slowly, this time cpu1 pick thread0 to run at
up_cpu_paused(). Then cpu0 syscall execute, cpu1 IRQ leave error.

Resolve:
Move arm64_restorestate() after enter_critical_section() done

This is a continued fix with:
https://github.com/apache/nuttx/pull/6833

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-01 21:05:00 +09:00
Tiago Medicci Serrano
b03c9cf5f8 esp32s3: Fix symbol collision between mbedTLS and the Wi-Fi driver
This commit closes #11738. Actual fix is tracked in:
https://github.com/espressif/esp-hal-3rdparty/pull/2
2024-02-29 20:47:19 +01:00
chao an
6d50274ebe nuttx/list: rename container_of to list_container_of from public header
Use private naming to avoid conflicts with user applications

In file included from libuv/src/unix/internal.h:25,
                 from libuv/src/unix/udp.c:23:
libuv/src/uv-common.h:57: warning: "container_of" redefined
   57 | #define container_of(ptr, type, member) \
      |
In file included from nuttx/include/nuttx/list.h:47,
                 from nuttx/include/nuttx/tls.h:40,
                 from nuttx/include/nuttx/sched.h:48,
                 from nuttx/include/nuttx/arch.h:87,
                 from nuttx/include/nuttx/userspace.h:35,
                 from nuttx/include/nuttx/mm/mm.h:30,
                 from nuttx/include/nuttx/kmalloc.h:34,
                 from nuttx/include/nuttx/lib/lib.h:31,
                 from nuttx/include/stdio.h:35,
                 from apps/system/libuv/libuv/include/uv.h:59,
                 from libuv/src/unix/udp.c:22:
nuttx/include/nuttx/nuttx.h:48: note: this is the location of the previous definition
   48 | #define container_of(ptr, type, member) \
      |

Signed-off-by: chao an <anchao@lixiang.com>
2024-02-29 19:44:54 +08:00
chenwen@espressif.com
1665114fd1 xtensa/esp32: Fix issue of system blocking when SPIRAM is used as stack
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-02-28 13:31:30 +08:00
chenwen@espressif.com
c14888e759 xtensa/esp32s3: Add the return value of SPI driver
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-02-28 13:30:18 +08:00
p-szafonimateusz
4123615621 x86_64: move PCI bus initialization from qemu-intel64 to common x86_64 and initialize PCI in up_initialize()
many PCI devices must be initialized early during boot process (e.g. PCI serial port)

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-27 10:30:54 -03:00
p-szafonimateusz
cdfce8a055 arch/x86_64: add spinlock support
Add spinlock support for x86_64, needed for SMP

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-27 10:27:34 -03:00
chao an
b413a1f4f7 arm/armv8-r: fix build break if disable CONFIG_UART_PL011
Common code should support the if PL011 is not enabled

Signed-off-by: chao an <anchao@lixiang.com>
2024-02-27 21:22:40 +08:00
p-szafonimateusz
b3c4f3afc3 x86_64/common/Toolchain.defs: change optimization to -Os for CONFIG_DEBUG_FULLOPT
change optimization to -Os for CONFIG_DEBUG_FULLOPT to be compatible with other architectures
and add an option to select CONFIG_DEBUG_CUSTOMOPT

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-26 18:18:20 -03:00
p-szafonimateusz
3a3341ba0e arch/intel64: enable FPU and implement up_fpucmp to pass ostest
enable FPU and implement up_fpucmp to pass ostest

With aggressive optimization enabled (-O2/-O3), ostest FPU test will fail.
This is because the compiler will generate additional vector
instructions between subsequent up_fpucmp() calls (loop vectorization
somewhere in usleep() call), which will consequently overwrite
the expected FPU context (XMM registers).

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-26 18:17:37 -03:00
p-szafonimateusz
5288e063ec newlib: fix support for x86
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-26 23:56:47 +08:00
p-szafonimateusz
b14c3e1e2e arch/intel64: add software reset support
This adds a software reset for intel64, enables the use of
the reboot command from NSH
2024-02-26 23:55:14 +08:00
chenwen@espressif.com
638df3329b xtensa/esp32s3: Fix issue of system blocking when SPIRAM is used as stack
1. Fix issue of system blocking due to disable dcache.
   2. Support Ext-SRAM-Cache mmu mapping in SMP mode.

Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-02-26 12:38:30 -03:00
p-szafonimateusz
743bbfcd7e arch/intel64/Kconfig: add chip choice option
this will be useful for auto selecting CPU features
2024-02-26 20:06:35 +08:00
p-szafonimateusz
39c7ae683f arch/x86_64/Kconfig: remove unused QEMU options
boards definition should be in /boards
2024-02-26 20:06:35 +08:00
p-szafonimateusz
5c85b8618c arch/intel64: prase multiboot2 header before revoking the lower memory
__revoke_low_memory() is called in intel64_lowsetup()

fixes b4b96a6435 (PR #11758) in which the multiboot2 header was accessed
after revoking the low memory which caused page fault.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-24 09:21:04 -08:00
p-szafonimateusz
8c4612be50 arch/intel64: add g_ prefix to global data
to follow NuttX coding standard

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-23 18:16:10 -08:00
p-szafonimateusz
8a43bf1b50 arch/intel64: clear BSS in __nxstart
BSS nulling can now be optimized by the compiler, so it is necessary
to enable SSE instructions early in __nxstart

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-23 18:16:10 -08:00
p-szafonimateusz
b4b96a6435 arch/intel64: convert __nxstart to C function and move appropriate functions there
to follow the approach in other architectures

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-23 18:16:10 -08:00
p-szafonimateusz
f76017ca8a arch/intel64: format asm files, remove unused debug macros
use tab at the beginning of lines, remove C++ comments, fix some tabs to spaces

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-23 18:16:10 -08:00
p-szafonimateusz
16e47d6c8b arch/intel64: fix stack alignment
The stack pointer must be aligned to 16 bytes, otherwise the system crash on the first unaligned data access with vector instruction.
The problem is only observable with optimization enabled, when vector instructions are generated.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-02-23 12:04:54 -03:00
p-szafonimateusz
c3d41195c7 arch/intel64/stackframe.c: fix memset size
this is a follow up to the change from 2335b69120 which missed
updating stack frame length for this memset

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-23 12:04:54 -03:00
Michał Łyszczek
aa75b7f27c stm32/stm32f30xxx_rcc.c: fix broken flash setup
During removal of F1 related stuff, code that configures FLASH
latency was removed, which rendered some of the F3 line unbootable.

It was done by mistake, since previous removed block was
'#ifdef VALUE_LINE', and block with FLASH code was '#ifndef VALUE_LINE'
and so it should not have been removed.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
2024-02-23 06:11:26 +01:00
p-szafonimateusz
9b0017659c arch/x86_64: add cmake support
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-23 07:45:57 +08:00
nuttxs
d2b4734756 Deinitialize ESP32-S3 SPI slave GDMA engine 2024-02-22 04:34:29 -08:00
chao an
996b9377a7 arch/tricore: add Infineon AURIX TriCore support
Add support for tricore TC397

1. Porting based on AURIX TC397 KIT_A2G_TC397_5V_TFT evaluation board

   https://www.infineon.com/cms/en/product/evaluation-boards/kit_a2g_tc397_5v_tft/

2. In order to avoid license and coding style issues, The chip-level code
   still uses the implementation of AURIX Development Studio SDK.
   The SDK package will be downloaded as a third-party package during compilation:

   https://github.com/anchao/tc397_sdk

3. Single core only, SMP implementation will be provided in the future.
4. Implemented the basic System Timer, ASCLIN UART driver.
5. Only the Tasking tool chain is supported (ctc/ltc, license maybe required)
6. 'ostest' can be completed on the TC397 development board.

How to run?

1. Setup the tasking toolchain and license

$ export TSK_LICENSE_KEY_SW160800=d22f-7473-ff5d-1b70
$ export TSK_LICENSE_SERVER=192.168.36.12:9090

2. Build nuttx ELF

$ ./tools/configure.sh tc397/nsh
$ make -j
...
artc I800: creating archive libc_fpu.a
LD: nuttx

3. Switch to windows PC, setup AURIX-studio to Debugger Launcher

4. Replace runing ELF to nuttx, and re-download ELF

Signed-off-by: chao an <anchao@lixiang.com>
2024-02-21 21:39:19 -08:00
Eren Terzioglu
aa0dccb7bc risc-v/espressif: Add SPI Flash support 2024-02-21 07:19:51 -08:00
Yanfeng Liu
4456b2db29 risc-v/k230: add IPI support to speed up RPTUN/RPMSG
This patch adds inter-processor interrupt support using K230 mailbox
device to improve the RPMsg efficiency. The polling logic has been
dropped.

Major changes:

- in arch/risc-v/include/k230:
  - irq.h          add IRQ for IPI devices
- in arch/risc-v/src/k230:
  - Kconfig        add IPI related config, increase polling delay
  - Make.defs      add k230_ipi.c to CHIP_SRCS
  - k230_hart.c    fix typo, add notes of zero MISA reading w/ NUTTSBI
  - k230_irq.c     use K230_PLIC_IRQS as ext IRQ limit to support IPI
  - k230_rptun.c   use IPI instead of polling
- in boards/risc-v/k230/canmv230/configs
  - master         enable IPI support
  - remote         enable IPI, TMPFS, RPMSGFS etc

New additions:

- in arch/risc-v/src/k230:
  - k230_ipi.h     add K230 IPI related defintions
  - k230_ipi.c     add K230 IPI driver

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-02-21 04:37:03 -08:00
chao an
f4bc5b5c6b cmake/toolchain: fix compiler warning on ARM32
-- Detecting CXX compile features
-- Detecting CXX compile features - done
arm-none-eabi-gcc: error:  -Wstrict-prototypes: No such file or directory
arm-none-eabi-gcc: error:  -Wstrict-prototypes: No such file or directory
-- Configuring done
-- Generating done

Signed-off-by: chao an <anchao@lixiang.com>
2024-02-21 00:43:42 -08:00
Rdk-T
cc95a76795 Add XMC4 flash command sequence API 2024-02-20 08:52:27 -08:00
simonatoaca
bb6f32d610 esp32-sparrow-kit: Add I2S support for the board's microphone
The board's microphone uses 24-bit i2s and this commit also fixes
the segmentation fault caused by the audio buffer overflow.

arch/xtensa/src/esp32/esp32_i2s.c: Fix bug regarding 24-bit audio and add AUDIOIOC_STOP to ioctl
drivers/audio/audio_i2s.c: Report number of channels on AUDIOIOC_GETCAPS
in boards/xtensa/esp32/esp32-sparrow-kit:
	/configs/nsh/defconfig: Add I2S configs
	/src/esp32-sparrow-kit.h: Add the signature of esp32_i2sdev_initialize()
	/src/esp32_bringup.c: Add call to esp32_i2sdev_initialize()

Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>
2024-02-20 06:46:06 -08:00
Tiago Medicci Serrano
e49684d781 risc-v/esp_<rmt|ws2812>: Implement the RMT peripheral for ESP32 RVs
This commit implements the RMT peripheral for all the supported
Espressif's RISC-V devices. It also implements the support for the
WS2812 addressable RGB LED using the RMT peripheral.
2024-02-19 19:02:34 -08:00
Tiago Medicci Serrano
62a608b558 xtensa/esp_ws2812: Get actual RMT clock to encode WS2812 data
WS2812 data is encoded into RMT items according to the RMT clock
source. This commit makes it by using the actual clock source in
spite of a pre-defind value.
2024-02-19 19:02:34 -08:00
Xiang Xiao
2e91c07ca7 Remove the back slash from long literal string
since the back slash is only needed for the long macro definition

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-19 16:43:15 +01:00
chao an
e11c793b33 toolchain/tasking: add dependencies rules for tasking compiler
Tasking compiler uses customized compilation options for generating dependencies files

Signed-off-by: chao an <anchao@lixiang.com>
2024-02-19 03:36:43 -08:00
freakishness
b283e39eb5 Add support for hpm6360evk 2024-02-18 09:17:56 -08:00
raiden00pl
02b418a7ea arch/arm/src/nrf52/CMakeLists.txt: format file 2024-02-18 07:40:41 -08:00
raiden00pl
b3b543e093 arch/nrf52: add initial support for IEEE 802.15.4
Supported features:

- frame transmition
- frame reception and filtering
- immediate ACK (incoming and outgoing)
- promiscuous mode
- delayed transmision
- radio events trace
- setting pending bit for all incoming Data Request frames
- un-slotted CSMA-CA

Work in progres features (some logic is present, but they require more work):

- beacon transmision (periodic transmition works, but requires verification)
- slotted CSMA-CA
- GTS

Fetures not implemented:

- enhanced ACK (Enh-ACK)
- enhanced beacon
- low power mode
- advanced features from IEEE 802.15.4e (DSME, TSCH)

Added examples for boards:

- nrf52832-dk: mrf24j40_6lowpan
- nrf52832-dk: mrf24j40_mac
- nrf52840-dk: ieee802154_6lowpan
- nrf52840-dk: ieee802154_mac
- nrf52840-dongle: ieee802154_mac
- nrf9160-dk-nrf52: ieee802154_6lowpan
- nrf9160-dk-nrf52: ieee802154_mac
2024-02-18 07:40:41 -08:00
raiden00pl
3f763f5d69 nrf52/nrf52_radio: various changes to support IEEE802154
- remove read-write logic - this should be handled by radio protocol implementation
- remove EVENTS and TASKS bit definitions - we can just use a signle definition
- add more radio ops
- fix frequency configuration
- fix printf warnings
- fix radio reset
2024-02-18 07:40:41 -08:00
Bowen Wang
de61a8e009 intel64/Toolchain.defs: move toolchain releated option to Toolchain.defs
Follow other arch does, move common toolchain option to Toolchain.defs

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-02-18 05:34:53 -08:00
Bowen Wang
415f13372d x86_64_netinitialize: support CONFIG_NETDEV_LATEINIT for x86_64
Now x86_64 can use config CONFIG_NETDEV_LATEINIT

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-02-18 05:34:53 -08:00
raiden00pl
f4324e118e arch/nrf{52|53|91}: let the events from comparator correspond to CC id
this allows us to use the same value to set the comparator and handle comparator events,
making RTC easier to use
2024-02-17 05:00:35 -08:00
raiden00pl
a77c3b367a arch/nrf{52|53}/gpiote.c: fix event reconfiguration for a given pin
if a given pinset is already used, we need to update it, not add another event
2024-02-17 05:00:06 -08:00
raiden00pl
dbbe06193e arch/arm/src/nrf{52|53|91}/xxx_rtc.h: include nuttx/irq.h
fixes undefined xcpt_t error that sometimes occurs
2024-02-17 04:59:49 -08:00
Alan Carvalho de Assis
940f1bace0 arch/stm32h7: Clear all PWM channel when during STOP
I noticed when executing pwm STOP command in
multichannel mode, the channel still outputting.

This commit fixes this issue.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2024-02-15 21:27:22 -08:00
Alan Carvalho de Assis
5975b25951 arch/stm32f7: Clear all PWM channel when during STOP
I noticed when executing pwm STOP command in
multichannel mode, the channel still outputting.

This commit fixes this issue.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2024-02-15 21:27:22 -08:00
Alan Carvalho de Assis
6d346793ee arch/stm32: Clear all PWM channel when during STOP
I noticed when executing pwm STOP command in
multichannel mode, the channel still outputting.

This commit fixes this issue.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2024-02-15 21:27:22 -08:00
Yanfeng Liu
709a1c61f1 risc-v/k230: revise k230 hart operations and kernel linker script.
This patch revises `k230_hart.[ch]` by:

  - revising big core boot/stop control.
  - making k230_hart_is_big() available in S-mode.
  - adding more comments.

This patch also revises the `ld-kernel.script` so that to match the
latest MMU pgtable design.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-02-15 19:53:24 -08:00
Yanfeng Liu
a4b22fe999 risc-v/k230: initial Asymmetric Multi-Processing support
K230 chip has two T-Head C908 RiscV cores, previously we run NuttX
on either little or big cores. This patch runs NuttX on both cores
with OpenAMP support via the RPTUN driver.

New additions:

- in arch/risc-v/src/k230
  - k230_rptun.c              K230 RPTUN driver
  - k230_rptun.h              K230 RPTUN driver header file

- in baords/risc-v/k230/canmv230
  - configs/master            Build config for master node
  - configs/remote            Build config for remote node
  - scripts/ld-rptun.script   Build script for RPTUN

Major changes:

- arch/risc-v/Kconfig         Select NUTTSBI_LATE_INIT upon NUTTSBI
- in arch/risc-v/include
  - k230/irq.h                Add UART3 IRQ defs
- in arch/risc-v/src/k230
  - Kconfig                   Add RPTUN related config items
  - Make.defs                 Add k230-rptun.c to sources
  - hardware/k230_memorymap.h Add K230 device and CSR defs
  - k230_hart.c               Add hart ctrl for RPTUN
  - k230_hart.h               Add hart ctrl for RPTUN
  - k230_mm_init.c            Add Svpmbt to support RPTUN
  - k230_start.c              Revised to support RPMsg UART
- in boards/risc-v/k230/canmv230
  - scripts/Make.defs         Add RPTUN script selection
  - src/canmv_init.c          Add RPTUN and RPMsg_UART initialization
- in Documentation/platforms/risc-v/k230/boards/canmv230
  - index.rst                 Add AMP usage information.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-02-13 10:34:21 -03:00
Nicolas Lemblé
4a85fbfd09 arch/xmc4: Fix CCU registers 2024-02-13 10:33:04 -03:00
Eren Terzioglu
de948babbf xtensa/esp32s2: Fix esp32s2 wdt interrupt bug 2024-02-13 10:31:35 -03:00
Roberto Bucher
4a04c22147 STM32-H745 files for pysimCoder 2024-02-10 20:01:12 -03:00
trns1997
5c118967bb build xmc4800-relax using CMake 2024-02-10 10:20:59 -03:00
Raman Gopalan
0967eb4c24 avr32dev1: Fix compilation and nsh boot-up
I recently imported NuttX version 6.0 (and nsh) into a Microchip
Studio project [1] on Windows to figure out what was going wrong with
the avr32dev1 build. I also briefly checked NuttX version 10.

I worked with the assumption that the avr32 (avr32dev1) specific
changes to the codebase were minimal across NuttX releases.

For the initial proof of concept I used Microchip Studio version 7.0
(with the recent Microchip's ASF updates). I use avr32-gcc (4.4.7)
hosted here [2] for building NuttX for avr32dev1 on GNU/Linux.

Even with the Microchip Studio project, I had initial debug problems
with just stepping through the code a line at a time. I had to bring
in crt0, a trampoline stub and the linker file from one of my older
projects to really build on the suspicion I had with the linker file.

Perhaps an older version of avr32-gcc did something differently. I am
not sure about this. I used avr32-objdump to see the output sections
of the generated elf file. I just had to tweak the linker script to
ensure correct linking of the sections.

With those changes, I was able to inspect the UART sections within
NuttX Microchip Studio project.

Second important change: the transmit pin: I had to reassign the pin
to see the nsh console.

These are the currently assigned UART pins:

RX: PA_24 -> Physical IC pin 59
TX: PB_02 -> Physical IC pin 24

For the avr32dev1 board, they are pins: J1 (berg pin 28) and J2 (berg
pin 10).

In addition, the PR fixes silly compilation problems with avr32dev1.

I have tested the nsh build with my avr32dev1 boards. I used Atmel ICE
to program one of them (flash at 0x80000000) and dfu-programmer to
test my other board (flash at 0x80002000). The other RS-232 parameters
are the same as they were.

References:
[1]: https://github.com/ramangopalan/nuttx_avr32dev1
[2]: https://github.com/ramangopalan/avr32-gnu-toolchain-linux_x86_64
2024-02-08 11:12:13 -03:00
Michal Lenc
2849cd7c6d arch/samv7: add function to retrieve reset cause from HW
SAMv7 reset controller stores the cause of last reset (SW reset, power up,
pin reset etc.) in status register. This commit adds function that allows
the board to retrieve this information. This function should be called
from board support layer either during initialization or based on
incoming ioctl call.

Adding the sam_get_reset_cause() to sam_systemreset.c also resulted in
always compiling this file by default and only putting up_systemreset()
under CONFIG_SAMV7_SYSTEMRESET option.

Also header file sam_systemreset.h was created as it defines reset types
in comfortable manner for future processing in board layer. This is done
to avoid passing boardctl dependent structure to architecture layer.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-02-07 13:26:37 -03:00
Aaron Matlock
470ad35508 cmake: Fixed nucleo-u5a5zj-q 2024-02-07 03:20:43 -08:00
Jukka Laitinen
888dc229fa arch/risc-v/src/mpfs/mpfs_serial.c: Allow switching uart output to console off
By setting "isconsole" to false, mpfs_serial stops outputting to console.

This can be used to disable output to debug console in low level.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-02-06 08:53:05 -08:00
Jukka Laitinen
a28f6716d5 arch/risc-v/src/mpfs/mpfs_irq.c: Fix up_irqinitialize for warm reboot
It is possible that a PLIC IRQ is claimed but not completed at warm
reset. This occurs at least if there is a fault in the middle of irq
handler execution.

To recover from such situation, we can complete all IRQ:s in PLIC;
this completes any already claimed IRQ, but has no effect on IRQs
which are not claimed or not enabled.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-02-06 08:52:46 -08:00
Jukka Laitinen
df01c83c25 arch/risc-v/src/mpfs/mpfs_i2c.c: Recover i2c from pending transactions in warm boot
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-02-06 08:52:31 -08:00
Jukka Laitinen
2b10b38c1d arch/risc-v/src/mpfs/mpfs_i2c.c: Add more i2cerr traces
Add sanity checks for debugging possible errors in the driver.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-02-06 08:52:31 -08:00
Jukka Laitinen
120dfbd45f arch/risc-v/src/mpfs/mpfs_i2c.c: Correct i2c reset / error recovery
- Use mpfs_i2c_deinit+mpfs_i2c_init sequence to re-initialize i2c block
- Use the i2c mutex to protect the reset; in case there are several devices
  on the same bus, and one of them resets the bus, reset must not occur in
  the middle of another device's transfer.
- Move irq attach to the i2c_init as the irq detach is in i2c_deinit

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-02-06 08:52:31 -08:00
Jukka Laitinen
fc4b39b1dd arch/risc-v/src/mpfs/mpfs_i2c.c: Add more error status codes
Add more error status codes to help debugging in the future.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-02-06 08:52:31 -08:00
Jukka Laitinen
dae31dc866 arch/risc-v/src/mpfs/mpfs_i2c.c: Clear I2C_CTRL bits when initializing/deinitializing bus
Ensure that there are no pending state or interrupts in the i2c controller. This removes
errors caused by deinitialize/initialize sequences in error cases.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-02-06 08:52:31 -08:00
Eero Nurkkala
bcf7aa4b63 risc-v/mpfs: i2c: perform sanity checks
Replace risky DEBUGASSERT()s with real sanity checks. Also,
do a few more checks as the system might occasionally fire an
interrupt if the system has been restarted while in middle of
an i2c transaction.

Yet, modify i2c_transfer() function so that up_disable_irq()
is always called at the end to better prevent ill-timed irqs.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2024-02-06 08:52:31 -08:00
Eero Nurkkala
b0cef9e008 risc-v/mpfs: i2c: prevent out of bounds read access
priv->msgid may grow past its boundaries, causing
struct i2c_msg_s *msg = &priv->msgv[priv->msgid]
to read data out of boundaris.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2024-02-06 08:52:31 -08:00
Rdk-T
7f01db30dc Add EtherCAT support on xmc4800-relax. 2024-02-05 22:23:30 -08:00
SPRESENSE
a303ec8653 arch: cxd56xx: Add new feature to use GNSS RAM
As long as the GNSS feature is not used, GNSS RAM can be used as general memory.
This memory is 640KByte total, which is lower performance than the application RAM.
It is possible to locate text, data and bss into GNSS RAM and to use as heap area.
2024-02-05 05:53:51 -08:00
SPRESENSE
fc5ae43dda arch: cxd56xx: Add function to control GNSS RAM clock
Add function to enable and disable GNSS RAM clock.
2024-02-05 05:53:51 -08:00
SPRESENSE
1b3b12ed00 arch: cxd56xx: update loader and gnssfw version
Update loader and gnssfw to version 2.2.20591
2024-02-05 05:53:51 -08:00
Adam Comley
399cd88e7f Support RP2040 Clock Outputs 2024-02-04 16:51:53 -08:00
Xiang Xiao
ebc6924b26 risc-v/mpfs: Remove thee unused seq[s|m] fields
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-04 09:54:05 +01:00
Xiang Xiao
1e3914ec9d rptun: Remove the unused shmemname field and argument
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-04 09:54:05 +01:00
Xiang Xiao
6a6bd30500 rptun: Remove the empty implementation of get_firmware and get_addrenv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-04 09:54:05 +01:00
Xiang Xiao
43d51cd4fc arch: Remove the identity mapping of up_addrenv_va_to_pa and up_addrenv_pa_to_va
and reuse the reuse the implementation from:
drivers/misc/addrenv.c

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-04 09:54:05 +01:00
Yanfeng Liu
73ecd741e7 risc-v/common: add param to mmu_flush_cache interface
Current mmu_flush_cache() hook lacks the reg param which needed by
some targets. So this PR adds the param and update existing targets
using that hook.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-02-03 22:05:42 -08:00
Tomáš Pilný
3e85c1886e esp32/dac-one-shot: lower-half driver for ESP32 internal DAC
Enable with ./tools/configure.sh -l esp32-devkitc:dac
DAC channel 0 = GPIO 25
DAC channel 1 = GPIO 26
default path: /dev/dac0

Resolution 8 bits = values 0~255
Voltage: 0~Vref

The reference voltage 'Vref' here is input from the pin VDD3P3_RTC
which ideally equals to the power supply VDD (3.3V).
2024-02-02 09:23:28 -08:00
Ville Juven
8e4b2e8a2a arch/arm_addrenv_pgmap.c: Add minimal page map implementation for ARM 2024-02-02 09:09:55 -08:00
Ville Juven
15f19c32ac arch/addrenv: Add utility function to wipe one page
up_addrenv_page_wipe can be used to wipe a single page of memory.
2024-02-02 09:09:55 -08:00
Yanfeng Liu
6594439271 risc-v/nuttsbi: fix weak sbi_late_initialize issues
Weak function sometimes can't have strong implementation linked.
This patch uses NUTTSBI_LATE_INIT config and normal function instead
to avoid those issues.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-02-01 21:26:16 -08:00
Jari Nippula
e40b66bd6f risc-v/mpfs: wrapper for sdio device drivers
Additional mpfs_sdio layer on top of mpfs_emmcsd and mpfs_coremmc
block device drivers to let both block devices be enabled at the
same time.
2024-02-01 02:07:32 -08:00
Yanfeng Liu
dbe42db611 arch/Kconfig: replace RPTUN_PING with RPMSG_PING
The RPTUN_PING option has been replaced by RPMSG_PING but this
use for PERF_EVENTS is left behind, so replace it here as well.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-02-01 16:50:23 +08:00
Eren Terzioglu
d1db1810ad risc-v/espressif: Rename espressif/esp32c3 as esp32c3
risc-v/espressif: Rename espressif/esp32c6 as esp32c6
risc-v/espressif: Rename espressif/esp32h2 as esp32h2
2024-01-30 08:32:05 +01:00
Eren Terzioglu
c8d7c81cb9 risc-v/esp32c3: Rename legacy approach esp32c3 as esp32c3-legacy 2024-01-30 08:32:05 +01:00
Eren Terzioglu
4c4d62ff93 Rename espressif folder as common/espressif 2024-01-30 08:32:05 +01:00
Eren Terzioglu
721c37a876 risc-v/esp32c6: Remove duplicated esp32c6 implementation 2024-01-30 08:32:05 +01:00
Yanfeng Liu
0f169f50c4 risc-v/k230: add big core support
Previously NuttX runs on little core of K230, this patch allows NuttX to
run on the big core as well.

Within folder `arch/risc-v/src/k230`:

- Changes:

    - CMakeLists.txt      add k230_hart.c to sources list
    - Make.defs           add k230_hart.c to sources list
    - chip.h              add inclusion to k230_hart.h etc
    - k230_irq.c          move sbi_late_init() to k230_hart.c
    - k230_start.c        add support to run on big core
    - hardware/:
      - k230_memorymap.h  add T-Head C908 specific CSR

- Additions:

    - k230_hart.c         sbi_late_init w/ hart initialization
    - k230_hart.h         header file

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-29 09:06:28 +01:00
raiden00pl
9d761b8ca4 arch/{nrf52|nrf53|nrf91}/tim.c: fix typo
fix offset for EVENT COMPARE0
2024-01-28 09:46:34 -08:00
Yanfeng Liu
f69f0674f6 arch/risc-v: add status fields for VS and XS
add defintions for vector extension and additional user-mode
extension fields for MSTATUS and SSTATUS registers.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-28 06:38:25 -08:00
ThomasNS
fff193324d xmc4 ccu4 register map 2024-01-27 20:14:02 -08:00
Yanfeng Liu
bb63f8f36d risc-v/canmv230: add CMake support
Adding CMakeLists.txt files to support CMake build system.
Note that only FLAT build works now due to limitations of current
CMake build system.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-27 00:56:57 -08:00
Benign X
8ba74d06c6 arch/sim: fix X11 compile failed 2024-01-27 00:51:32 -08:00
chenwen@espressif.com
ba1b96e9d9 xtensa/esp32s3: Add DMA peripheral to spi driver configuration
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-01-26 19:14:04 -08:00
chenwen@espressif.com
8bef8ee9d5 xtensa/esp32s3: Fix crash issue that occurs when deleting a semaphore in WPA3
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-01-26 04:45:26 -08:00
Takeyoshi Kikuchi
8571893435 arm: sama5: sam_serial: fix to compile with "UART Flow control enabled" on SAMA5D2.
SAMA5D2 has UART (TX/RX only) and FLEXCOM USART (with control pins).
UART has only TX/RX, so if I try to use flow control with FLEXCOM USART,
there is no register definition on the UART side and get a compilation error.

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
2024-01-26 11:25:23 +08:00
Michal Lenc
addfa1c030 samv7: fix QSPI DMA option not showing in menuconfig
Commit 03e5c02 introduced option to have both standard SPI and QSPI
in SPI mode on one system. However this change broke the appearance of
QSPI driver configuration menu entry in menuconfig as it was dependent
on !SAMV7_QSPI_IS_SPI (which is now true for all MCUs having standard
SPI ability in QSPI driver).

This change makes sure the menu is correctly shown when QSPI driver
used.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-01-25 18:19:27 -08:00
raiden00pl
a12fdd8876 cosmetic changes after pci code rebase 2024-01-25 09:09:30 -08:00
raiden00pl
2e758f33ee fix various compilation errors after pci code rebase 2024-01-25 09:09:30 -08:00
Brennan Ashton
0ed4123326 x86_64: Early framebuffer console
This adds support for creating an early frame buffer and primatives for
writing to this frame buffer as a console. This does require the font
infrastructure as well as multiboot2.

Additionally this can now be used with a UEFI bootloader long as it
boots NuttX via Multiboot2.  There does seem to be a PCI interrupt
issue when running in UEFI mode.

I was able to boot my laptop using this and see PCI devices enumerate.

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>

x86_64: Add conditionals around the multiboot framebuffer
2024-01-25 09:09:30 -08:00
Ville Juven
a188cf3480 mpfs_corespi: Fix firing of stale interrupt after warm reset
After warm reset the interrupt source in the HW block is not explicitly
cleared, thus once the interrupt source is enabled the old / stale interrupt
fires immediately.

This causes a DEBUGASSERT() failure on line 808 mpfs_spi_unload_rx_fifo:
  DEBUGASSERT(nwords > 0);
2024-01-25 11:23:12 -03:00
Tiago Medicci Serrano
c4f76ff867 esp32c3: Fix building native MCUboot from sources
This commit fixes building native MCUboot from sources by getting
the required sources from `esp-hal-3rdparty` repository and enable
building MCUboot and using it as the 2nd stage bootlaoder.
2024-01-25 11:22:39 -03:00
Tiago Medicci Serrano
a2673d3bcd esp32c3: Improve selection of the bootloader being used on Kconfig
- A pre-built IDF bootloader is used by default;
- `ESP32C3_PARTITION_TABLE` requires the IDF bootloader to be built
from sources.
- Native MCUboot also can be used to boot the device. It will be
built from sources and depends on !ESP32C3_PARTITION_TABLE.
2024-01-25 11:22:39 -03:00
Tiago Medicci Serrano
641a0df27f esp32s3: Improve selection of the bootloader being used on Kconfig
- A pre-built IDF bootloader is used by default;
- `ESP32S3_PARTITION_TABLE` requires the IDF bootloader to be built
from sources.
- Native MCUboot also can be used to boot the device. It will be
built from sources and depends on !ESP32S3_PARTITION_TABLE.
2024-01-25 11:22:39 -03:00
Tiago Medicci Serrano
1e1ea7bb5d esp32s2: Improve selection of the bootloader being used on Kconfig
- A pre-built IDF bootloader is used by default;
- `ESP32S2_PARTITION_TABLE` requires the IDF bootloader to be built
from sources.
- Native MCUboot also can be used to boot the device. It will be
built from sources and depends on !ESP32S2_PARTITION_TABLE.
2024-01-25 11:22:39 -03:00
Tiago Medicci Serrano
ec3714c816 esp32: Improve selection of the bootloader being used on Kconfig
- A pre-built IDF bootloader is used by default;
- `ESP32_PARTITION_TABLE` requires the IDF bootloader to be built
from sources.
- Native MCUboot also can be used to boot the device. It will be
built from sources and depends on !ESP32_PARTITION_TABLE.
2024-01-25 11:22:39 -03:00
Tiago Medicci Serrano
7ac14b544e risc-v/espressif: Select simple boot by default for RISC-V
Simple boot is a method of booting that doesn't depend on a 2nd
stage bootloader. Please note that some of the ESP-IDF bootloader
features are not available using simple boot, such as partition
tables and OTA: most of these features are implemented in NuttX
and MCUboot.
2024-01-25 11:22:39 -03:00
Michal Lenc
fba4b2593c samv7: refactor DAC driver
This commit refactors DAC driver. The functionality remains the same
but driver start up is now done in dac_setup (after application called
open function) instead of sam_dac_initialize (called from BSP). This
ensures that driver does not take resources (timer, interrupt) until
opened. Implementation of dac_shutdown is also provided, therefore
the driver frees resources once closed.

This change is consistent with other drivers implementation.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-01-24 18:46:33 -08:00
Michal Lenc
55ec92e181 samv7: add support for SPI mode in USART peripheral
USART peripheral can work in SPI mode as well. This commit adds support
for such functionality. Only 1 slave device is supported by the
peripheral therefore board level does not have to ensure correct CS
setup.

The usage of the peripheral is the same as with other SPI drivers.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-01-23 17:16:35 -03:00
chenwen@espressif.com
bdd02cc624 xtensa/esp32s3: Add APIs to release DMA channel resources
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-01-23 17:16:16 -03:00
Almir Okato
f8b0b06b97 esp32c3-generic: add simple boot support
The Simple Boot feature for Espressif chips is a method of booting
that doesn't depend on a 2nd stage bootloader. Its not the
intention to replace a 2nd stage bootloader such as MCUboot and
ESP-IDF bootloader, but to have a minimal and straight-forward way
of booting, and also simplify the building.

This commit also makes this bootloader configuration as default
for esp32c3-generic target and removes the need for running
'make bootloader' command for it.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2024-01-23 04:09:25 -08:00
w2016561536
6b5ca79509 esp32s3/spi-dma: Fix spi dma transfer.
Fix esp32s3 spi dma transfer only transmit first byte and receive empty problem.
2024-01-23 04:05:52 -08:00
Lee Lup Yuen
62c358946d risc-v/bl808: Flush MMU Cache after updating SATP
Ox64 BL808 crashes with a Page Fault when we run `getprime` then `hello`. This is caused by the T-Head C906 MMU incorrectly accessing the MMU Page Tables of the Previous Process (`getprime`) while starting the New Process (`hello`).

To fix the problem, this PR flushes the MMU Cache whenever we point the MMU SATP Register to the New Page Tables. We execute 2 RISC-V Instructions that are specific to T-Head C906:

- DCACHE.IALL: Invalidate all Page Table Entries in the D-Cache
- SYNC.S: Ensure that all Cache Operations are completed

This is derived from the T-Head Errata for Linux Kernel. More details here: https://lupyuen.github.io/articles/mmu#appendix-flush-the-mmu-cache-for-t-head-c906

Modified Files:

- `arch/risc-v/src/common/riscv_mmu.h`: If needed, `mmu_write_satp()` calls `mmu_flush_cache()` (weak function) to flush the MMU Cache. (Like for T-Head C906)

- `arch/risc-v/src/bl808/bl808_mm_init.c`: Flush the MMU Cache for T-Head C906. Extend `mmuflags` from 32-bit to 64-bit to be consistent with `mmu_ln_setentry()`.

- `boards/risc-v/bl808/ox64/configs/nsh/defconfig`: Enable `ostest` in the Build Config. Update `CONFIG_BOARD_LOOPSPERMSEC` according to `calib_udelay`.
2024-01-23 01:25:20 -08:00
Yanfeng Liu
cba993df85 risc-v/cmake: add support to Ubuntu stock toolchain
Ubuntu stock toolchain `gcc-riscv64-unknown-elf` complains about
current CMake system (see issue#11573). This tries to fix it so
that both newer XPack and stock toolchains can be used with CMake.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-23 01:23:44 -08:00
David Sidrane
6c186b6084 stm32h7:serial make TX DMA busy when there are an outstanding transaction
If a TX DMA completion interrups a forground write.
    The TX DMA completion can start a dma_send and it will
    then followed by the forground write's dma_send
    stoping the,then in progress DMA.

    By atomicaly marking the tx dma busy, the forground
    write will not perform the dma_send, and will only
    enqueue the data. At the next TX dma completion any
    data pending in the tx queue will be sent
2024-01-22 06:06:01 -08:00
ThomasNS
1c28bf2ed1 fix typo: it is P4.0 and not P0.4 2024-01-22 05:46:33 -08:00
Tiago Medicci Serrano
0ecc3aaad2 esp32: Explicitly fail on boot-up for unsupported ESP32 versions.
ESP32 is supported on NuttX starting from chip revision 3.0. This,
however, didn't prevent the user from using older chip revisions,
which caused unexpected behaviors. This commit checks chip revision
before finishing booting NuttX.
2024-01-21 06:33:25 -08:00
Tiago Medicci Serrano
2954551ef6 esp32/hardware/esp32_efuse.h: Update macros for registers.
This commit is intended to update the EFUSE's register content and
update related configs:
 - Remove duplicated configs from `esp32_soc.h`;
 - Add missing header files from APB registers;
 - Add missing macro definitions from EFUSE;
 - Update related code to use the new macros;
2024-01-21 06:33:25 -08:00
Tiago Medicci Serrano
8752e6d863 esp32/hardware: Rename efuse_reg.h to esp32_efuse.h. 2024-01-21 06:33:25 -08:00
Takeyoshi Kikuchi
bca8df7d65 arm: sama5: sam_ehci: fix transfer cancellation process.
The logic of the conditional expression that determines whether
the QH is a target QH or not is reversed in the process of canceling
a transfer in INPROGRESS state.

Therefore, the QH in INPROGRESS state is not released and subsequent
communication is not successful.

Checked with CDC-ACM driver and cu command.

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
2024-01-20 19:54:26 -08:00
Dong Heng
85238fa4de xtensa/esp32s3: Fix USB pull-up and pull-down issue
ESP32-S3 USB OTG device can't call function esp32s3_pullup to notify USB host that it connects or disconnects.
2024-01-18 17:53:16 -08:00
ThomasNS
e966fff597 add GPIO_U1C0_SCLKOUT_3 P4.0 for spi2 on xm4 2024-01-18 17:49:56 -08:00
chao an
02acf2d2a4 risc-v/cmake: set nostdlib to c compiler
To avoid build break:

ld: riscv-none-elf/lib/rv64imafdc_zicsr/lp64d/crt0.o: in function `.L0 ':
(.text+0x8): undefined reference to `__bss_start'
ld: (.text+0x10): undefined reference to `_end'
ld: (.text+0x36): undefined reference to `main'
collect2: error: ld returned 1 exit status

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-18 09:53:53 +01:00
chao an
2fd95611cb risc-v/cmake: configurable vendor ISA extensions
merge below commit into cmake:

1. risc-v/toolchain: configurable vendor ISA extensions

This option allows the platform to enable some vendor-customized ISA extensions,
E.g OpenHW, SiFive, T-Head.

SiFive Intelligence Extensions:
    SiFive Vector Coprocessor Interface(VCIX): xsfvcp
    SiFive FP32-to-int8 Ranged Clip Instructions: Xsfvfnrclipxfqf
    SiFive Matrix Multiply Accumulate Instructions: Xsfvfwmaccqqq
    SiFive Int8 Matrix Multiplication Instructions: XSFvqmaccqoq
Command Line:
    xsfvcp0p1_xsfvfnrclipxfqf0p1_xsfvfwmaccqqq0p1_xsfvqmaccqoq0p1

2. "V" Standard Extension for Vector Operations
3. "Q" Standard Extension for Quad-Precision Floating-Point

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-18 09:53:53 +01:00
w2016561536
829ec6d5e4 esp32s3/pwm: Fix pwm output
1. Fix pwm output always low problem.
2. Add multi channel support in defconfig
2024-01-17 22:42:08 -03:00
Yanfeng Liu
1e9434e2db arch/: remove duplicated task exit logs
Newly added logging in `sched/task_exit.c` obsoletes the existing
ones in `arch/up_exit()`, thus remove the latter to reduce duplications.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-17 09:18:17 -08:00
Yanfeng Liu
87c9a0ee76 risc-v/k230: add NUTTSBI based kernel build support
Previously k230 kernel build needs OpenSBI wrapping for use on
target, thus leading to larger program and memory overheads.
This patch adds alternative small overhead kernel build support.

Changes:

- in arch/risc-v/src/k230:
  - k230_head.S          entrance renamed for sake of NUTTSBI
  - k230_irq.c           add M-mode handling for NUTTSBI case
  - k230_mm_init.c       add L3 table for smaller RAM case
  - hardware/k230_plic.h add PLIC_CTRL definition
  - Make.defs            use CHIP_ASRCS to fix entrance selection
- in boards/risc-v/canmv230/scripts:
  - Make.defs            add support for NUTTSBI case

Additions:

- in boards/riscv/canmv230/:
  - scripts/ld-nuttsbi.script  link script for NUTTSBI case
  - configs/nsbi/defconfig     config for NUTTSBI case

The artifact nuttx.bin from this configuration can be used directly
on target as OpenSBI wrapping is not needed.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>

fix typo
2024-01-17 10:31:29 -03:00
w2016561536
6a0eeb1b3e esp32s3/spi: Add SPI bus init in bringup and fix SPI bus 2 and 3 conflict
1. Add spi bus init in esp32s3_bringup.c
2. Fix IOMUX conflict between spi bus 2 and 3
3. Add spi defconfig
4. Follow the standard of NuttX
2024-01-17 09:29:20 -03:00
chao an
95fcc286a2 risc-v/toolchain: configurable vendor ISA extensions
This option allows the platform to enable some vendor-customized ISA extensions,
E.g OpenHW, SiFive, T-Head.

SiFive Intelligence Extensions:
    SiFive Vector Coprocessor Interface(VCIX): xsfvcp
    SiFive FP32-to-int8 Ranged Clip Instructions: Xsfvfnrclipxfqf
    SiFive Matrix Multiply Accumulate Instructions: Xsfvfwmaccqqq
    SiFive Int8 Matrix Multiplication Instructions: XSFvqmaccqoq
Command Line:
    xsfvcp0p1_xsfvfnrclipxfqf0p1_xsfvfwmaccqqq0p1_xsfvqmaccqoq0p1

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-15 22:31:39 -08:00
chao an
ce201bba61 risc-v/kconfig: move ARCH_HAVE_MMU into mmu type define
Signed-off-by: chao an <anchao@lixiang.com>
2024-01-15 22:31:39 -08:00
chao an
52e99bc66b risc-v/toolchain: move zicsr/zifencei extension into Kconfig
Signed-off-by: chao an <anchao@lixiang.com>
2024-01-15 22:31:39 -08:00
chao an
f95bbb2949 risc-v/toolchain: add "V" Standard Extension into command line
"V" Standard Extension for Vector Operations

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-15 22:31:39 -08:00
chao an
3ee4227668 risc-v/toolchain: add "Q" Standard Extension into command line
"Q" Standard Extension for Quad-Precision Floating-Point

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-15 22:31:39 -08:00
chao an
90f24ec29d arch/risc-v: add ARCH_QPFPU for Quad-Precision Floating-Point
new options to enable toolchain support for quadruple precision
(128 bits or 16 bytes) floating point if both the toolchain and
the hardware support it.

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-15 22:31:39 -08:00
chao an
45cca933f8 CMake: arm/armv8-r: init armv8-r cmake build
Test cmake build on aarch32 fvp:
$ cmake -B build -DBOARD_CONFIG=fvp-armv8r-aarch32/nsh -GNinja
$ cmake --build build

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-15 00:46:52 -08:00
chao an
7c89f943c0 armv8-r/perf: enable perf count only ARCH_PERF_EVENTS is enabled
Signed-off-by: chao an <anchao@lixiang.com>
2024-01-15 00:46:52 -08:00
Yanfeng Liu
3c327efd2f docs/comments: fix some typos
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-15 13:22:13 +08:00
Yanfeng Liu
78e8c0dea5 risc-v/nuttsbi: add device specific initialization hook
Some devices have special preparations before entering S-mode, thus
a hook is needed from NUTTSBI to give them the chance.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-14 01:28:10 -08:00
Tiago Medicci Serrano
8fb05d44bc esp32s3/wifi: Fix Wi-Fi connection to WPA3-SAE APs.
This commit fix the connection issues while trying to connect to
WPA3-SAE-secured Access Points (APs).
2024-01-12 16:57:49 +01:00
Yanfeng Liu
f221878204 risc-v/nuttsbi: use ARCH_RV_MMIO_BITS for mtimer access selection
Chips like K230 has ARCH_RV64 but only supports 32-bit MMIO. So using
ARCH_RV_MMIO_BITS is more proper here.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-11 21:48:44 -08:00
chenwen@espressif.com
b739b2b18a xtensa/esp32s3: Support WPA3 on softap mode
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-01-12 13:41:58 +08:00
Ville Juven
983387e6dd mpfs_mpucfg.c: Add mpfs_mpu_lock()
Add method to lock an MPUCFG entry. Locking means the value of the register
cannot be changed until the SoC is reset.
2024-01-11 06:57:16 -08:00
Ville Juven
a0901ec142 mpfs_usb.c: Remove PMPCFG configuration from the driver
This is not the right place to modify DMA memory protection values.

Why not? These are designed to protect other AMP mode instances. Opening
the entire SoC's memory for the USB DMA kind of defeats this purpose.

Also, the driver cannot know how to configure these registers correctly,
only opening up the whole SoC "works".
2024-01-11 06:50:51 -08:00
chao an
181a31801d arm/armv8r: remove unused serial_pl011.h
Signed-off-by: chao an <anchao@lixiang.com>
2024-01-11 13:39:06 +01:00
chao an
b7bd2e33b1 arm/armv8-r: wfi secondary cores if SMP is disabled
Check cpu affinity in single core mode to avoid secondary cores bootup

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-11 12:29:59 +01:00
chao an
6e940b74f5 arm/fvp-v8r: fix arm_earlyserialinit() is not called correctly
USE_EARLYSERIALINIT will depends on the definition in arm_internal.h

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-11 00:52:17 -08:00
chao an
5eef09b4a1 arm/armv8-r: fix compile warning
armv8-r/arm_gicv3.c: In function 'gic_validate_dist_version':
armv8-r/arm_gicv3.c:730:9: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
  730 |   sinfo("GICD_TYPER = 0x%x\n", typer);
      |         ^~~~~~~~~~~~~~~~~~~~~  ~~~~~
      |                                |
      |                                uint32_t {aka long unsigned int}
armv8-r/arm_gicv3.c:730:26: note: format string is defined here
  730 |   sinfo("GICD_TYPER = 0x%x\n", typer);
      |                         ~^
      |                          |
      |                          unsigned int
      |                         %lx

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-11 00:51:28 -08:00
Yanfeng Liu
a9372627d8 risc-v/rv-virt: use fully linked apps for kernel build
Fully linked apps take less storage and are efficient to load. This
is to enable them for rv-vrit configurations in KERNEL build.

Changes:

- arch/risc-v/Kconfig       select BINFMT_ELF_EXECUTABLE for QEMU-RV
- boards/risc-v/qemu-rv/rv-virt/configs
  - knsh32/defconfig        enable ELF_EXECUTABLE, LIBM, OSTEST
  - knsh64/defconfig        enable ELF_EXECUTABLE, LIBM, OSTEST
  - ksmp64/defconfig        enable ELF_EXECUTABLE, LIBM, OSTEST
  - knetnsh64/defconfig     enable ELF_EXECUTABLE, LIBM, OSTEST
  - knetnsh64_smp/defconfig enable ELF_EXECUTABLE, LIBM, OSTEST

Additions:
- boards/risc-v/qemu-rv/rv-virt/scripts/
  - gnu-elf.ld              apps linker script

The ARCH_TEXT_VBASE of knsh32 is set to same as that of 64bit to reuse
the apps linker script.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-11 00:51:07 -08:00
Yanfeng Liu
da365c1cb0 risc-v/canmv230: enable fully linked apps for kernel build
Previously apps in kernel build are partially linked, thus are
big and inefficient. This enables full link for kernel mode apps
to reduce size and speed up loading.

Changes:

- arch/risc-v/Kconfig          select HAVE_ELF_EXECUTABLE for K230
- boards/../scripts/Make.defs  adjust LDELFLAGS
- boards/../knsh/defconfig     enable BINFMT_ELF_EXECUTABLE

Additions:
- boards/../scripts/gnu-elf.ld apps linker script

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-10 23:27:46 -03:00
chenwen@espressif.com
a774587088 esp32s3/rt_timer: Adjust spinlock position to avoid deadlock 2024-01-11 09:22:52 +09:00
Tiago Medicci Serrano
823a183c17 esp32s3/rt_timer: Fix deadlock on RT-Timer thread.
The RT-Timer thread may call the `start_rt_timer` function. This
function gets the spinlock with interrupts disabled to ensure
exclusive access. However, this was already being performed in the
RT-Timer thread, causing a deadlock.
2024-01-11 09:22:52 +09:00
Roy Feng
4761af7069 esp32[s2|s3] Following up update interrupt type constants.
Following up the 'Espressif HAL fullly integration for ESP32s2/s3'
changes in https://github.com/apache/nuttx/pull/11428
There are few missing interrupt type constants need update. So
update them to avoid the build error.
2024-01-10 09:54:55 -08:00
fangxinyong
c479ccb8aa sched: move etc romfs mount from nsh to sched/init
Usually the startup script is placed under /etc. The contents of the etc directory
are compiled and linked with Nuttx binary in the form of romfs. After startup,
it will be  mounted by Nsh.

etc is generated by the different boards, that use genromfs and xxd tools to generate
and compile it into the Nuttx, for example: boards/arm/at32/at32f437-mini/tool/mkromfs.sh
The more common method is etc image generated from the content in the corresponding
board/arch/board/board/src/etc directory, and added by Makefile for example:
boards/sim/sim/sim/src/etc.

But in kernel/protected mode, Nuttx kernel and apps are run in different privileged/
non-privileged mode or the isolated binarys, so as that nsh should use syscall to
access Nuttx kernel by exported API. In this scenario, nsh can not mount the etc image
content, because that is generated in board and as a part of Nuttx kernel.

changes:

- move etc romfs mount from nsh to Nuttx, but keep the script to parse and execute.
- move and rename the related CONFIG, move customized nsh_romfsimg.h to etc_romfs.c
  in boards, and no need declaration for romfs_img/romfs_img_len.

This commit changes and updates all configurations in Nuttx arch/board as much as possible,
but if any missing, please refer to the following simple guide:

- rename CONFIG_NSH_ROMFSETC to CONFIG_ETC_ROMFS, and delete CONFIG_NSH_ARCHROMFS in defconfig
- rename the etc romfs mount configs, for example CONFIG_NSH_FATDEVNO to CONFIG_ETC_FATDEVNO
- move customized nsh_romfsimg.h to etc_romfs.c in board/arch/board/board/src and no need
  declaration for romfs_img/romfs_img_len.
- delete default nsh_romfsimg.h, if ROMFSETC is enabled, should generate and compile etc_romfs.c
  in board/arch/board/board/src.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-01-09 21:29:46 -03:00
Philippe Leduc
e59c95bc9b Fix mx8mp ecspi interruption management. 2024-01-09 05:48:12 -08:00
Yanfeng Liu
dd1365ef85 risc-v/canmv230: add PROTECTED build support
Additions:

- In arch/risc-v/src/k230/
  - k230_userspace.c      add user space initialization
  - k230_userspace.h      headers for user space initialization
- In boards/risc-v/k230/canmv230/kernel/
  - k230_userspace.c      userspace_s const data definition
  - Makefile              pass1 Makefile
- In boards/risc-v/k230/canmv230/scripts/
  - ld-protected.script   linker script for protected build kernel
  - ld-userland.script    linker script for protected build userspace
- In boards/risc-v/k230/canmv230/configs
  - pnsh/defconfig        defconfig for protected build

Changes:

- In arch/risc-v/src/k230/
  - k230_start.c          add protected build handling logic
  - Make.defs             add protected build support
- In boards/risc-v/k230/canmv230/scripts/
  - Make.defs             add protected build support
- In Documentation/platforms/risc-v/k230/boards/canmv230/
  - index.rst             add protected build usage

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-08 19:46:42 -03:00
Rodrigo Sim
21b02f176f stm32f401rc-rs485: Add rs-485 support 2024-01-07 17:15:59 -08:00
David Sidrane
73bfeccc3f imxrt:ENET Use multi PHY
Allow a board to specify a list of PHYs.
  Then use this list, at run-time, to select and use the
  PHY populated on the board.
2024-01-06 04:26:12 -08:00
YAMAMOTO Takashi
d0335f089f cmake: fix CONFIG_HAVE_CXXINITIALIZE on macOS
Note: This implementation is a bit more relaxed than what we do for
non-cmake builds. Mainly because I'm not familiar enough with cmake
to mirror what the non-cmake version does.
2024-01-06 04:21:52 -08:00
YAMAMOTO Takashi
32ea2914c0 cmake: use -fvisibility=default for "arch"
so that macos build can find "_sim_netdriver_setmacaddr" etc.
2024-01-06 04:21:52 -08:00
Yanfeng Liu
af15cd40aa risc-v/litex: fix typo in litex/irq.h
Current LITEX_LAST_IRQ looks like a typo that blocks compilation of
`arty_a7/knsh` configuration.

This fixes the build  but I have no such device for test.
Found it was LITEX_IRQ_LAST before commit #ee84ea3 so likely typo was
introduced by then.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-06 04:15:52 -08:00
Ville Juven
14b6f31c8c mpfs_mpu: Add driver to set MPUCFG registers
MPUCFG registers are used to enforce memory protection for DMA master
devices.
2024-01-06 04:15:22 -08:00
Yanfeng Liu
207efa047b risc-v/rv-virt: revise mstatus operations
- drop set of SUM as it is done in  riscv_set_idleintctx()
- fix the CLEAR_CSR() before setting MPP field

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-06 04:04:33 -08:00
TimJTi
438439c1a6 SAMA5 - add LCD backlight PWM cLock source selection 2024-01-05 12:56:27 -03:00
Bowen Wang
df3f95ee1f armv7a/qemu: add QEMU_TRUSTZONE config and default n
Add ARCH_CHIP_QEMU_TRUSTZONE to enable/disable the TrustZone
support beacause qemu also support enable/disable Arm Security
Extensions: https://qemu-project.gitlab.io/qemu/system/arm/virt.html
when launch.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:29:06 -08:00
yinshengkai
9d436b624b tools: support sorting symbol tables by name
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-01-04 09:22:57 -08:00
Lee Lup Yuen
31ef9cd13c risc-v/bl808: Implement Timer with OpenSBI
The implementation of the RISC-V Timer for BL808 SoC is incomplete. This PR implements the BL808 RISC-V Timer by calling OpenSBI. The code is derived from NuttX for RISC-V QEMU.

The implementation of `up_timer_initialize` with OpenSBI is explained in this article: https://lupyuen.github.io/articles/nim#appendix-opensbi-timer-for-nuttx
2024-01-04 16:27:37 +01:00
YAMAMOTO Takashi
fc53497ea2 arch/arm/src/cmake/Toolchain.cmake: fix inverted conditions for C++ features
Fix inverted CONFIG_CXX_EXCEPTION/CONFIG_CXX_RTTI checks.
2024-01-04 07:20:04 -08:00
YAMAMOTO Takashi
05b8655bdd arch/sim/src/cmake/Toolchain.cmake: fix inverted conditions for C++ features
Fix inverted CONFIG_CXX_EXCEPTION/CONFIG_CXX_RTTI checks.
2024-01-04 07:20:04 -08:00
Peter van der Perk
40f4cde8f5 armv7-m: Expose section name to allow relocation 2024-01-04 15:07:18 +01:00
Yanfeng Liu
7cb8e590a1 risc-v/k230: kernel build for CanMV-K230 board
Changes:

- Documentation/platforms/risc-v/k230  revised for both modes
- arch/risc-v/include/k230/irq.h       add S-mode IRQs
- under arch/risc-v/src/k230 folder:
  - Make.defs                          drop use of k230_exception_m.S
  - hardware/k230_clint.h              add S-mode defs, revised freq
  - k230_head.S                        unified flat/kernel mode support
  - k230_irq.c                         add S-mode support with debug dump
  - k230_mm_init.c                     revised for K230 S-mode
  - k230_start.c                       revised for flat/s-mode,
- arch/risc-v/src/k230/k230_timerisr.c unified flat/s-mode support.
- under boards/risc-v/k230/canmv230 folder:
  - configs/nsh/defconfig              fix RAM size
  - include/board_memorymap.h          cleanup for S-mode
  - src/.gitignore                     ignore romfs_boot.c
  - src/Makefile                       add romfs support

Renames:

- under boards/risc-v/k230/canmv230/src/ folder:
  - canmv_init.c from k230_appinit.c   making room for more k230 devices

Dropped:

- under arch/risc-v/src/k230/
  - k230_exception_m.S                 as hybrid mode not ready yet.

New files in boards/riscv/k230/canmv230:

- configs/knsh/defconfig                S-mode config
- scripts/ld-kernel.script              S-mode linker script
- src/romfs.h                           User space ROMFS defs needed in S-mode
- src/romfs_stub.c                      Stub ROMFS image

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2023-12-31 07:26:45 -08:00
Yanfeng Liu
0ef16794eb arch/risc-v: fix a few typos in comments
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2023-12-31 07:25:51 -08:00
YAMAMOTO Takashi
c1c723b162 sim: add assertions on hostfs copy of structures
hostfs has its copies of some of nuttx definitions with different
names to avoid conflicting with the host OS definitions.
sometimes people only modifies one of them and forgets updating
another. eg. https://github.com/apache/nuttx/pull/11445
this commit introduces some assertions to detect that kind of
mistakes.
2023-12-30 19:02:03 -08:00
Yanfeng Liu
9b439a5c72 add missing dependency to MM_KMAP for ARCH_KMAP_VBASE
This is to align with ARCH_KMAP_VBASE by source codes.
It also fixes fake warnings from `tools/refresh.sh`.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2023-12-29 17:04:18 -03:00
YAMAMOTO Takashi
f7fb816235 sim: make the cmake version of hostfs build similar to the Makefile one 2023-12-29 08:23:03 +08:00
Xiang Xiao
087c519dd6 arch/armv7-a: Change space to tab in arm_smccc.S
follow the coding style from other assembler source files

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-28 11:09:09 +08:00
Xiang Xiao
770d579630 arch/arm: Move arm_vectoraddrexcptn into arm_vectors.S
and remove arm_vectoraddrexcptn.S like other exception handler

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-28 11:09:09 +08:00
YAMAMOTO Takashi
518f130ad3 arch/sim/src/sim/CMakeLists.txt: update a few file names 2023-12-27 10:10:52 -08:00
xuxin19
524425573e CMake:init arm64 CMake qemu-armv8a build
this patch contains arm64 Toolchain, arch common, qemu board and arm64 libc modifications.
support using CMake to compile the qemu executable file.

```
 cmake -B build -DBOARD_CONFIG=qemu-armv8a:nsh -GNinja
 cmake --build build -t menuconfig
 cmake --build build
 qemu-system-aarch64 -cpu cortex-a53 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
```
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-12-27 07:27:17 -08:00
yinshengkai
9852428953 fs: procfs add poll support
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-26 19:23:13 -08:00
yinshengkai
ca99e69c28 fs: update hostfs structure definition
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-26 17:41:12 -08:00
Tiago Medicci Serrano
b58cd6ad34 risc-v/espressif: Update HAL version
This update has no impact on devices. The update aims to update all
HAL-based devices to the same version.
2023-12-24 16:38:06 -08:00
Tiago Medicci Serrano
6234224325 esp32s2: Integrate Espressif HAL repository to ESP32-S2
By integrating the Espressif`s HAL repository into the current
ESP32-S2 implementation on NuttX, it is possible to call functions
that makes it easier to setup the registers of the ESP32-S2,
enabling the usage of common Espressif drivers.
2023-12-24 16:38:06 -08:00
Tiago Medicci Serrano
1ca460c89a esp32s3: Fully integrate Espressif HAL repository to ESP32-S3
By integrating the Espressif`s HAL repository into the current
ESP32-S3 implementation on NuttX, it is possible to call functions
that make it easier to set up the registers of the ESP32-S3 and
enables the usage of common Espressif drivers. Please note that
Espressif's HAL repository was already being used for the Wi-Fi
driver. Then, this commit includes other source files to be used
by other drivers other than Wi-Fi and reorganize the build process.
2023-12-24 16:38:06 -08:00
Tiago Medicci Serrano
cb80365daa xtensa/esp/ws2812: Add the lower-half WS2812 driver based on RMT
This lower-half WS2812 LED driver uses the RMT peripheral of the
Espressif's SoCs to drive the RGB addressable LEDs. Compared to
the SPI-based implementation, it is faster!
2023-12-24 16:38:06 -08:00
Tiago Medicci Serrano
69929d4084 xtensa/esp/rmt: Add the lower-half implementation of the RMT driver
The lower-half implementation of the RMT character driver based on
Espressif HAL enables using the RMT peripheral of ESP32, ESP32-S2
and ESP32-S3 as a common xtensa-based Espressif driver.

The RMT packages on Espressif SoCs are 4-byte long and are known as
"items". Please check the Techinal Reference Manual of the chip to
obtain more details.
2023-12-24 16:38:06 -08:00
yf13
dec6ec1138 Update mode.h to add CSR_TVEC 2023-12-23 20:43:47 -08:00
yf13
804f713c86 Update riscv_mmu.h to fix typo in comment
fix typo in comment of mmu_get_region_size function
2023-12-22 18:12:55 -03:00
Eren Terzioglu
c15392d9b7 xtensa/esp32s2: Add xtwdt and rwdt support 2023-12-22 03:59:18 -08:00
Tiago Medicci Serrano
daec4cf408 espressif/mcuboot: Fix dependency of the Espressif's port MCUboot.
If the MCUboot (from nuttx-apps) is selected, the Espressif's port
of the MCUboot is not used as the 2nd stage bootloader.
2023-12-22 17:27:58 +08:00
chenwen@espressif.com
2cb14c55f0 xtensa/esp32s3: Support reading encrypted partitions
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2023-12-22 17:27:32 +08:00
Peter van der Perk
0a41d040ac imxrt: flexio guard move lower to allow other drivers to it 2023-12-21 19:20:43 -03:00
Masayuki Ishikawa
40843b79eb arch: arm64: Fix GICv2 detection
Summary:
- I noticed that qemu-armv8a:netnsh_smp_hv does not detect
  GICv2 on Raspi4B (ubuntu 22.04 server + qemu-8.1.2)
- According to the GIC-400 TRM, it says that the architecture
  version can be obtained from GICC_IIDR (See Table 3-7)
- This commit fixes this issue.

Impact:
- Should be none

Testing:
- Tested with qemu-armv8a:netnsh_smp_hv on
  - Raspi3B+ (ubuntu 22.04 server + qemu-8.1.2)
  - Raspi4B (ubuntu 22.04 server + qemu-8.1.2)
  - M1/MacBook Pro 2021 (macOS 13.6 + qemu-8.1.2)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-12-21 01:21:20 -08:00
chenwen@espressif.com
0810fc45b7 xtensa/esp32s3: Fixed bbpll not calibrated from bootloader issue
1. Solve wifi may not work bug for bbpll not lock or not stable when enable RF.
  2. Improved timing tuning stability on ESP32-S3.
  The root cause of the issue:
	The application won't re-calibrate the BBPLL clock if it's already enabled.
	We add a force-recalib function in the app startup code to make sure even if
	the patch is applied by OTA, the clock is still re-calibrated.

Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2023-12-19 22:53:28 -08:00
Xiang Xiao
31a6ffa15c arm/sama5: Fix error: array subscript 0 is outside array bounds
chip/sam_emaca.c: In function 'sam_emac_interrupt':
Error: /github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:140:25: error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 'volatile long unsigned int[]'} [-Werror=array-bounds=]
  140 | #define getreg32(a)    (*(volatile uint32_t *)(a))
      |                        ~^~~~~~~~~~~~~~~~~~~~~~~~~~
chip/sam_emaca.c:364:37: note: in expansion of macro 'getreg32'
  364 | #  define sam_getreg(priv,addr)     getreg32(addr)
      |                                     ^~~~~~~~
chip/sam_emaca.c:1630:9: note: in expansion of macro 'sam_getreg'
 1630 |   tsr = sam_getreg(priv, SAM_EMAC_TSR_OFFSET);
      |         ^~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-19 08:36:49 +08:00
Xiang Xiao
d54c79126a am335x_lcdc: Fix error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]'
Error: /github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:51: error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 'volatile long unsigned int[]'} [-Werror=array-bounds=]
  141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
chip/am335x_lcdc.c:387:3: note: in expansion of macro 'putreg32'
  387 |   putreg32(AM335X_CM_WKUP_CLKMODE_DPLL_DISP, 0x4);
      |   ^~~~~~~~
In function 'am335x_lcd_initialize':
cc1: note: source object is likely at address zero
In function 'am335x_set_refclk',
    inlined from 'am335x_lcd_initialize' at chip/am335x_lcdc.c:607:9:
Error: /github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:51: error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 'volatile long unsigned int[]'} [-Werror=array-bounds=]
  141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
chip/am335x_lcdc.c:430:3: note: in expansion of macro 'putreg32'
  430 |   putreg32(AM335X_CM_WKUP_CLKMODE_DPLL_DISP, 0x7);
      |   ^~~~~~~~
In function 'am335x_lcd_initialize':
cc1: note: source object is likely at address zero
Error: /github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:25: error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 'volatile long unsigned int[]'} [-Werror=array-bounds=]
  141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
chip/am335x_lcdc.c:780:3: note: in expansion of macro 'putreg32'
  780 |   putreg32(AM335X_LCD_CLKC_ENABLE,
      |   ^~~~~~~~
cc1: note: source object is likely at address zero
Error: /github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:25: error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 'volatile long unsigned int[]'} [-Werror=array-bounds=]
  141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
chip/am335x_lcdc.c:784:3: note: in expansion of macro 'putreg32'
  784 |   putreg32(AM335X_LCD_CLKC_RESET, LCD_CLKC_RESET_MAIN);
      |   ^~~~~~~~
cc1: note: source object is likely at address zero
Error: /github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:25: error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 'volatile long unsigned int[]'} [-Werror=array-bounds=]
  141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
chip/am335x_lcdc.c:790:3: note: in expansion of macro 'putreg32'
  790 |   putreg32(AM335X_LCD_IRQ_EN_SET, regval);
      |   ^~~~~~~~
cc1: note: source object is likely at address zero
Error: /github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:25: error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 'volatile long unsigned int[]'} [-Werror=array-bounds=]
  141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
chip/am335x_lcdc.c:796:3: note: in expansion of macro 'putreg32'
  796 |   putreg32(AM335X_LCD_SYSC, LCD_SYSC_IDLE_SMART | LCD_SYSC_STANDBY_SMART);
      |   ^~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-19 08:36:49 +08:00
Xiang Xiao
e42780bb0f arch/arm: Disable -Warray-bound for rp2040, dm320 and lpc31xx
since gcc report the false alarm if the pointer offset from zero address:
    inlined from 'up_vectormapping' at chip/dm320_boot.c:162:7,
    inlined from 'arm_boot' at chip/dm320_boot.c:211:3:
Error: chip/dm320_boot.c:117:17: error: array subscript 0 is outside array bounds of 'uint32_t[0]' {aka 'long unsigned int[]'} [-Werror=array-bounds=]
  117 |   ctable[index] = (paddr | mmuflags);
      |   ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-19 08:36:49 +08:00
Xiang Xiao
1e696425fd lpc43xx/usb: Fix gcc13.2 compiler error
Error: arch/arm/src/common/arm_internal.h:140:25: error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 'volatile long unsigned int[]'} [-Werror=array-bounds=]
  140 | #define getreg32(a)    (*(volatile uint32_t *)(a))
      |                        ~^~~~~~~~~~~~~~~~~~~~~~~~~~
chip/lpc43_usb0dev.c:347:34: note: in expansion of macro 'getreg32'
  347 | #  define lpc43_getreg(addr)     getreg32(addr)
      |                                  ^~~~~~~~
chip/lpc43_usb0dev.c:2605:15: note: in expansion of macro 'lpc43_getreg'
 2605 |   return (int)lpc43_getreg(LPC43_USBDEV_FRINDEX_OFFSET);
      |               ^~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-19 08:36:49 +08:00
jianglianfang
f4c8a17837 sim_lcd: add open & close
The opening and closing of the window has been associated with the opening and closing of fb, but the LCD has not yet been optimized. The window will only open when sim_x11openwindow is called, and similarly, the window will only close when sim_x11closewindow is called.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-12-18 09:06:29 -08:00
anjiahao
6c4b30736e arm/debug:fix gdbstub clear fpb & dwt when already use jtag/swo bug
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-18 08:47:56 +01:00
Yanfeng Liu
75d0c2946d risc-v: Initial support for CanMV-k230 board and K230 chip
The code is mainly derived from the NuttX qemu-rv/rv-virt codebase.

Major changes:

- boards/Kconfig:       add new BOARD_K230_CANMV
- arch/risc-v/Kconfig:  add new CHIP_K230 chip and ARCH_RV_MMIO_BITS
- arch/risc-v/src/common/riscv_mtimer.c: use ARCH_RV_MMIO_BITS to
                        select MMIO access width

New additions:

- arch/risc-v/include/k230/: k230 SoC definitions
- arch/risc-v/src/k230/:     k230 SoC sources
- boards/risc-v/k230/canmv230/:  CanMV-K230 board sources and configs
- Documentation/platforms/risc-v/k230/: simple doc

Note that only FLAT build works for canmv230 now.

This PR has changes in RiscV common layer thus may affect other RiscV ports
It changes the mtime/mtimecmp access control from using config ARCH_RV64 to
newly intorduced config ARCH_RV_MMIO_BITS.

Original design uses ARCH_RV64 to select 64bit MMIO in riscv_mtimer.c, this
can't cope with the situation with K230 --- it has ARCH_RV64 but only can do
32bit MMIO. So a new ARCH_RV_MMIO_BITS config has been introduced. Its value
depicts the MMIO width in bits. The MMIO_BITS defaults to 32/64 for RV32/
RV64 respectively. This allows the macro to replace current use of ARCH_RV64
in riscv_mtimer.c.

The new MMIO_BITS config is a derived one, and for RiscV chips with
equal CPU and MMIO widths there is no need to explicitly set it as the
default rule will do that. Only chips with different CPU and MMIO widths
need set it in Kconfig.

So by design this change should be safe but RiscV ports should be checked.

"ostest" verification has been done for:

- canmv230/nsh
- rv-vivt/nsh
- rv-virt/nsh64

configuration generation and manual check of derived RV_MMIO_BITS has been
done for:

- star64/nsh
- arty_a7/nsh
- bl602evb/nsh

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2023-12-17 01:10:57 -08:00
Zhe Weng
5aeb15469a netdev/ipv6: Move xxx_ipv6multicast from arch to common code
The `xxx_ipv6multicast` function in each driver is not adapted to
multiple IPv6 addresses yet, and they're redundant, so try to take them
into common code.

Change:
1. Add MAC `g_ipv6_ethallnodes` and `g_ipv6_ethallrouters` in
   `icmpv6_devinit` and call them in `netdev_register`
2. Add multicast MAC for Neighbor Solicitation when adding any IPv6
   address, and remove them when IPv6 address is removed
3. Select `NET_MCASTGROUP` when `NET_ICMPv6` because now we need
   `d_addmac` when we have ICMPv6

Note:
We want modules outside net stack to call functions like
`netdev_ipv6_add` and never touch the related MAC address, so these MAC
functions are added as internal functions to `net/netdev/netdev.h`

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-12-16 05:26:16 -08:00
liqinhui
98e3615b60 net/netdev: Modify the logic for setting the IFF_RUNNING status of interfaces.
Refer to the logic of the `netif_carrier_on` on linux.
https://github.com/torvalds/linux/blob/master/net/sched/sch_generic.c#L575

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-12-15 18:24:23 -08:00
Ville Juven
986a79b231 mpfs_pmpcfg: Move PMPCFG registers to common location 2023-12-15 18:22:26 -08:00
Ville Juven
baea0012e7 mpfs_usb.c: Use kernel memory instead of user memory for DMA
DMA directly to user (virtual) memory won't work, as the DMA engine(s)
don't do address translations, i.e. they require a physical address.

Using kernel heap is fine as it is mapped vaddr=paddr. Also, the USB DMA
engine does not have any alignment requirements.
2023-12-15 18:21:03 -08:00
Ville Juven
fbd8a2127a mpfs_ethernet.c: Remove DMA_ENABLE hack
The hack just opens the entire SoC memory unconditionally, which is not
a good idea.

Test features can be used ad-hoc, they don't need to be supported by the
build.
2023-12-15 18:20:34 -08:00
simbit18
c494ce4a96 Update kconfig2html.c
Fix nuttx coding style
2023-12-14 20:02:52 -08:00
Ville Juven
e03599d9ae libs/log2ceil: Move implementation of log2ceil to a common place
Move log2ceil from riscv_pmp to libc. Also, implement log2floor for
completeness.

These are the run-time alternative to the compile-time macros.
2023-12-14 08:46:12 -08:00
Peter van der Perk
7730201689 imxrt: Extend FlexIO support to 117x 2023-12-14 03:59:36 -08:00
GD32-MCU
9a2569882e fix bug in gd32f4xx_serial.c, add romfsimg.h, gd32f4xx_reset and improve gd32f4xx_gpio.c for f470z board, add board decription for f470
add gd32f470 picture
2023-12-13 23:27:23 -08:00
simbit18
9d50d180b1 Fix nuttx coding style
Remove spaces
Remove extra */
2023-12-13 17:29:08 +01:00
chenwen@espressif.com
62a6a0ab4d xtensa/esp32s3: Tasks use SPIRAM as stack can do SPI flash read/write/erase/map/unmap
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2023-12-12 22:10:38 -08:00
Ville Juven
996625ec58 riscv/arch_elf.c: Handle PCREL_HI20/LO12_I/S relocations correctly
There is a problem with the current elf loader for risc-v: when a pair of
PCREL_HI20 / LO12 relocations are encountered, it is assumed that these
will follow each other immediately, as follows:

label:
	auipc      a0, %pcrel_hi(symbol)    // R_RISCV_PCREL_HI20
	load/store a0, %pcrel_lo(label)(a0) // R_RISCV_PCREL_LO12_I/S

With this assumption, the hi/lo relocations are both done when a hi20
relocation entry is encountered, first to the current instruction (addr)
and to the next instruction (addr + 4).

However, this assumption is wrong. There is nothing in the elf relocation
specification[1] that mandates this. Thus, the hi/lo relocation always
needs to first fixup the hi-part, and when the lo-part is encountered, it
needs to find the corresponding hi relocation entry, via the given "label".
This necessitates (re-)visiting the relocation entries for the current
section as well as looking for "label" in the symbol table.

The NuttX elf loader does not allow such operations to be done in the
machine specific part, so this patch fixes the relocation issue by
introducing an architecture specific cache for the hi20 relocation and
symbol table entries. When a lo12 relocation is encountered, the cache
can be consulted to find the hi20 part.

[1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc
2023-12-12 17:32:36 -08:00
Ville Juven
7bcbaa5dc7 riscv_pmp.c: Revert LOG2_CEIL back to run-time log2ceil function
The macro LOG2_CEIL is intended to be used in the pre-processor phase. If
used run-time it will generate a massive amount of extra code (~3.5K) which
is a problem, as the PMP configuration is quite often executed from a first
stage bootloader with a limited amount of code memory.

Code size differences pre- and post:

Memory region         Used Size  Region Size  %age Used
            envm:      112064 B     112384 B     99.72%

Memory region         Used Size  Region Size  %age Used
            envm:      108952 B     112384 B     96.95%
2023-12-12 08:51:14 -08:00
Lee Lup Yuen
614570cdcb arch/riscv: Add support for Bouffalo Lab BL808 SoC (T-Head C906)
This PR adds support for the Bouffalo Lab BL808 SoC, based on T-Head C906 64-bit RISC-V Core. This will be used by the upcoming port of NuttX for PINE64 Ox64 SBC.

Most of the code was derived from NuttX for Star64 JH7110. The UART Driver was derived from BL602 NuttX. The source files are explained in the articles here: https://github.com/lupyuen/nuttx-ox64

`Kconfig`: Added ARCH_CHIP_BL808 for BL808 SoC

`include/bl808/chip.h`: BL808 Definitions

`include/bl808/irq.h`: External Interrupts

`src/bl808/chip.h`: Interrupt Stack Macro

`src/bl808/bl808_allocateheap.c`: Kernel Heap

`src/bl808/bl808_head.S`: Linux Header and Boot Code

`src/bl808/bl808_irq.c`: Configure Interrupts

`src/bl808/bl808_irq_dispatch.c`: Dispatch Interrupts

`src/bl808/bl808_memorymap.h`: Memory Map

`src/bl808/bl808_mm_init.c`, `bl808_mm_init.h`: Memory Mgmt

`src/bl808/bl808_pgalloc.c`: Page Allocator

`src/bl808/bl808_serial.c`, `bl808_serial.h`: UART Driver

`src/bl808/bl808_start.c`: Startup Code

`src/bl808/bl808_timerisr.c`: Timer Interrupt

`src/bl808/hardware/bl808_memorymap.h`: PLIC and UART Base Address

`src/bl808/hardware/bl808_plic.h`: PLIC Register Addresses

`src/bl808/hardware/bl808_uart.h`: UART Register Addresses

`src/bl808/Kconfig`: BL808 Config

`src/bl808/Make.defs`: Makefile
2023-12-12 08:50:03 -08:00
Xiang Xiao
ca5a9c711a Remove @ and % tag from all comments
and format the multiple line comments

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-11 17:00:10 -03:00
anjiahao
bb0a706bdc arch/arm:add up_debugpoint api
on armv8-m/armv7-m,implement breakpoint & watchpoint using FBP & DWT

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-11 08:43:26 -08:00
Lee Lup Yuen
0bac2efd0e Extend MMU Flags to 64-bit for T-Head C906 and Svpbmt
Currently RISC-V NuttX supports 32-bit MMU Flags inside a Page Table Entry. This PR extends the MMU Flags to 64-bit, to support T-Head C906 Core and the new RISC-V Svpbmt Extension.

T-Head C906 uses Bits 59 to 63 in a Leaf Page Table Entry to configure the Memory Type: Cacheable / Bufferable / Strongly-Ordered. For the upcoming port of NuttX to PINE64 Ox64 BL808 SBC, we need to set the Memory Type to Strongly-Ordered for I/O Memory, which requires 64-bit MMU Flags.

Details of C906 MMU: https://lupyuen.github.io/articles/plic3#t-head-errata

Newer RISC-V Cores will use the Svpbmt Extension to configure the Memory Type (Cacheable / Strongly-Ordered). Svpbmt uses Bits 61 to 62 in a Leaf Page Table Entry to define the Memory Type. This also requires 64-bit MMU Flags.

Details of Svpbmt: https://github.com/riscv/riscv-isa-manual/blob/main/src/supervisor.adoc#svpbmt
2023-12-11 02:10:14 -08:00
anjiahao
94d449e722 arch:Mark key functions to prohibit instrumentation to prevent recursive calls
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-11 02:06:51 -08:00
anjiahao
d932e0af2a sched/procfs:use instrument to statistics run time max stack
Usage:
1. CONFIG_FS_PROCFS_MAX_STACK_RECORD > 0, such as 32,
2. add '-finstrument-functions' to CFLAGS for What you want to check
   stack.
3. mount porcfs
4. cat /proc/<pid>/stack will print backtace & size

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-11 02:06:51 -08:00
anjiahao
7dfbd14eba libc: add instrument api support
Add registration function instrumentation API,
which can achieve instrumentation of entering and
exiting functions through the compiler's functionality.

We can use CONFIG_ARCH_INSTRUMENT_ALL to add instrumentation for all
source, or add '-finstrument-functions' to CFLAGS for Part of the
source.

Notice:
1. use CONFIG_ARCH_INSTRUMENT_ALL must mark _start or entry noinstrument_function,
   becuase bss not set.
2. Make sure your callbacks are not instrumented recursively.

use instrument_register to register entry function and exit function.
They will be called by the instrumented function

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-11 02:06:51 -08:00
Mete Balci
2215278a53 stm32u5: fix EXTICR2,3,4 register offsets 2023-12-11 10:42:09 +01:00
simbit18
3442af4a19 Fix Kconfig style
Remove extra TABs
Add comments
2023-12-09 13:44:46 -08:00
bertrand
0ca8ae81d0 invert tx and rx in spi_dma_setup
remove indent sam_spi.c

removed indent
2023-12-08 19:50:49 -08:00
anjiahao
90517b9f11 coredump:support arm64 coredump
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-08 21:33:03 -03:00
Petteri Aimonen
dedb563322 usbdev: Add architecture calls to usbdev_sof_irq() 2023-12-08 21:27:36 -03:00
Ville Juven
f404cb60b8 mpfs_head.S: Change j/jal to tail call
In order to avoid linker truncation error (address unreachable), making
it a tail call ensures this does not happen.
2023-12-08 14:30:21 +01:00
Anthony Merlino
962ac35170 stm32h7_adc: Dynamically set clock prescaler and BOOST setting.
The ADC peripheral can only support up to
    50MHz on rev V silicon and 36MHz on Y silicon.
    The existing driver always used no prescaler
    and kept boost setting at 0.
2023-12-07 03:50:40 -08:00
David Sidrane
d31214aa25 stm32h7:ADC STM32_RCC_D3CCIPR_ADCSEL->STM32_RCC_D3CCIPR_ADCSRC 2023-12-07 03:50:40 -08:00