Commit graph

531 commits

Author SHA1 Message Date
Andre Heinemans
84ab0a3785 lpuart: fix build errors for SINGLEWIRE and INVERT without SERIAL_TERMIOS 2024-12-16 10:26:48 +08:00
Andre Heinemans
a0f0252e92 arm64/imx9: tpm: fix TPM_FILTER_CHXFVAL_MASK macro 2024-12-16 09:56:55 +08:00
Jouni Ukkonen
75ef5ea11e arch/arm64/imx9: Fix usdhc dma receive
Invalidate cache when dma transfer is ready

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-12-12 21:58:39 +08:00
simbit18
eec97064d7 fix nxstyle
Removed extra spaces from .h and .c files
2024-12-10 21:57:22 +08:00
Xiang Xiao
60fb917eda Remove FAR from 32/64bit arch
since these arch doesn't distinguish between near and far pointers

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-12-05 22:55:39 +08:00
wangmingrong1
fe5ee0c6ac arm64/toolchain: Fix toolchain judgment after opening lto
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-05 13:23:13 +08:00
hujun5
bc844509e2 addrenv: Ensure that the transmission parameter of addrenv_switch is not NULL
reason:
avoid obtaining this_task multiple times.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-04 14:20:12 +08:00
Tiago Medicci Serrano
5358f5b940 libm: Do not link the toolchain's libm unless explicitly selected
Fix CMake-based build system to include the toolchain's libm only
when `CONFIG_LIBM_TOOLCHAIN` is selected. Before this commit, if
the user selected `CONFIG_LIBM_NEWLIB`, for instance, the build
system would still link the toolchain's libm functions instead of
the ones provided by newlib.

PS: this commit applies the same changes previously introduced for
the other architectures.
2024-12-04 09:30:33 +08:00
chao an
5cd3eed323 arm64/imx8: fix build break
Error: chip/imx8qm_lowputc.S:23:1: error: "/*" within comment [-Werror=comment]
   23 | /****************************************************************************
      |
Signed-off-by: chao an <anchao@lixiang.com>
2024-12-03 09:38:35 +08:00
Alin Jerpelea
879d38d511 arch/arm64: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-02 22:43:23 +08:00
wangmingrong1
9555f9ff55 arm64/mte: Add support for arm64 mte
For details, please refer to the kernel's introduction to this at "https://docs.kernel.org/arch/arm64/memory-tagging-extension.html" and Android's introduction to this at "https://source.android.com/docs/security/test/memory-safety/arm-mte"

Of course, there is also the following detailed principle introduction
https://developer.arm.com/-/media/Arm%20Developer%20Community/PDF/Arm_Memory_Tagging_Extension_Whitepaper.pdf

The modification of this patch is only to merge the simplest MTE function support. In the future, the MTE function will be integrated into the kernel to a greater extent, for example, hardware MTE Kasan will be supported in the future.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-02 11:04:11 -03:00
wangmingrong1
1e32122709 arm64/qemu: Add support for arm64 qemu's maximum feature cpu
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-02 11:04:11 -03:00
hujun5
ab0fb80e2b arm64: change some format
fix the comment in https://github.com/apache/nuttx/pull/14980

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-30 03:15:54 +08:00
wangmingrong1
137ca05249 arm64/toolchain: Cmake alignment makefile writing
They should be a relationship of choice:
ifeq ($(CONFIG_ARCH_CORTEX_A53),y)
  ARCHCPUFLAGS += -mcpu=cortex-a53
else ifeq ($(CONFIG_ARCH_CORTEX_A55),y)
  ARCHCPUFLAGS += -mcpu=cortex-a55
else ifeq ($(CONFIG_ARCH_CORTEX_A57),y)
  ARCHCPUFLAGS += -mcpu=cortex-a57
else ifeq ($(CONFIG_ARCH_CORTEX_A72),y)
  ARCHCPUFLAGS += -mcpu=cortex-a72
else ifeq ($(CONFIG_ARCH_CORTEX_R82),y)
  ARCHCPUFLAGS += -mcpu=cortex-r82
else ifeq ($(CONFIG_ARCH_ARMV8A),y)
  ARCHCPUFLAGS += -march=armv8-a
else ifeq ($(CONFIG_ARCH_ARMV8R),y)
  ARCHCPUFLAGS += -march=armv8-r
endif

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-29 18:37:21 +08:00
hujun5
d89f22eb98 arm64: remove g_running_tasks[this_cpu()] = NULL
reason:
We hope to keep g_running_tasks valid forever.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-29 10:04:50 +01:00
Jouni Ukkonen
1bfe8bcf71 arch/arm64/imx9: Boot, move mmu init to correct place
MMU init must be after ddrinit.

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-29 10:03:28 +01:00
hujun5
0bba53ce12 remove redundant scheduling records
reason:
Since the scheduling records have already been moved to the interrupt exit in this submission,
we need to delete the original records' locations.
This commit fixes the regression from https://github.com/apache/nuttx/pull/13651

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-28 18:56:13 +08:00
Jouni Ukkonen
6b38b83331 arch/arm64/imx9: Clear DMA channel interrupts on init
Avoid spurious interrupts on reboot

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-28 15:02:15 +08:00
Jouni Ukkonen
1d23baaa63 arch/arm64/imx9/imx9_flexspi: Replace memcpy by while loop
libc memcpy cannot access fspi memory space correctly
remove unnecessary debugassert and cache operations

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-28 15:00:33 +08:00
simbit18
0476895c0d fix nxstyle
Remove TABs
2024-11-28 09:14:49 +08:00
hujun5
111a0746c2 arm64: change name saved_reg to saved_regs
reason:
saved_regs is more meaningful and used by all other arch

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-26 10:09:31 +08:00
hujun5
fccd908114 arch/arm64: syscall SYS_switch_context and SYS_restore_context use 0 para
reason:
simplify context switch
sys_call0(SYS_switch_context)
sys_call0(SYS_restore_context)

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-23 12:22:21 +08:00
hujun5
f4d212fd6d arm64: remove up_set_current_regs/up_current_regs
reason:
up_set_current_regs initially had two functions:

1: To mark the entry into an interrupt state.
2: To record the context before an interrupt/exception. If we switch to
a new task, we need to store the upcoming context regs by calling up_set_current_regs(regs).

Currently, we record the context in other ways, so the second function is obsolete. Therefore,
we need to rename up_set_current_regs to better reflect its actual meaning, which is solely to mark an interrupt.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-23 02:05:56 +02:00
yinshengkai
0194c2f88a gcov: update gcov compilation parameters
profile-generate is used to generate compilation feedback optimization data, not just code coverage data

It will rely on the toolchain library:
nuttx/libs/libc/misc/lib_utsname.c:94:(.text.uname+0x2c): undefined reference to `__gcov_indirect_call_profiler_v4'
arm-none-eabi-ld: nuttx/libs/libc/misc/lib_utsname.c:113:(.text.uname+0x178): undefined reference to `__gcov_indirect_call'
arm-none-eabi-ld: nuttx/libs/libc/misc/lib_utsname.c:113:(.text.uname+0x188): undefined reference to `__gcov_time_profiler_counter'
arm-none-eabi-ld: nuttx/staging/libc.a(lib_utsname.o):(.data..LPBX0+0x30): undefined reference to `__gcov_merge_time_profile'

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-11-22 19:08:08 +08:00
Jouni Ukkonen
085830612c arch/arm64/imx9: Fix cntfrq_el0 to correct value
Read base frequency from system counter0 and write it
to arm core register. This corrects timers to work properly
Then enable counting.

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-21 11:26:45 -03:00
Jouni Ukkonen
9aa9ee28cd arch/arm64/imx9/lspi: improve spi initialization
Hardware initialization is based refcount, not
spi enable bit and add interface to unitialize bus

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-20 12:49:12 -03:00
Jukka Laitinen
b088369014 arch/arm64/src/imx9/imx9_lpi2c.c: Clear NACK properly on last RX byte
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-11-20 17:36:00 +08:00
Jukka Laitinen
02a3437289 arch/arm64/src/imx9/imx9_lpi2c.c: Add error recovery on timeout
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-11-20 17:36:00 +08:00
Jukka Laitinen
3afa58cdda arch/arm64/src/imx9/imx9_lpi2c.c: Clean up the irq handling logic
Both RX and TX interrupts can be enabled after the setup of the transfer; the TX interrupt
must be enabled after queuing the first byte as done before. It is not possible to miss the
RX interrupts, as it pends as long as the byte gets read from the FIFO

When starting the TX, the first byte can be queued instantly, it won't be sent out to the
bus if there is NACK to the address. This also prevents spurious TX interrupts in error
cases, since the TX queue is not empty after initiating a transfer.

In some error cases controller sends STOP by itself even if AUTOSTOP is disabled.
It is better to tell the controller to ABORT, which will also generate STOP only when needed.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-11-20 17:36:00 +08:00
ligd
a88652fe53 arm64: fix compile failed 'tpidr_el1' undeclared
time/lib_localtime.c: In function 'tz_lock':
time/lib_localtime.c:396:7: error: 'tpidr_el1' undeclared (first use in this function)
  396 |   if (up_interrupt_context() || (sched_idletask() && OSINIT_IDLELOOP()))
      |       ^~~~~~~~~~~~~~~~~~~~

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-11-17 20:03:44 +08:00
hujun5
707f0ce719 arm64: remove unused code
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-17 10:07:27 +08:00
hujun5
19b4911d7f arch: remove up_current_regs in common code
reason:

When entering an exception or interrupt, there are two sets of registers:
one is the "running regs", which we need to save,
and the other is the "ready to running regs", which we may soon use.
For consistency in logic, we can always store the "running regs" in the regs field of g_running_tasks,
otherwise it may lead to errors in the storage location of the "running regs."

When we need to access the "running regs," we should uniformly retrieve them from the regs field of g_running_tasks.

As the next step, we will rename the set_current_regs/up_current_regs functions
for each architecture to more appropriate names, solely for the purpose of identifying interrupts.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-15 18:25:35 +08:00
Eero Nurkkala
f2949f84a3 arm64/imx9: add imx93-evk ddr training
This performs the DDR training for imx93-evk. In addition to the source code,
it downloads binaries which are included in the final image. The bootloader
must be ARCH_CORTEX_A53 instead of A55 due to atomic instructions that don't
work with the OCRAM / EL3 combination.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2024-11-15 09:56:31 +08:00
wangmingrong1
9b0df45d1c gcov: arm,arm64 add coverage global
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-15 01:05:16 +08:00
wangmingrong1
17ce9b86c1 gcov: Correct existing gcov configuration
1. add CONFIG_COVERAGE_ALL to replace CONFIG_SCHED_GCOV_ALL
2. Correct all SCHED_GCOV, SCHED_GCOV_ALL

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-15 01:05:16 +08:00
wangmingrong1
656883fec5 arch/toochain: Add toochain to gcc
1. Modify the select the gcc compiler

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-14 15:45:24 +08:00
Jouni Ukkonen
e2a9c84260 arch/arm64/imx9: Add trdc support
Trdc is configured in EL3 bootloader
Clock pre-initialization is also executed there.
Trdc board configuration for imx93evk included

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-13 16:46:04 +08:00
lipengfei28
daab676db9 arch/arm64: syscall SYS_switch_context and SYS_restore_context use tcb as
parm

sys_call2(SYS_switch_context, (uintptr_t)rtcb, (uintptr_t)tcb)
sys_call1(SYS_restore_context, (uintptr_t)next)

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-11-13 16:35:15 +08:00
wangmingrong1
bf93c7840a gprof: move gprof function from sched to libbuiltin/libgcc
1. Enable interrupt gprof please config CONFIG_PROFILE_MINI
2. Enable instuction gprof please add compile opt "-pg" or config CONFIG_PROFILE_ALL

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-13 02:42:31 +08:00
lipengfei28
d8bdf23e8a arch/arm64: bug fix,arm64_fatal_handler need regs parms
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-11-12 17:35:47 +08:00
guoshichao
6036a318f4 compiler: add __ARM_ARCH, __ARM_FEATURE_DSP macro definition in ghs
when we build mbedtls in vela with ghs compiler, the mbedtls need to
access __ARM_ARCH and __ARM_FEATURE_DSP, and to construct the inline asm
code based on these two macros.
With ghs compiler, these two macros are not defined, and will be
evaluated as 0 by default, and thus will using to wrong inline asm code,
in order to handle this issue, we need to add conversion between the ghs
and gcc with __ARM_ARCH, __ARM_FEATURE_DSP

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-11-11 22:18:05 +08:00
ouyangxiangzhen
f7abf7446f arch/arm64: Optimized SGI to avoid VM exit.
In the virtualized environment, each time an SGI is sent, the value of IGROUPR0 needs to be read once. Since the GIC Redistributor is a purely emulated device, each read of IGROUPR0 will cause a VM exit, causing serious performance degradation. This patch replaces the read with the value previously set in `gicv3_cpuif_init`, and we assume that this value has not been modified after initialization.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-11-08 01:23:46 +08:00
Jouni Ukkonen
ed8bfdd26a arch/arm64/imx9: Reset rx fifo in mode change
instead of looping just reset rxfifo

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-07 21:34:04 +08:00
Jouni Ukkonen
8c98194182 arc/arm64/imx9: Improve flexspi nor performance
-Increase clock to 133MHz
-Enable prefetch

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-07 16:51:13 +08:00
Jouni Ukkonen
a3d1b06214 arch/arm64/imx9 4byte addressing to nor
-Use 4byte addressing in flexpi nor
-report 4k blocksize to userland
-increase clock to 100MHz
-some cleanup

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-07 16:51:13 +08:00
Jouni Ukkonen
d260e7f59e imx9/flexcan: Add disable/enable cycle
Add enable/disable cycle to initialize
function to speed up soft reset

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-07 16:20:29 +08:00
Jukka Laitinen
4ba8723ab8 arch/arm64/src/common/arm64_fatal.c: Fix compilation warning with -Wextra
Wextra complains on some silly issues, like this one. Work around the issue in code directly.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-11-07 00:56:40 +08:00
Jouni Ukkonen
6a0c239c8e arch/arm64/imx9: Clear edma4 mux conf before set
Warm boot might fail if edma4 channel mux is
not written to default value

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-06 02:56:52 +08:00
wangmingrong1
6381685a8b toolchains: Compiler versioning adds --print-memory-usage
1. The "-print-memory-usage" parameter introduced in GNU Link version 2.26

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-06 01:57:38 +08:00
ligd
91b228fcdd arm64: fix compile failed when build ELF apps
aarch64-none-elf-gcc -c -D_LDBL_EQ_DBL -fno-common -Wall -Wstrict-prototypes -Wshadow -Wundef -Werror -Wno-attributes -Wno-unknown-pragmas -Wno-psabi "-O3" -fno-strict-aliasing -fno-omit-frame-pointer -fno-optimize-sibling-calls -fstack-protector-all -fsanitize=kernel-address --param asan-globals=1 -ffunction-sections -fdata-sections "-g3" -mcpu=cortex-a53 -isystem /home/ligd/platform/trunk/nuttx/include -D__NuttX__  -pipe -I /home/ligd/platform/trunk/apps/crypto/mbedtls/include -I /home/ligd/platform/trunk/apps/crypto/mbedtls/mbedtls/include -I /home/ligd/platform/trunk/apps/crypto/openssl_mbedtls_wrapper/include -I /home/ligd/platform/trunk/apps/external/android/frameworks/native/libs/binder/include_rpc_unstable -I /home/ligd/platform/trunk/apps/external/android/frameworks/native/libs/binder/ndk/include_ndk -I /home/ligd/platform/trunk/apps/external/android/frameworks/native/libs/binder/ndk/include_platform -I /home/ligd/platform/trunk/apps/external/android/system/chre/chre/chre_api/include/chre_api -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=2048 -I /home/ligd/platform/trunk/apps/external/android/system/core/libcutils/include -I /home/ligd/platform/trunk/apps/frameworks/graphics/uikit/include -I /home/ligd/platform/trunk/apps/frameworks/runtimes/feature/include -I /home/ligd/platform/trunk/apps/frameworks/runtimes/feature/src -I /home/ligd/platform/trunk/apps/frameworks/security/include -I /home/ligd/platform/trunk/apps/frameworks/system/dfx/include -I /home/ligd/platform/trunk/apps/frameworks/system/topics/include -I /home/ligd/platform/trunk/apps/frameworks/system/utils/include -I /home/ligd/platform/trunk/apps/graphics/lvgl -I /home/ligd/platform/trunk/apps/graphics/lvgl/lvgl -I "/home/ligd/platform/trunk/apps/system/argtable3/argtable3/src" -I /home/ligd/platform/trunk/apps/system/libuv/libuv/include -DUV_HANDLE_BACKTRACE=CONFIG_LIBUV_HANDLE_BACKTRACE -I /home/ligd/platform/trunk/apps/system/uorb/ -I /home/ligd/platform/trunk/nuttx/arch/arm64/src/board/include -I /home/ligd/platform/trunk/nuttx/arch/arm64/src/chip -I /home/ligd/platform/trunk/apps/vendor/bes/drivers/best1600_ep/miwear_drivers/display -I /home/ligd/platform/trunk/apps/vendor/bes/drivers/best1600_ep/miwear_drivers/boards -I /home/ligd/platform/trunk/apps/vendor/bes/drivers/best1600_ep/miwear_drivers/include -I "/home/ligd/platform/trunk/apps/include" -fvisibility=hidden -mlong-calls    modprint.c -o  modprint.c.home.ligd.platform.trunk.apps.examples.sotest.modprint.o

aarch64-none-elf-gcc: error: unrecognized command-line option '-mlong-calls'

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-11-04 16:24:29 +08:00