[BUG] armv7-m: CACR address change in #22003 also applies to Cortex-M7, ARMV7M_DCACHE_WRITETHROUGH no longer sets FORCEWT
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- c
- Lĩnh vực
- embedded-iot, operating-systems
Hướng nghiên cứu
Đọc arch/arm/src/arm_m/nvic.h và so sánh các định nghĩa NVIC_CACR_OFFSET được ARMv7-M và ARMv8-M sử dụng; kiểm tra cách nó được dùng trong arch/arm/src/armv7-m/arm_cache.c. Build các cấu hình ARMv7-M và ARMv8-M được mô tả trong issue và xác nhận mỗi cấu hình sử dụng địa chỉ CACR của kiến trúc tương ứng, trong đó thiết lập write-through của Cortex-M7 đặt FORCEWT và Cortex-M55 giữ nguyên địa chỉ mới hơn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description / Steps to reproduce the issue
What happens
Since #22003 (commit 857a20c7d2, arch/arm/armv8-m: Fix the CACR address.), NVIC_CACR_OFFSET in arch/arm/src/arm_m/nvic.h is 0x10008, which is where the L1 cache control register of the Cortex-M55/M85 lives. That header is shared with ARMv7-M, so on the Cortex-M7, where the register is at 0xE000EF9C, up_enable_dcache() in arch/arm/src/armv7-m/arm_cache.c now writes FORCEWT to 0xE001E008:
#ifdef CONFIG_ARMV7M_DCACHE_WRITETHROUGH
ccr = getreg32(NVIC_CACR);
ccr |= NVIC_CACR_FORCEWT;
putreg32(ccr, NVIC_CACR);
#endif
With CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y the D-cache therefore stays write-back on the Cortex-M7, while up_clean_dcache() is still compiled as a no-op.
How it shows
Custom N32H760 board (Cortex-M7), CONFIG_ARMV7M_DCACHE=y, CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y, CONFIG_ARM_MPU=y with no MPU regions configured, DMA buffers and descriptors in cacheable SRAM. The first image built after that commit panics during up_initialize(): the USART receive DMA channel reads its linked-list items from memory that the CPU has only written to the cache.
ABCDE
dump_assert_info: Current Version: NuttX 13.1.1 <hash> Nov 27 2026 23:50:49 arm
dump_assert_info: Assertion failed panic: at file: /n32_serial.c:2472 task: Idle_Task process: Kernel 0x170090c5
The same sources on the commit before 857a20c7d2 boot normally.
Registers read through the debugger right after boot
| Image | CACR (0xE000EF9C) |
DMA channel 1: SA / DA / LLP | Result |
|---|---|---|---|
| master as is (0c45a2fc48) | 0x00000000 |
d1dd0206 / 0303f011 / f021d011 (loaded from stale memory) |
panic |
| with the change below | 0x00000004 |
4000c410 / 24000340 / 240002b4 (the list the CPU wrote) |
boots |
Suggested change
Keep the new address for ARMv8-M and restore the Cortex-M7 one otherwise (the comment above the definition should be reworded as well):
--- a/arch/arm/src/arm_m/nvic.h
+++ b/arch/arm/src/arm_m/nvic.h
@@ -307,7 +307,11 @@
/* Cortex-M55 and Cortex-M85 implementation defined registers */
-#define NVIC_CACR_OFFSET 0x10008 /* L1 Cache Control Register */
+#ifdef CONFIG_ARCH_ARMV8M
+# define NVIC_CACR_OFFSET 0x10008 /* L1 Cache Control Register */
+#else
+# define NVIC_CACR_OFFSET 0x0f9c /* L1 Cache Control Register */
+#endif
/* NVIC register addresses **************************************************/
Verification of the suggested change
arm/n32h7, Cortex-M7,CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y, on the board above: with this change and no board-specific workaround, the image that panicked boots, and CACR reads0x00000004(last row of the table).arm/stm32n6/nucleo-n657x0-q:nsh, Cortex-M55, withCONFIG_ARMV8M_DCACHE_WRITETHROUGH=yadded: builds, andup_enable_dcache()still uses0xE001E008.- Both configurations build without errors with
arm-none-eabi-gcc 15.3.1.
186 defconfigs under boards/arm set CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y (stm32h7, stm32f7, imxrt, samv7, s32k3xx, ...). I only tested the board above; whether the others are affected depends on whether their drivers rely on FORCEWT or on their own cache maintenance and MPU regions.
On which OS does this issue occur?
[OS: Linux]
What is the version of your OS?
Linux, Ubuntu 26.04.1 LTS, x86_64
NuttX Version
master
Issue Architecture
[Arch: arm]
Issue Area
[Area: Kernel]
Host information
No response
Verification
- I have verified before submitting the report.
- Ngôn ngữ chính
- C
- Star
- 4.1k
- Fork
- 1.8k
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 847
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/nuttx
-
mtd: RAM consolidation reads past its block buffer on a malformed entryCó thể đã có người làm @Ahmed55559 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
mtd: SET loses the consolidation error and can report -ENOMEMCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
mtd: config NVS truncates the block-tail offset to 16 bitsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/nuttx#22270 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pm: pm_domain_unregister() clears the target domain registry on a repeated unregister of the same callbackCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
apache/nuttx#22171 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Please rerun `pre-commit run -a`Đang mởArch: all Arch: arm Area: Build system OS: Linux Type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Polprzewodnikowy/N64FlashcartMenu#486 · 3 bình luận ·
-
crash
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
`core.output` prints string properties without escaping their quotesCó thể đã có người làm @JensOgorek đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
zauberzeug/lizard#399 ·
Maintainer thường phản hồi trong vòng 2 ngày