Commit graph

23743 commits

Author SHA1 Message Date
wangmingrong1
3c2b203286 arm64->fetal: Support return to thread site
The breakpoint of arm64 is fetal_handler, which needs to return to the scene

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-07-03 00:20:54 +08:00
Jukka Laitinen
5594c2e887 imx9/lpuart: Fix race condition / regression in imx9_txint
Commit 83a119160 fixed SMP by removing call to uart_xmitchars from inside spinlock.

This only works for SMP, since uart_xmitchars has a lock only in SMP. In a single
core configuration the function can be called in parallel from the interrupt
handler and from the imx9_txint.

Fix this by filling the uart buffers already before enabling the
interrupt, this way it is not possible to get the function called in parallel
for the same device.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-07-01 15:02:54 -03:00
Pressl, Stepan
55bef681e1 arch/arm/src/stm32/stm32_i2cslave_v2.c: add STM32 I2C Slave support for the v2 ip core
This commit adds the lowerhalf driver support for the I2C Slave.
While not currently ideal, it is compatible with the upperhalf i2c slave driver.
A workqueue can be used to delegate the isr work to the upperhalf driver.
But keep in mind wq introduces a lot of delay and in certain scenarios,
it is better to write your own better upperhalf driver.

Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
2025-07-02 01:59:46 +08:00
Filipe Cavalcanti
e57d2a5247 arch/risc-v: update lower-half drivers for ESP32-C3|C6|H2 2025-06-30 22:40:26 +08:00
Filipe Cavalcanti
187a386cc7 arch/xtensa: update lower-half drivers for ESP32|S2|S3 2025-06-30 22:40:26 +08:00
wangmingrong1
3fdfc702f3 a527: Remove MTE enablement
This product does not have MTE. MTE is only available for Arch or higher extensions of armv8-5+memory tags

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-30 18:19:38 +08:00
wangmingrong1
8f541d2ef2 mte/kasan: Implementing KASAN memory protection for ARM64 hardware MTE
1. Add hw_tags.c, which will call arm64_mte to implement tagging of memory blocks by operating registers
2. It has been able to run normally on the default NX memory allocator, excluding mempool and tlsf
3. On more complex configurations, memory tests such as memstress can run normally without system crashes

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-30 18:19:38 +08:00
wangmingrong1
8f6be9a9b5 arm: Enhance armv7a's dataaboart to adapt to debug mode
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-30 17:18:57 +08:00
wangmingrong1
6cc9849561 arm: Enhance armv7a's prefetchaboart to adapt to debug mode
ifar is 0 on qemu platform, the reason is unknown, so here use regs[REG_PC]

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-30 17:18:57 +08:00
wangmingrong1
3149fd453c arm: Support hardware debug
Support hardware debugging of ARM architecture, and support smp mode.We can use "up_debugpoint_add" or "up_debugpoint_remove" to add breakpoints, and the hardware will jump into the interrupt after detecting it.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-30 17:18:57 +08:00
wangmingrong1
35071467bb arm: Add support for CP14
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-30 17:18:57 +08:00
wangmingrong1
2d7e4f7e52 arch/arm64/fvp-v8r: enable Cmake
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-30 17:12:38 +08:00
Xiang Xiao
2b360c826c arch/arm: Move lib_dummy.c from arch/arm/src/common/ghs to libs/libc/machine/arm
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-06-30 09:56:27 +08:00
wangmingrong1
6b8bcd673b arm64/toolchain.defs: clang should specify target
If not specified, the corresponding libgcc. a cannot be found

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-27 20:44:41 +08:00
wangmingrong1
3314201f64 arm64/cmake: support clang compile
enable CONFIG_ARM64_TOOLCHAIN_CLANG can use clang compiler

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-27 20:44:41 +08:00
wangmingrong1
86762145de Delete unused function
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-27 20:44:41 +08:00
wangmingrong1
3ca0d1e478 fix compile error
Because the location of the macro is moved, other archs cannot find the corresponding macro

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
wangmingrong1
e97e33eadc toolchain: Support KASAN compilation above Clang18
1. When the Clang compiler turns on "-fsanitize=kernel-address", inlining, global variables, and stack detection are enabled by default and must be turned off manually.
2. -mllvm is the parameter passing method of Clang, and --param is the parameter passing method of GCC
After the modification, KASan compilation and operation will be supported for Clang 18 and above

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
wangmingrong1
7b902caf94 arm: Move some cp15 macros to cp15 header files
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
wangmingrong1
c6a528ef11 spinlock: fix stxr instruction status register requirement
error: unpredictable STXR instruction, status is also a source
   99 |     "stxr     %w0, %1, [%2] \n"
      |      ^
<inline asm>:5:10: note: instantiated into assembly here
    5 | stxr     w10, x10, [x9]
Using w0 to pass the result can cause the "status register is also a source" problem, resulting in unpredictable behavior.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
wangmingrong1
68a1774eae arm64/smc: Support limited compilation
Only el3 arch may need to use it, let's limit it to

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
wangmingrong1
5206cc84d8 arm64/armv8r: Support CPUs without hardware floating point
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
wangmingrong1
acf0256164 arm64: Support change toolchain to clang
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
wangmingrong1
e219066397 arm64: Used by irrelevant macro switch position
Add unused_code to avoid compilation errors

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
wangmingrong1
df3d84b514 arm64: fix compile error
when CONFIG_SMP is disabled, If the cpu parameter is not used, an error will be reported

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
wangmingrong1
f445652a35 Delete unused functions
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
wangmingrong1
4c755c7401 arm64: Fix add immediate value irregular behavior
The ARM64 instruction ADD has a 12-bit limit (0 - 4095) for immediate values, but here we try to use a symbolic address (.Linitparms) as an immediate value, which does not comply with the ARM64 instruction set rules.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
wangmingrong1
dd8819e517 arm64: Explicitly specify register type as x in assembly (arm64)
common/arm64_cache.c:305:38: error: value size does not match register size specified by the constraint and modifier [-Werror,-Wasm-operand-widths]

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
simbit18
4270235bfa arch: Fix Kconfig style
Remove spaces from Kconfig
Add TABs
Add comments
2025-06-26 02:30:46 +08:00
halyssonJr
ba38432a0e Modify type to avoid compilation warning. 2025-06-24 07:49:36 +08:00
kywwilson11
04c4f5d229 Initial commit for STM32G0 dma support. Added DMA mux mappings. Added Kconfig for enabling DMA2. Added basic defines for number of channels and mux channels in dma_v1mux.
Added subclasses of STM32G0 (such as STM32G07X) to Kconfig for use in dmamux driver. Added definitions to stm32g0_dmamux.h. Added configuration of number of dma and dmamux channels.

Added missing dma mappings for stm32g0.

Remove reserved defines.

Formatting fixes.

Added DMA2 IRQ mappings for STM32G0B and STM32G0C. Changed STM32_DMAMUX_BASE to STM32_DMAMUX1_BASE to align with stm32_dma_v1mux.c and C0 defines.

Provide correct mapping for ADC1_DMA_CHAN. Add STM32F0L0G0_HAVE_ADC1_DMA to STM32G0.

Add support for continuous mode to the ADC. Also added support to set smp1 and smp2 in board.h, as well as smpsel.

Removed unnecessary selects of STM32F0L0G0_STM32G0. Changed board level files to properly define A0-A3 on nucleo-g0b1re.

Add new Kconfig changes.

Made combined configs for STM32G0. Ex. STM32G0BX for STM32G0B0 and STM32G0B1.

Fixed defines and references in Kconfig and stm32_dma_v1mux.c

Defined adc_sampletime_write and adc_sampletime_set. Changed adc_sample_time_s structure to be much simpler. Old way made no sense. You can only have 2 sample times, so defining one for each channel makes no sense. The new adc_sample_time_s contains smp1, smp2, and smpsel. Also define ADC_HAVE_SMPR_SMP2 for STM32C0.

Added adc_sampletime_write and adc_sampletime_set. Altered adc_sample_time_s structure to be more appropriate for g0 and c0. Only two sample times can be defined. Added rcc support for DMA2.

Added defconfig for nucleo-g0b1re:adc_dma config.

Restore correct Kconfig from my original branch

Removed redundant ifdefs. If we select for G0 and C0, we know they have SMP2. Fixed formatting.

Formatting feedback. Aligned columns in irq and dma headers.
2025-06-23 15:46:28 +08:00
wushenhui
6a9a835d6f risc-v/mmu: Fix map_region() for incorrect page table setup when vaddr is unaligned
When the vaddr parameter passed to map_region() is not aligned to the page directory,
it causes incorrect address mapping for later regions.

For example, in the sv32 case, `PGPOOL` started at `0x80a00000` with a size of `1024*4096B`,
leading to page table errors for the range `0x80c00000~0x80e00000`.

This patch fixes the issue by ensuring map_region() correctly handles unaligned vaddr cases.

Signed-off-by: wushenhui <wushenhui@xiaomi.com>
2025-06-23 15:44:39 +08:00
halyssonJr
74ce16da5c fix framebuffer config resolution. 2025-06-23 09:49:31 +08:00
Tiago Medicci Serrano
a98f7a1045 arch/risc-v: Fix debugging syscall info
This commit fixes an issue when `CONFIG_DEBUG_SYSCALL_INFO=y`: the
`cmd` variable doesn't exist (instead, `regs[REG_A0]` represents
the syscall command directly. Also, it fixes the parameter for
`up_dump_register`, as `tcb` is a pointer here. By applying these
fixes, debugging syscall info is now possible again.
2025-06-22 14:57:11 +08:00
Martin Vajnar
0c9931cc99 espressif[risc-v|xtensa]: Check events when reading PCNT counter value
Previously, if an event was generated in hardware after taking spin
lock it was not correctly accounted for in current reading cycle.

Now, we check for events and compensate count accordingly.

Signed-off-by: Martin Vajnar <martin.vajnar@gmail.com>
2025-06-20 20:51:49 +08:00
Martin Vajnar
907b487eb7 arch/xtensa/src/common/espressif/esp_pcnt.c: counter accumulation fix
Port fix from risc-v code. Providing original description:

Even when enabled, the PCNT counter doesn't accumulate into the 32-bit value.
Instead, a value in range [PCNT_LOW_LIMIT, PCNT_HIGH_LIMIT] is always returned.
This is due to interrupt events associated with limit overflows are disabled on the periphery,
therefore the ISR responsible for the accumulation never gets called.

Fixed by enabling the associated interrupt events.

Signed-off-by: Martin Vajnar <martin.vajnar@gmail.com>
Original-fix-by: michal matias <mich4l.matias@gmail.com>
2025-06-20 20:51:49 +08:00
Kerogit
a3f8b55143 drivers/serial/serial: prevent race conditions on 8-bit architectures
Some code paths in drivers/serial/serial.c load head and tail values
of receive and transmit circular buffers with interrupts enabled,
making it possible that the interrupt handler changes the value.
As noted in the code, this is safe as long as the load itself is atomic.

That is not true for 8bit architectures which fetch the 16-bit values
using two load instructions. If interrupt handler runs between those
two instructions and changes the value, the read returns corrupted data.

This patch introduces CONFIG_ARCH_LDST_16BIT_NOT_ATOMIC configuration
option which is automatically selected for AVR architecture. Based
on this option, head and tail values are reduced to 8-bit length
so the read remains atomic.

Patch was tested by building on rv-virt:nsh - disassembly of functions
from serial.c showed no difference which is correct as Risc-V does
not need to protect reads of these values. There should be no impact
for architectures that do not set the new configuration option.

It was also tested by by custom echo application running on AVR128DA28.

Signed-off-by: Kerogit <kr.git@kerogit.eu>
2025-06-19 10:01:24 -03:00
simbit18
2e5160ed0d [Kconfig] Fix Kconfig style
Remove spaces from Kconfig
Add TABs
Add comments
2025-06-18 18:56:39 +02:00
kywwilson11
6c1781d523 Added more granular Kconfig options for STM32G0 line. Added CRS and HSI48 defines to get Nuttx to compile.
Minor formatting change

Change G0CX to G0C1 in Kconfig

Change HAVE_DAC to HAVE_DAC1
2025-06-18 10:31:08 -03:00
Tyler Bennett
54b7bf6e36 ADC Hardware register file updated for G0
First commit of ADC for G0. Have it working basically. Need to make changes regarding adccmn stuff.

Added changes to make stm32_adc.c compatible with both G0 and other families.

Add oversampling support. This is for G0 and L0. Add ADC oversampling to Kconfig. Use adccmn_modifyreg for all, updated hw file to accomodate G0.

Style fixes. Move init of oversampling to a function, and call it if OVERSAMPLE is configured.

Limited changes to stm32_bringup.c

Style fixes to hardware/stm32_adc.h

Changed nucleo-g0b1re to run at 64 MHz. Fixed errors in clock setup. Added defines for setting up ADC clock.

Added code for STM32G0 ADC clock configuration.

Added adc_ckmode_cfg function. ckmode bits were previously neglected, assuming async clock to ADC was used. Added other feedback from pull request #16500.

Added feedback from pull request #16500.

Changed format of STM32F0L0G0_HAVE_ADC_OVERSAMPLE config.

Removed FARs from ioc_set_oversample.

Fixed formatting of helps in Kconfig. Adjusted spacing on help content.

Simplified adc_common_cfg. CCR_PRESC relies on board.h

Fixed formatting

Add ADC pinmaps for stm32g0
2025-06-17 21:25:39 +08:00
raiden00pl
0a23b0c14e arch/stm32{f0l0g0|f7|h5|h7|l4}/stm32_adc.c: add support for batch DMA transfer
Add an option that configure the number of regular group conversions
that will trigger a DMA callback transfering data to the upper-half driver.

By default this value is 1 and the driver behaves the same as before
the change. Increasing this value allows to reduce the number of
DMA interrupts and achieve higher sampling rates.

DMA support for H5 and H7 is not complete so this change has no effect,
but for consistency they have also been modified.

The naming between ports has also been unified:

- dmabuffer -> r_dmabuffer
- nchannels -> rnchannels
- chanlist -> r_chanlist
- jchanlist -> j_chanlist

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-16 21:58:47 +08:00
raiden00pl
2f625acbe1 arch/stm32{f0l0g0|f7|h5|h7}: add support for ADC trigger from TIMER TRGO
Add support for ADC trigger from TIMER TRGO event

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-14 10:46:24 -03:00
Filipe Cavalcanti
2912b3347c arch/risc-v: decouple common source for Espressif's MCUBoot port
Decouples the NuttX build from the MCUBoot common source on RISC-V Espressif
devices. Allows using different branches for each.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-06-14 17:11:58 +08:00
Filipe Cavalcanti
294848e623 arch/xtensa: decouple common source for Espressif's MCUBoot port
Decouples the NuttX build from the MCUBoot common source on Xtensa
devices. Allows using different branches for each.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-06-14 17:11:58 +08:00
raiden00pl
89e8c0c425 arch/stm32f0l0g0/adc: add timer trigger support
add ADC external trigger from TIMER for stm32-m0 chips

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-13 12:10:13 -03:00
Jukka Laitinen
5aa45e328e arch/riscv/ricv_exception.c: Dump the process name at exception in user space
This helps in debugging loaded elf files in CONFIG_BUILD_KERNEL. If a user space exception occurs,
one would beed the process name in order to debug the correct process/elf file.

Only dumping the pid and name of the crashed task/thread doesn't help, since different processes
may have helper threads with the same name.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-06-13 20:36:30 +08:00
Michal Lenc
1cbebc0302 arch/arm/src/samv7/sam_start.c: init perf events if enabled
__start should call up_perf_init, initialization of hardware performance
counter, if CONFIG_ARCH_PERF_EVENTS option is set. This allows the
usage of ARM cycle count register DWT_CYCCNT in benchmark
measurements instead of software clock.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-06-12 16:57:21 -03:00
Ville Juven
d8c907dfc7 imx9/lpuart: Fix SMP deadlock with imx9_txint
A deadlock occurs for priv->lock when uart_xmitchars is called from
within imx9_txint. This is because uart_xmitchars does a callback to
imx9_txint and tries to acquire the lock again.

However, there is no reason to hold the lock over uart_xmitchars, as it
has its own lock for mutual exclusion. Only the UART device needs to
be protected, and priv->lock does that.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
2025-06-12 15:28:18 -03:00
Ville Juven
c17f99438e imx9/smp: Add boiler plate code to enable SMP with iMX9.X
This adds SMP support for iMX9.X CPUs

Signed-off-by: Ville Juven <ville.juven@unikie.com>
2025-06-12 15:28:18 -03:00
Alessio Tudisco
78dffd72f8 arch/arm/stm32f7: Add missing RCC include
Adds "stm32_rcc.h" include into "stm32_capture.c" to fix the compile error related to undeclared RCC stuff.
2025-06-12 19:09:34 +08:00