Commit graph

23259 commits

Author SHA1 Message Date
wangmingrong1
2149d89336 macro/align: Use ALIGN_UP and ALIGN_DOWN uniformly
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-12 16:48:35 +08:00
Yanfeng Liu
71a4e86718 risc-v/Toolchain.defs: guard -r in LDELFFLAGS
This guards use of `-r` in LDELFFLAGS in risc-v common/Toolchain.defs so
that it is only used when BINFMT_ELF_RELOCATABLE is selected.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2025-01-12 16:47:54 +08:00
Leo Chung
63c8de5f03 sim: Fixes the linker 'noexecstack' warning
Signed-off-by: Leo Chung <gewalalb@gmail.com>
2025-01-12 16:17:52 +08:00
Yanfeng Liu
ff488133c9 qemu-armv7a: allows ELF_EXECUTABLE
This allows using BINFMT_ELF_EXECUTABLE for qemu-armv7a target.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-11 18:54:36 +08:00
Yanfeng Liu
48846954d8 arm/Toolchain.defs: skip -r for ELF_EXECUTABLE
This avoids using `-r` option when linking executable programs.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-11 18:54:36 +08:00
Kyle Wilson
558fe83f6d Add Timer Support to STM32H5 ADC Driver
Added support for using timers with ADCs. Updated Kconfig to support TRGO2, although driver support for TRGO and TRGO2 not developed yet. Updated hardware/stm32_tim.h with missing CCER bits needed for compilation.
2025-01-11 12:04:48 +08:00
hujun5
69ee240b45 rp2040_pio: remove spin_lock_irqsave(NULL) in arch/arm/src/rp2040/rp2040_pio.c
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-10 22:35:14 +08:00
wangzhi16
b9837bed08 use small lock to protect g_ram_vectors, involving armv6-m, armv7-m, armv8-m.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-10 21:33:23 +08:00
wangzhi16
d84ba608a1 use small lock in following files:
arch/arm/src/am335x/am335x_can.c
    arch/arm/src/am335x/am335x_gpio.c
    arch/arm/src/am335x/am335x_i2c.c
    arch/arm/src/am335x/am335x_irq.c
    arch/arm/src/am335x/am335x_serial.c
    arch/arm64/src/imx9/imx9_gpio.c
    arch/arm64/src/imx9/imx9_lpi2c.c
    arch/arm64/src/imx9/imx9_lpspi.c
    arch/arm64/src/imx9/imx9_usbdev.c
    arch/x86_64/src/intel64/intel64_tsc_tickless.c

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-10 21:32:23 +08:00
Huang Qi
58c95f5d85 armv7-a/Toolchain.defs: Update LLVM arch type to thumbv7a
Changed the LLVM architecture type from thumbv7 to thumbv7a in
Toolchain.defs to better match the ARMv7-A architecture specification.

This change ensures proper code generation and optimization for
Cortex-A series processors when using the Thumb instruction set.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-10 21:21:26 +08:00
wangzhi16
f179cb81b5 use small lock to protect register about l2cc, involving the following files:
arch/arm/src/armv7-a/arm_l2cc_pl310.c
arch/arm/src/armv7-r/arm_l2cc_pl310.c
arch/arm/src/armv8-r/arm_l2cc_pl310.c

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-10 21:20:52 +08:00
Huang Qi
6dbdfb3cd5 arch/arm: Add LLVM configuration to CMake
Added LLVM-specific configuration variables to ARM architecture CMake files:
- LLVM_ARCHTYPE for architecture variant (thumbv6m, thumbv7a, etc)
- LLVM_CPUTYPE for CPU target (cortex-m0, cortex-a5, etc)
- LLVM_ABITYPE for ABI (eabi/eabihf)

These changes enable LLVM/Clang toolchain support while maintaining
compatibility with existing GCC configurations. The LLVM variables
are set based on the same architecture/CPU/FPU configurations used
for GCC flags.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-10 16:58:01 +08:00
Huang Qi
f2934935d0 armv7-a.cmake: Improve FPU options table formatting and readability
Reformatted the FPU options table to use a clearer markdown-style table format
with proper alignment and column headers. Added visual separators (~~~) to make
the table stand out from surrounding code. Improved consistency in column widths
and fixed line wrapping for better readability.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-10 16:58:01 +08:00
Kyle Wilson
9783c88425 Initial STM32H5 Timers Commit
Used the STM32H7 as a reference.

Removed APB enabling from stm32h5xx_rcc.c. This is done in timer initialization, like STM32H7.

Also removed LPTIM. Will add later.

tim_lowerhalf: Timers 9, 10, and 11 removed. Timers 15,16, and 17 added.

Removed low-power timers from Kconfig. Not implemented yet.

Style Updates

Added stm32_tim_enable and stm32_tim_disable to Timer operations.
2025-01-10 09:40:10 +01:00
wangmingrong1
e5e9032ea0 arm64/vector: Reduce two useless instructions
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-10 14:59:20 +08:00
wangmingrong1
d22e6d7489 arm64/sctlr: Allows thread to independent control the switch of sctlr
The method is the same as the method of saving the current DAIF state of the thread
It will pave the way for the future implementation of hwasan's memory management
Allows each thread to independently control the mte switch function

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-10 14:59:20 +08:00
Huang Qi
1b8d5a4367 arch/risc-v: Refactor LLVM CPU type handling in Toolchain.cmake
- Replace direct string comparisons with regex pattern matching for ARCHCPUEXTFLAGS
- Change from using LLVM_CPUFLAGS list to setting LLVM_CPUTYPE directly
- Simplify CPU type detection logic while maintaining same functionality
- Use more consistent string variable naming convention

This change makes the CPU type detection more flexible and maintainable
while keeping the same behavior for supported RISC-V configurations.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-10 02:06:19 +08:00
Huang Qi
cfd0cc0d1a Remove duplicate includes across multiple files
This commit cleans up redundant header file includes throughout the codebase.
 The changes include:

 - Removing duplicate #include directives that were present in the same file
 - Consolidating includes that were split across multiple lines unnecessarily
 - Removing unused includes that were no longer needed
 - Fixing some formatting issues with includes

 The changes improve code organization and maintainability by:
 - Reducing unnecessary dependencies
 - Making include dependencies more explicit
 - Following consistent include patterns
 - Removing dead code

 No functional changes are made - this is purely a code cleanup commit.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-09 23:30:23 +08:00
jerryslhao
bb4eb12fa3 arch/arm/stm32:add stm32g4 spi driver.
Signed-off-by: jerryslhao <jerryslhao@gmail.com>
2025-01-09 09:25:10 +01:00
nuttxs
cb980cc977 arch/esp32s3_partition: Read data from SPI Flash
at designated address (with decryption)
2025-01-09 07:52:40 +08:00
raiden00pl
b3120e535b arch/arm/stm32{|f0l0g0|f7|h5|h7}/i2c: raise compilation error when configuration is invalid
Raise compilation error when I2C configuration is invalid.
It's better to catch invalid clock configuration during compilation instead of
producing binary that doesn't work as expected anyway.

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-01-09 07:49:39 +08:00
Huang Qi
00794b92c4 arch/risc-v: Improve LLVM CPU type detection with findstring
Use findstring instead of direct equality checks for LLVM_CPUTYPE
conditions to better handle ARCHCPUEXTFLAGS that may contain additional
ISA extensions. This makes the CPU type detection more robust when
dealing with extended instruction sets while still ensuring the required
base ISA extensions are present.

For example, ARCHCPUEXTFLAGS="imc_zicsr_zifencei" will now correctly
match as sifive-e20 rather than failing the exact match check.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-08 23:58:19 +08:00
Ville Juven
ae9815a888 riscv_cpustart.c: Change CPU start related traces to sinfo
Like all other platforms do.
2025-01-08 23:57:34 +08:00
YAMAMOTO Takashi
c0eaf12661 esp32s3_wifi_adapter.c: Fix a deadlock
Fixes: https://github.com/apache/nuttx/issues/15314
2025-01-08 23:56:43 +08:00
Huang Qi
40bd8f9ad4 arch/risc-v: Make CPU index handling based on ARCH_RV_CPUID_MAP
This patch refactors the CPU index handling in the RISC-V architecture to be based on the ARCH_RV_CPUID_MAP configuration.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-08 13:48:00 +02:00
jerryslhao
1bcaacd5cc arch/arm/stm32: fix stm32g4 enable pll code.
In the file stm32g474xxxx_rcc.c, the enable PLL
code, according to the intent of the comment,
wants to keep the reserved bit, but the code
clears the reserved bit.

Signed-off-by: jerryslhao <jerryslhao@gmail.com>
2025-01-08 10:41:22 +08:00
Daniel P. Carvalho
ba32b61d2e arch/arm/stm32/: Fix I2C driver for STM32G4 devices. 2025-01-07 23:45:59 +08:00
Daniel P. Carvalho
3f3e6dd9b8 arch/arm/stm32/: Added enable/disable to timer low level ops. 2025-01-07 23:32:06 +08:00
YAMAMOTO Takashi
e5ac1c620e sim: Disable chained fixups for sim_macho_init.c
This is a workaround for https://github.com/apache/nuttx/issues/15208

Tested with:
    macOS 15.2
    x86-64
    Xcode 16.2
2025-01-07 23:28:30 +08:00
wangmingrong1
c5655d5a11 arm64/tbi: Unified TBI flags for MTE and software kasan
The TCMA flag is not critical, it will be set separately in "arm64_mte.c"

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-07 21:44:18 +08:00
Jani Paalijarvi
dd4ee256c3 arch/risc-v/src/mpfs/mpfs_ethernet.c: Set correct return value
Return error in case of mpfs_i2cbus_initialize() failure.

Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
2025-01-07 21:42:00 +08:00
simbit18
aaef87e5b6 Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
2025-01-07 21:39:50 +08:00
buxiasen
7e0e4dea75 arm/irq.h: fix ARCH_ARM7TDMI missing up_getusrsp after move to irq.h
Causing c5471evm/httpd ci break.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-07 14:29:32 +08:00
Gao Feng
55da7d89b5 xtensa/esp32s3: porting of spi_flash_chip_generic_write_encrypted from ESP-IDF 2025-01-07 12:18:43 +08:00
Kyle Wilson
4bd2c0443b Preliminary add of fdcan source files.
Some checks are pending
Build Documentation / build-html (push) Waiting to run
Adding source files to the fdcan branch based on identical register set. These files should mostly just work.

Removed references to FDCAN3. H5 only has 2 FDCAN interfaces.

Add basic FDCAN Kconfig

FDCAN Kconfig options

Added various options for FDCAN mode, FDCAN bitrate, clock selection and division, and timing.

Added bit timing config options (nominal and data). Added stm32h56xxx pin mappings.

Fixed Data Bit Timing. Pulled in STM32H5_FDCAN_PDIV_VALUE. Added stm32_fdcan.c to Make.defs. Added DBITRATE to Kconfig

Clock source changes to FDCAN

Moved the setting of the clock source to the stm32h5xx_rcc.c file. Added notes to stm32_fdcan.c that STM32_FDCAN_FREQUENCY and STM32_FDCAN_PDIV should be set in board.h

Change STM32H5_FDCAN_PDIV to STM32_FDCAN_PDIV

Updated Kconfig to match G4 implementation. Removed stm32_fdcan_sock for now.

Removed FDCAN3 from stm32_fdcan.h

incomplete changes for bit timning

Set NBRP and DBRP registers based on STM32H7 FDCAN socket algorithm.

Added board file for initializing 1 can device. Will update later to initialize second device.

Fixed ifdefs. Changed STM32 to STM32H5.

Add some can testing changes.

Added option to configure bit timing, with automatic bit timing set as default.

Style fixes

Fixed FDCAN2 and memory access issues

FDCAN2 msgram offset was wrong by 1 word (4 bytes). I removed the + 4 at the end of the definition. This fixed the issues with fdcan2. Also changed ifdefs when setting ESI, FDF, and BRS bits. When CAN FD was used, this resulted in the first command after the endif (the setting of dest at line 2325) being skipped because it was included in the else block when it shouldn't have. This resulted in exceptions. Adjust ifdefs fixes this problem. Other minor fixes.

Restoring board files to upstream versions. These files will be pulled in later in a separate pull request. stm32h5_fdcan_test branch created for this.

Fixed Queue Mode Transmit

The can driver checks the TFFL bits in the TXFQS register. In Queue mode, this always returns 0. As a result, fdcan_txempty was always returning false, which resulted in no transmissions. This code fixes that.

Add stm32h5 fdcan chardriver to Make.defs
2025-01-07 01:05:23 +08:00
Eren Terzioglu
6eabe35a60 esp32[h2]: Fix esp32h2 get mac address issue 2025-01-07 01:03:44 +08:00
hujun5
62566734a4 rp23xx_pio.c: rm spin_lock_irqsave(NULL) in arch/arm/src/rp23xx/rp23xx_pio.c
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-06 23:07:58 +08:00
hujun5
57ca4e1789 up_rtc_gettime: add spinlock to protect up_rtc_gettime
reason:
We have removed the critical section protection
for the up_rtc_gettime function in common code.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-06 23:07:58 +08:00
buxiasen
89455bc9a1 arch: up_getusrsp change to inline and implement in irq.h
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-06 23:03:05 +08:00
buxiasen
1358942132 arch/tricore: move tricore_csa2addr from internal.h to arch.h
Make up_getusrsp possible move to irq as depends on tricore_csa2addr

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-06 23:03:05 +08:00
buxiasen
7a0ea108f6 arch/arm-m: add api getpsp, for exception direct case
For exception_direct causing unwind to read NULL and breaks thread backtrace.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-06 23:03:05 +08:00
buxiasen
9bdcc4dc4b arch/irq.h: update all inline to inline_function
Inline & inline_function both used make confuze, let's modify all inline
in irq.h to inline_function, also clear the always_inline_funcion
declaration.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-06 23:03:05 +08:00
Kevin Zhou
1bc2e1a175 xtensa/esp32s3: set cpuint to initial value after deallocate 2025-01-06 22:57:14 +08:00
Ritvik
3e6649856b Fix Overlap Handling in sim_copyfullstate to Prevent Undefined Behavior 2025-01-06 08:19:04 +08:00
wangzhi16
bbaf1ff9fd use small lock in following files:
arch/arm64/src/a64/a64_twi.c
arch/arm64/src/imx9/imx9_gpioirq.c
arch/arm64/src/imx9/imx9_lpi2c.c
arch/arm64/src/imx9/imx9_usbdev.c
arch/arm64/src/imx9/imx9_usdhc.c

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-04 22:43:20 -03:00
cuiziwei
781c27a98e sim/oneshot: Remove redundant variables.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2025-01-03 21:12:41 +08:00
wangzhi16
893c5e92c2 Reduce the size of tcb by four bytes.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-02 23:18:42 +08:00
Yanfeng Liu
6fb12b0284 arch/qemu-armv7a: kernel mode cmake support
This allows to build kernel mode NuttX with cmake.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-02 23:13:07 +08:00
Filipe Cavalcanti
75aa80dba8 arch/xtensa: enable SPIRAM test during boot of ESP32|S3 2025-01-02 23:12:39 +08:00
p-szafonimateusz
eeef185558 arch/x86_64/include/intel64/irq.h: align definitions
align all definitions in intel64/irq.h

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-01-02 23:11:38 +08:00