Commit Graph

22896 Commits

Author SHA1 Message Date
xuxin19 6e81b1ed91 cmake:implement CMake build of xtensa arch
configure:cmake -B build -DBOARD_CONFIG=iss-hifi4:nsh
build:cmake --build build
run:xt-run build/nuttx

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-02 18:08:38 +08:00
Eren Terzioglu 3796f56748 esp32[s2|s3]: Add I2C bitbang support 2024-11-01 11:41:46 -03:00
Eren Terzioglu 4afaef1a30 esp32[c3|c6|h2]: Add I2C bitbang supoort 2024-11-01 11:41:46 -03:00
ouyangxiangzhen 17c51c0667 userspace: Exclude nuttx/arch.h
This patch fixed userspace headers conflict. Architecture-related definition and API should not be exposed to users.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-11-01 16:59:37 +08:00
xuxin19 b8523280c2 cmake(bugfix):fix cxx build error on fastDDS X86_64
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-31 17:55:13 +08:00
xuxin19 8da0206a40 cmake:fix sim gc-section option build failed
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-31 17:55:13 +08:00
Jukka Laitinen da19d79656 arch/arm64/src/imx9/imx9_lpuart.c: Fix parity get in TCGETS
This is a partial revert / fix for regression from 44d1811ebb

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-31 17:54:22 +08:00
hujun5 9b1800d043 irq: force inline up_interrupt_context
reason:
Replace "inline" with "inline_function" for "up_interrupt_context" to ensure consistency with other arch

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-31 15:43:41 +08:00
Ville Juven f36dff8105 riscv/syscall: Fix sched_note instrumentation for BUILD_KERNEL
The sched_note calls were missing from riscv_perform_syscall().
2024-10-30 23:18:07 +08:00
xuxin19 e60c60b691 cmake(sync):fix cmake SIM build error build nuttx upstream
/usr/lib/x86_64-linux-gnu/libSM.so  /usr/lib/x86_64-linux-gnu/libICE.so  /usr/lib/x86_64-linux-gnu/libX11.so  /usr/lib/x86_64-linux-gnu/libXext.so  -lpthread  -lrt  -lm  -lasound  -lmad  -lv4l2 && :
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSM.so: error adding symbols: file in wrong format

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-30 22:14:40 +08:00
xuxin19 c60b980968 cmake(bugfix):fix robot openlibm cmake build missing source error
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-30 22:14:40 +08:00
Ville Juven 9d4218666c mpfs/smp: Add riscv_macros to mpfs_shead
To get definition for riscv_set_inital_sp macro
2024-10-30 22:09:01 +08:00
YAMAMOTO Takashi 761ee81956 move readv/writev to the kernel
currently, nuttx implements readv/writev on the top of read/write.
while it might work for the simplest cases, it's broken by design.
for example, it's impossible to make it work correctly for files
which need to preserve data boundaries without allocating a single
contiguous buffer. (udp socket, some character devices, etc)

this change is a start of the migration to a better design.
that is, implement read/write on the top of readv/writev.

to avoid a single huge change, following things will NOT be done in
this commit:

* fix actual bugs caused by the original readv-based-on-read design.
  (cf. https://github.com/apache/nuttx/pull/12674)

* adapt filesystems/drivers to actually benefit from the new interface.
  (except a few trivial examples)

* eventually retire the old interface.

* retire read/write syscalls. implement them in libc instead.

* pread/pwrite/preadv/pwritev (except the introduction of struct uio,
  which is a preparation to back these variations with the new
  interface.)
2024-10-30 17:07:54 +08:00
wangmingrong1 e3d7d23618 gcov: Fix typographical errors
1. CONFIG_ARCH_COVERAGE has been replaced by CONFIG_SCHED_GCOV
2. Delete the SIM-specific GCOV_ALL configuration and change it to a universal configuration for all architectures

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-30 14:45:23 +08:00
nuttxs 0c5381a0a1 xtensa/esp32s3: add esp32s3 reset reasons interface 2024-10-29 23:03:37 +08:00
Gao Feng 782ab3b248 xtensa/esp32s3: enable encrypted flag based on partition and device
If device encryption is not enabled by eFuse, and partiton mark as
encrypted flag, then encrypted MTD is used.

That is no problem in write and read operation, but failed while
using spi_flash_mmap(...) since de-encrypt is not processed.

So, back to use non-encrypted MTD following API Guide:
If flash encryption is not enabled, the flag "encrypted" has no effect
2024-10-29 23:02:35 +08:00
cuiziwei d42f16939e nuttx: Fix build warning with can't found xt-g++
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-29 22:27:58 +08:00
Jukka Laitinen 62194400f9 imx9/serial: Take proper use of RX/TX FIFOs, clean up interrupt service routine
- i.MX93 LPUARTs have 16-byte RX and TX FIFOs. Take those into use and correct some related register definitions
- There is no reason to loop inside interrupt handler, remove the looping

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-29 22:24:48 +08:00
Jukka Laitinen 44d1811ebb imx9/serial: Clean up the flow control code
- Remove GPIO (SW) based flow control. It didn't work, and pure HW flow control seems to work fine
- Remove some unneeded ifdefs and change bit-field flags to booleans to clean up the code

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-29 22:24:48 +08:00
wangmingrong1 083f9d162e clang/ld.lld: clang17 and above support the option --print-memory-usage
1. cmake uses clang++ as a connector, and does not currently support:
	clang++: error: unknown argument: '-wl,--print-memory-usage'
	clang++: error: no input files

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-29 20:43:35 +08:00
chao an e3689cbb2f CMake/preprocess: fix typo PREPROCES -> PREPROCESS
correct the marco define from PREPROCES to PREPROCESS

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-29 17:41:01 +08:00
raiden00pl 716d898dda arch/arm/stm32/stm32_dumpgpio.c: fix print warnings
fix print warnings for stm32_dumpgpio.c
2024-10-29 02:23:36 +08:00
raiden00pl 7ebb8af454 arch/arm/stm32/Kconfig: fix Kconfig error
fix Kconfig error related to STM32_HAVE_HRTIM1_PLLCLK
2024-10-28 19:36:17 +08:00
wangmingrong1 e174d73cd9 clang:libclang_rt.builtins-xxx.a supports builtin
1. enable CONFIG_BUILTIN_COMPILER_RT  to built libclang_rt.builtins-xxx.a and no longer use the compiler's built-in
2. Modify clang version acquisition to get two decimal points
3. It has been ported to support four architectures: ARM, ARM64, RISCV, and x86_64, among which ARM has been validated

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-28 16:38:45 +08:00
Xiang Xiao 69100ef0e4 arch: Fix minor style issue
not real behaviour change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-28 09:24:55 +01:00
raiden00pl b5e5cdd851 arch/arm/stm32h7: add workaround for Renode
Add an option to disable busy wait PWR_CSR1_ACTVOSRDY during boot
which doesn't work with Renode simulation
2024-10-26 20:49:49 +08:00
chao an c6591c0f49 driver/serial: remove return value of up_putc()
modify the prototype of up_putc(): remove the return value

The architecture code does not care about the return value of up_putc(), so removing it saves two statements:

Before:                                                    After:
de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)    |  de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)
de50: e24dd014  sub sp, sp, #20                         |  de50: e24dd014  sub sp, sp, #20
de54: e58d0004  str r0, [sp, #4]                        |  de54: e58d0004  str r0, [sp, #4]
de58: e30030f8  movw  r3, #248  @ 0xf8                  |  de58: e30030f8  movw  r3, #248  @ 0xf8
de5c: e3423000  movt  r3, #8192 @ 0x2000                |  de5c: e3423000  movt  r3, #8192 @ 0x2000
de60: e58d300c  str r3, [sp, #12]                       |  de60: e58d300c  str r3, [sp, #12]
de64: e59d1004  ldr r1, [sp, #4]                        |  de64: e59d1004  ldr r1, [sp, #4]
de68: e59d000c  ldr r0, [sp, #12]                       |  de68: e59d000c  ldr r0, [sp, #12]
de6c: ebfffe66  bl  d80c <pl011_putc>                   |  de6c: ebfffe66  bl  d80c <pl011_putc>
de70: e59d3004  ldr r3, [sp, #4]                        |  de70: e28dd014  add sp, sp, #20
de74: e1a00003  mov r0, r3                              |  de74: e49df004  pop {pc}    @ (ldr pc, [sp], #4)
de78: e28dd014  add sp, sp, #20                         |
de7c: e49df004  pop {pc}    @ (ldr pc, [sp], #4)        |

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-26 13:21:29 +08:00
Haiyue Wang d0f957ae85 qemu-intel64: Fixes the linker 'noexecstack' warning
Fix the linker warning based on these two commits:

 ld: warning: fork.o: missing .note.GNU-stack section implies executable stack
 ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker

commit 36ac812114 ("sim: Fixes the following linker warning:"),
commit b5d640acc5 ("fix Cygwin/MSYS2  ld: unrecognized option '-z'")
2024-10-26 11:10:43 +08:00
raiden00pl da1ff4cf77 arch/arm/stm32: convert error to warning when CCM is not enabled
User may set CONFIG_MM_REGIONS=1 on purpose to disable CCM.
This is a completely normal system config and should not be treated as error.

I found this problem trying to run Renode with stm32f4discovery/nsh but
Renode doesn't support CCM so we have to disable it
2024-10-26 11:02:19 +08:00
YAMAMOTO Takashi 6a2e21dd07 esp32: Fix a heap corruption bug with SPIRAM
Don't add SPIRAM ("HEAP2") to both of kernel/user heaps.

Sync with the corresponding logic in esp32s3.
2024-10-25 19:03:22 +08:00
chao an b28f87e3f0 arm/gicv3: replace this_cpu() to up_cpu_index()
If the core id needs to be included in the hardware register
calculation, up_cpu_index() should be used instead of this_cpu().

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-25 14:27:34 +08:00
Jinliang Li 5fb0c44f38 arm/armv8-r: optimize generic timer initialization
1. Enable timer and irq finally to make sure timer callback was already
   registered. When the CPU resets, the values of some generic timer
   registers are undefined. Enabling the timer interrupt in advance may
   cause the timer to trigger early while the timer callback is not yet
   registered. This results in the timer ISR being executed, which masks
   the timer interrupt. Since the timer callback is not registered at
   this point, the timer interrupt is not unmasked, further causing the
   system scheduler to hang.
2. Remove timer mask for one-shot timer and that's in isr,
   irq/fiq is disabled. Masking generic timer is not necessary, and it
   may introduce risks, otherwise, mask/unmask must be pair in all
   situations.

Signed-off-by: Jinliang Li <lijinliang1@lixiang.com>
2024-10-25 13:17:08 +08:00
Jinliang Li 40bbe7f3e9 arm/armv8-r: init HSCTLR and HACTLR for EL2
1. init HSCTLR to enable i-cache/d-cache for EL2
2. init HACTLR to enable all access to implementation defined
   registers for EL1.
3. add dsb/isb before switch to EL1 from EL2

Signed-off-by: Jinliang Li <lijinliang1@lixiang.com>
2024-10-25 12:09:47 +08:00
chao an ea4c4ef36a arm/armv8-r: fix unable to switch context in ISR context
Regression by:
| commit 35c8c80a00
| Author: ligd <liguiding1@xiaomi.com>
| Date:   Fri Jul 26 23:14:13 2024 +0800
|
| arch: change nxsched_suspend/resume_scheduler() called position

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-25 09:47:37 +08:00
Tim Hardisty 517c66daf8 sam_sfc.c incorrect EFUSEIOC name used 2024-10-25 08:42:40 +08:00
wangmingrong1 f11b04fc61 kconfig: Add link parameters that can print remaining memory information
LD: nuttx
Memory region         Used Size  Region Size  %age Used
           flash:      284272 B       512 KB     54.22%
           sram1:       13296 B         2 MB      0.63%
           sram2:          0 GB         2 MB      0.00%
CP: nuttx.hex
CP: nuttx.bin

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-25 00:55:50 +08:00
buxiasen 974db76cb9 sim/cmake: compatible when nuttx COMPILE_OPTIONS is not set yet
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-24 21:42:06 +08:00
wangmingrong1 d007193eef armv8m/clang.cmake: add armv8m clang config
Its makefile is implemented in arch/arm/src/armv8-m/Toolchain.defs as follows:
ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)

  ifeq ($(CONFIG_ARCH_CORTEXM23),y)
    TOOLCHAIN_CLANG_CONFIG = armv8m.main_soft_nofp
  else ifeq ($(CONFIG_ARCH_CORTEXM33),y)
    ifeq ($(CONFIG_ARCH_FPU),y)
      TOOLCHAIN_CLANG_CONFIG = armv8m.main_hard_fp
    else
      TOOLCHAIN_CLANG_CONFIG = armv8m.main_soft_nofp
    endif
  else ifeq ($(CONFIG_ARCH_CORTEXM35P),y)
    ifeq ($(CONFIG_ARCH_FPU),y)
      TOOLCHAIN_CLANG_CONFIG = armv8m.main_hard_fp
    else
      TOOLCHAIN_CLANG_CONFIG = armv8m.main_soft_nofp
    endif
  else ifeq ($(CONFIG_ARCH_CORTEXM55),y)
    ifeq ($(CONFIG_ARCH_FPU),y)
      TOOLCHAIN_CLANG_CONFIG = armv8.1m.main_hard_fp
    else
      TOOLCHAIN_CLANG_CONFIG = armv8.1m.main_soft_nofp_nomve
    endif
  else ifeq ($(CONFIG_ARCH_CORTEXM85),y)
    ifeq ($(CONFIG_ARCH_FPU),y)
      TOOLCHAIN_CLANG_CONFIG = armv8.1m.main_hard_fp
    else
      TOOLCHAIN_CLANG_CONFIG = armv8.1m.main_soft_nofp_nomve
    endif
  endif

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-24 18:41:11 +08:00
Michal Lenc d8ed88c8a6 samv7: fix QSPI build
Commit 313d6df7 caused the following build error:

CC:  fixedmath/lib_b16atan2.c chip/sam_qspi.c: In function 'qspi_memory':
chip/sam_qspi.c:1552:7: warning: implicit declaration of function 'IS_ALIGNED' [-Wimplicit-function-declaration]
 1552 |       IS_ALIGNED((uintptr_t)meminfo->buffer, 4) &&
      |       ^~~~~~~~~~
In file included from chip/sam_qspi.c:41:
chip/sam_qspi.c: In function 'qspi_alloc':
chip/sam_qspi.c:1591:21: warning: implicit declaration of function 'ALIGN_UP' [-Wimplicit-function-declaration]
 1591 |   return kmm_malloc(ALIGN_UP(buflen, 4));

This was caused by missing include of nuttx.h header defining ALIGN_UP
and IS_ALIGNED.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-10-24 18:00:05 +08:00
zhanghongyu c3a0155374 arch/Kconfig: remove ARCH_MATH_H if LIBCXX
Because some libraries do require a full libm implementation.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-24 17:44:22 +08:00
hujun5 9395669ac0 arm64: fix fvp smp faild to boot
reason:
we should give a busy wait addr

This commit fixes the regression from https://github.com/apache/nuttx/pull/13640

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-24 10:17:48 +08:00
cuiziwei 12fd5ec472 nuttx: Add LIBSUPCXX_TOOLCHAIN to link the prebuilt library provide by toolchain.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-24 01:38:03 +08:00
Tiago Medicci Serrano d1fd1ed8f6 boards/esp32s3: Merge MCUboot and "simple-boot" linker scripts
To make it easier to keep the linker scripts updated for both
MCUboot and "simple-boot", this commit merges them into a single
linker script with macros to enable/disable specific sections.
2024-10-23 22:26:39 +08:00
cuiziwei 60e7a0074d nuttx/arch:Enabling ARCH_MATH_H is required when compiling sim with the 13.2 version of the toolchain.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-23 20:10:43 +08:00
Jukka Laitinen cdd11112fd arch/arm64/src/imx9/imx9_lpspi.c: Small cache operation optimization
There is no need to invalidate the RX buffer before every transfer.
It is never gets dirty, so it is good to invalidate initially after allocation,
and after each transfer.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-23 19:46:42 +08:00
Jukka Laitinen 6cadfc16cd arch/arm64/src/imx9/imx9_lpspi.c: Fix 9-16 bit transfers
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-23 19:46:42 +08:00
Jinliang Li 52995452e5 arm/build: suppress LOAD RWX linker warning
Add --no-warn-rwx-segments in case of RAM boot mode to linker to
suppress the below warning:
"nuttx has a LOAD segment with RWX permissions"

Signed-off-by: Jinliang Li <lijinliang1@lixiang.com>
2024-10-23 19:38:31 +08:00
lipengfei28 3225aa853f arch/arm64: vector table 2K align
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-23 15:15:12 +08:00
liwenxiang1 eb722794b5 arch/x86_64:Fix variable used before assignment
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-23 14:28:59 +08:00
lipengfei28 877f42cde5 remove unused variable 'cpu_freq'
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-23 10:53:27 +08:00