zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.9k stars 6.64k forks source link

<err> os: Halting system, Using static libraries, Multiple support board reappearance issues #79935

Closed zhang-wenchao closed 4 weeks ago

zhang-wenchao commented 1 month ago

Environment:

OS: Debian 12
Toolchain:  Zephyr SDK 0.16.8
Commit SHA or Version used: v3.7.0-4339-g1ec5ce05f9f8 v3.7.0-4638-g9d0486e3ee86

Info:

# life @ c-workstation in ~/Develop/test/rp on git:master x .venv [20:08:23] 
$ west build -p always -b nrf52840_mdk && west flash

# life @ c-workstation in ~/Develop/test/rp on git:master x .venv [20:12:38] 
$ west debug                                        
-- west debug: rebuilding
ninja: no work to do.
-- west debug: using runner pyocd
-- runners.pyocd: pyOCD GDB server running on port 3333
GNU gdb (Zephyr SDK 0.16.8) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arm-zephyr-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/life/Develop/test/rp/build/zephyr/zephyr.elf...
0000447 W Board ID 1026 is not recognized [mbed_board]
0000448 I Target type is nrf52840 [board]
0000527 I DP IDR = 0x2ba01477 (v1 rev2) [dap]
0000603 I AHB-AP#0 IDR = 0x24770011 (AHB-AP var1 rev2) [discovery]
0000606 I AP#1 IDR = 0x02880000 (AP var0 rev0) [discovery]
0000609 I NRF52840 not in secure state [target_nRF52]
0000620 I AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=244 part=008) [rom_table]
0000628 I [0]<e000e000:SCS v7-M class=14 designer=43b:Arm part=00c> [rom_table]
0000632 I [1]<e0001000:DWT v7-M class=14 designer=43b:Arm part=002> [rom_table]
0000636 I [2]<e0002000:FPB v7-M class=14 designer=43b:Arm part=003> [rom_table]
0000639 I [3]<e0000000:ITM v7-M class=14 designer=43b:Arm part=001> [rom_table]
0000645 I [4]<e0040000:TPIU M4 class=9 designer=43b:Arm part=9a1 devtype=11 archid=0000 devid=ca1:0:0> [rom_table]
0000651 I [5]<e0041000:ETM M4 class=9 designer=43b:Arm part=925 devtype=13 archid=0000 devid=0:0:0> [rom_table]
0000662 I CPU core #0: Cortex-M4 r0p1, v7.0-M architecture [cortex_m]
0000662 I   Extensions: [DSP, FPU, FPU_V4, MPU] [cortex_m]
0000662 I   FPU present: FPv4-SP-D16-M [cortex_m]
0000670 I This appears to be an nRF52840 QIAA C0 [target_nRF52]
0000676 I 4 hardware watchpoints [dwt]
0000680 I 6 hardware breakpoints, 4 literal comparators [fpb]
0000700 I Semihost server started on port 4444 (core 0) [server]
0000841 I GDB server started on port 3333 (core 0) [gdbserver]
Remote debugging using :3333
0001400 I Client connected to port 3333! [gdbserver]
arch_system_halt (reason=reason@entry=20) at /home/life/Develop/platform/zephyr-project/zephyr/kernel/fatal.c:30
30              for (;;) {
0001628 I Attempting to load RTOS plugins [gdbserver]
Successfully halted device
Resetting target
Loading section rom_start, size 0x100 lma 0x0
Loading section text, size 0x6498 lma 0x100
Loading section .ARM.exidx, size 0x8 lma 0x6598
Loading section initlevel, size 0x48 lma 0x65a0
Loading section device_area, size 0x50 lma 0x65e8
Loading section sw_isr_table, size 0x180 lma 0x6638
--Type <RET> for more, q to quit, c to continue without paging--
Loading section log_const_area, size 0x48 lma 0x67b8
Loading section log_backend_area, size 0x10 lma 0x6800
Loading section rodata, size 0x9cc lma 0x6810
Loading section datas, size 0xd8 lma 0x71dc
Loading section device_states, size 0x8 lma 0x72b4
Loading section log_mpsc_pbuf_area, size 0x38 lma 0x72bc
Loading section log_msg_ptr_area, size 0x4 lma 0x72f4
Loading section k_sem_area, size 0x10 lma 0x72f8
Loading section .last_section, size 0x4 lma 0x7308
[==================================================] 100%
0005788 I Erased 0 bytes (0 sectors), programmed 0 bytes (0 pages), skipped 32768 bytes (8 pages) at 15.56 kB/s [loader]
Start address 0x00001b30, load size 29452
Transfer rate: 7 KB/sec, 1051 bytes/write.
(gdb) bt
#0  z_arm_reset () at /home/life/Develop/platform/zephyr-project/zephyr/arch/arm/core/cortex_m/reset.S:97
(gdb) continue 
Continuing.
^C
Program received signal SIGINT, Interrupt.
arch_system_halt (reason=reason@entry=20) at /home/life/Develop/platform/zephyr-project/zephyr/kernel/fatal.c:30
30              for (;;) {
(gdb) bt
#0  arch_system_halt (reason=reason@entry=20) at /home/life/Develop/platform/zephyr-project/zephyr/kernel/fatal.c:30
#1  0x00003ebc in k_sys_fatal_error_handler (reason=reason@entry=20, esf=esf@entry=0x20001420 <z_interrupt_stacks+1984>)
    at /home/life/Develop/platform/zephyr-project/zephyr/kernel/fatal.c:44
#2  0x00003f78 in z_fatal_error (reason=reason@entry=20, esf=esf@entry=0x20001420 <z_interrupt_stacks+1984>) at /home/life/Develop/platform/zephyr-project/zephyr/kernel/fatal.c:119
#3  0x00001654 in z_arm_fatal_error (reason=20, esf=0x20001420 <z_interrupt_stacks+1984>, esf@entry=0x20001430 <z_interrupt_stacks+2000>)
    at /home/life/Develop/platform/zephyr-project/zephyr/arch/arm/core/fatal.c:86
#4  0x00001a50 in z_arm_fault (msp=<optimized out>, psp=<optimized out>, exc_return=<optimized out>, callee_regs=<optimized out>)
    at /home/life/Develop/platform/zephyr-project/zephyr/arch/arm/core/cortex_m/fault.c:1157
#5  0x00001b2c in z_arm_usage_fault () at /home/life/Develop/platform/zephyr-project/zephyr/arch/arm/core/cortex_m/fault_s.S:102
#6  <signal handler called>
#7  0xfffffb60 in ?? ()
#8  0x00005300 in main () at /home/life/Develop/test/rp/src/main.c:6
(gdb) 

Minimal reproducible example:

pj.conf

CONFIG_LOG=y
CONFIG_THREAD_STACK_INFO=y
CONFIG_DEBUG_COREDUMP=y
CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y

CMakeLists.txt

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

project(test)

target_sources(app PRIVATE src/main.c)

add_subdirectory(lib)

target_link_libraries(app PRIVATE lib)

src/main.c

#include <stdio.h>
#include "test.h"

int main(void)
{
  test();
  return 0;
}

lib/test.c


int test()
{
  return 0;
}

lib/test.h

int test();

lib/CMakeLists.txt

cmake_minimum_required(VERSION 3.20.0)
project(lib)

add_library(lib STATIC
    test.c
)

target_include_directories(lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

Log:

[00:00:02.094,66*** Booting Zephyr OS build v3.7.0-4638-g9d0486e3ee86 ***
[00:00:00.340,850] <err> os: ***** MPU FAULT *****
[00:00:00.340,850] <err> os:   Instruction Access Violation
[00:00:00.340,881] <err> os: r0/a1:  0x00000000  r1/a2:  0x20000690  r2/a3:  0x20000690
[00:00:00.340,881] <err> os: r3/a4:  0x00000000 r12/ip:  0x200019d8 r14/lr:  0x00005301
[00:00:00.340,911] <err> os:  xpsr:  0x61000000
[00:00:00.340,911] <err> os: Faulting instruction address (r15/pc): 0xfffffb60
[00:00:00.340,942] <err> os: >>> ZEPHYR FATAL ERROR 20: Unknown error on CPU 0
[00:00:00.340,972] <err> os: Current thread: 0x20000690 (unknown)
[00:00:00.402,862] <err> coredump: #CD:BEGIN#
[00:00:00.407,958] <err> coredump: #CD:5a4502000300050014000000
[00:00:00.414,611] <err> coredump: #CD:4102004400
[00:00:00.420,074] <err> coredump: #CD:00000000900600209006002000000000d81900200153000060fbffff00000061
[00:00:00.430,175] <err> coredump: #CD:4819002000000000000000000000000000000000000000000000000000000000
[00:00:00.440,216] <err> coredump: #CD:00000000
[00:00:00.445,465] <err> coredump: #CD:4d010000000020a0190020
[00:00:00.451,965] <err> coredump: #CD:a92600004d5b0000746800000101040000000200835e00000000000000000000
[00:00:00.462,036] <err> coredump: #CD:00000020a019002000000000000000001123000041230000652200003d220000
[00:00:00.472,106] <err> coredump: #CD:5122000000c20100000103000000000000000000192800000000000000000000
[00:00:00.482,208] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:00.492,279] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:00.502,349] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000008000000
[00:00:00.512,420] <err> coredump: #CD:ff000000010000000300000001000000d0000020d00000200001000100010001
[00:00:00.522,521] <err> coredump: #CD:6000000060000000600000006000000003000000875b0000295b0000b0010020
[00:00:00.532,592] <err> coredump: #CD:000100000000000008010020080100200100000001000000000000001c010020
[00:00:00.542,663] <err> coredump: #CD:1c01002001000000010000005158613cbc080020900600200000000000800e00
[00:00:00.552,734] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:00.562,805] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:00.572,875] <err> coredump: #CD:300c002000000000880100208801002060090020000300001000000000000000
[00:00:00.582,946] <err> coredump: #CD:540c0020000000000000000000000000409c0000c8670000b93d000000000000
[00:00:00.593,048] <err> coredump: #CD:0301000005700000cd0100200235343063303032303030303030303030303030
[00:00:00.603,118] <err> coredump: #CD:3030303030303030303030303034303963303030306338363730303030623933
[00:00:00.613,220] <err> coredump: #CD:64303030303030303030303030000000409c0000c8670000e94b000000000000
[00:00:00.623,291] <err> coredump: #CD:03010000057000002d0200200230333031303030303035373030303030636430
[00:00:00.633,361] <err> coredump: #CD:3130303230303233353334333036333330333033323330333033303330333033
[00:00:00.643,463] <err> coredump: #CD:30333033303330333033303330000000409c0000c8670000334d0000266c0000
[00:00:00.653,533] <err> coredump: #CD:03010000057000008d0200200233303330333033303330333033303330333033
[00:00:00.663,604] <err> coredump: #CD:3033303330333033343330333936333330333033303330363333383336333733
[00:00:00.673,675] <err> coredump: #CD:30333033303330363233393333000000409c0000c86700007e4e000000000000
[00:00:00.683,746] <err> coredump: #CD:0301000005700000ed0200200236343330333033303330333033303330333033
[00:00:00.693,817] <err> coredump: #CD:3033303330333030303030303034303963303030306338363730303030653934
[00:00:00.703,887] <err> coredump: #CD:62303030303030303030303030000000409c0000c8670000c84f000002343130
[00:00:00.713,958] <err> coredump: #CD:03010000057000004d0300200230333031303030303035373030303030326430
[00:00:00.724,029] <err> coredump: #CD:3230303230303233303333333033313330333033303330333033353337333033
[00:00:00.734,130] <err> coredump: #CD:33333533333337333333303333003135409c0000c86700001251000066303030
[00:00:00.744,201] <err> coredump: #CD:0301000005700000ad0300200233333333333533333333333333373333333333
[00:00:00.754,272] <err> coredump: #CD:3333303333333330303331333534303963303030306338363730303030313235
[00:00:00.764,343] <err> coredump: #CD:31303030303636333033303330003030409c0000c8670000425f000030303030
[00:00:00.774,414] <err> coredump: #CD:03010000057000000d0400200230333031303030303035373030303030616430
[00:00:00.784,484] <err> coredump: #CD:3330303230303233333333333333333333333533333333333333333333333333
[00:00:00.794,586] <err> coredump: #CD:33333733333333333333333333006430409c0000c86700008c60000030313930
[00:00:00.804,656] <err> coredump: #CD:03010000057000006d0400200233333333333033333333333333333330333033
[00:00:00.814,727] <err> coredump: #CD:3333313333333533343330333936333330333033303330363333383336333733
[00:00:00.824,798] <err> coredump: #CD:30333033303330333133323335003335409c0000c8670000d661000030303030
[00:00:00.834,869] <err> coredump: #CD:0301000005700000cd0400200233313330333033303330333633363333333033
[00:00:00.844,940] <err> coredump: #CD:3333303333333030303330333034303963303030306338363730303030343235
[00:00:00.855,010] <err> coredump: #CD:66303030303330333033303330003132409c0000c86700002063000030336432
[00:00:00.865,081] <err> coredump: #CD:03010000057000002d0500200230333031303030303035373030303030306430
[00:00:00.875,152] <err> coredump: #CD:3430303230303233303333333033313330333033303330333033353337333033
[00:00:00.885,223] <err> coredump: #CD:3333353333333733333330333300393242000000303030303030303030303030
[00:00:00.895,324] <err> coredump: #CD:30303030300000002a0000000000000000000000000000000000000000000000
[00:00:00.905,395] <err> coredump: #CD:0000000000000000000000000000000048ee0000000000000000000000000000
[00:00:00.915,466] <err> coredump: #CD:00000000000000000000000000000000d0050020d0050020ad0b000000000000
[00:00:00.925,537] <err> coredump: #CD:00000000000000000000000000000000492e000000000000ffff7f0000000000
[00:00:00.935,607] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000001000f00
[00:00:00.945,678] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:00.955,749] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:00.965,850] <err> coredump: #CD:7015002000000000680600206806002060140020400100001000000000000000
[00:00:00.975,891] <err> coredump: #CD:9415002000000000000000000000000030010020bc0800200000000001800000
[00:00:00.985,992] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:00.996,063] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:01.006,164] <err> coredump: #CD:7019002000000000e8060020e8060020a0150020000400001000000000000000
[00:00:01.016,235] <err> coredump: #CD:9419002000000000000000000000000000000000000000000000000001010000
[00:00:01.026,306] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:01.036,407] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:01.046,478] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:01.056,549] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000000000000
[00:00:01.066,650] <err> coredump: #CD:00000000000000000000000000000000e0000020000000000000000000000000
[00:00:01.076,721] <err> coredump: #CD:0100000001000000008000000000000000000000000000000000000000000000
[00:00:01.086,822] <err> coredump: #CD:010000000000000074680000000000009419002048190020a9260000a0190020
[00:00:01.096,893] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000001000000
[00:00:01.106,994] <err> coredump: #CD:00000000000000000000000000000000d4680000000000000000000000000000
[00:00:01.117,065] <err> coredump: #CD:000000000000000000000000d468000000000000020001000000000000000000
[00:00:01.127,136] <err> coredump: #CD:0100000000000000fd5900004200000000000000000000000000000000000000
[00:00:01.137,207] <err> coredump: #CD:0000000000000000000000000000000000000000010000000000000069250000
[00:00:01.147,277] <err> coredump: #CD:0100000000000000601400209006002010060020000000009006002090060020
[00:00:01.157,348] <err> coredump: #CD:300100200000000000000000000000000000000001010a000000009006002090
[00:00:01.167,419] <err> coredump: #CD:06002000000000d81900200153000060fbffff00000061481900200000000000
[00:00:01.177,490] <err> coredump: #CD:0000000000000000000000000000000000000000000000000000000230303030
[00:00:01.187,561] <err> coredump: #CD:3030303033333333333333333333333333333333333333333333333333333333
[00:00:01.197,631] <err> coredump: #CD:3333333333333333333333333333333333333333333333333333333300010000
[00:00:01.207,702] <err> coredump: #CD:af396e8fe45f01e3ce7fe3fac1803088d754fe1f11f88c007f5bbbf53a895823
[00:00:01.217,803] <err> coredump: #CD:ddf7ebbf23420000fdc7af5c488d801b4577d2ffa7016090d6f63b0f04027000
[00:00:01.227,874] <err> coredump: #CD:bdf9eeed24084291bddfbeed11461200a7af62fb8080e388df6db2ff8800a181
[00:00:01.237,945] <err> coredump: #CD:cc5ffff70001410451787f51422a4989e1ff5acb8049c300fe66fbf340c38c02
[00:00:01.247,985] <err> coredump: #CD:6f755fffc08820c6ee6ff6fda0996308265feebb035081c17c5d6b67b33d8022
[00:00:01.258,087] <err> coredump: #CD:e2f7df7610048115fbdd2ff203001048fb5eb87dcd601048c95fb97448c04410
[00:00:01.268,157] <err> coredump: #CD:95fc2db300570821fbefdf9a019122a9ffbdf95b63008501a9787b0405c01b10
[00:00:01.278,228] <err> coredump: #CD:462fe38f02430142edb84a690195400ccfdb2877a35a1534ff7ffe6538b20030
[00:00:01.288,299] <err> coredump: #CD:f9fc997b430a2790a6efffeda90443fafdefbfd950cc74cedef7dbf703003155
[00:00:01.298,400] <err> coredump: #CD:af3fd7dfe1616d081f6bd7f9d2d90892fbaffadf08058401adcf14f32d26d9a0
[00:00:01.308,471] <err> coredump: #CD:5f9afeb7980001f85791d6cf02a8a0085d7eef97d20d642277e9efdd4d0a4920
[00:00:01.318,542] <err> coredump: #CD:ffe7ef13cf110614fffbffe8040b3072fb1fb77689608452cffdeff96904c086
[00:00:01.328,643] <err> coredump: #CD:ef777ff7091aa0877f5d6ddb2b110688e63a75ff87ce214131232dff20856203
[00:00:01.338,684] <err> coredump: #CD:ae03675c0142944027bf7bcb068a7050b3c1c94e4c328501ff3bc28f540f2c40
[00:00:01.348,754] <err> coredump: #CD:b4c3bdbb08702440d69c7b2d100858a4b1ca6df5032100007f9ebef7828b0c11
[00:00:01.358,856] <err> coredump: #CD:ffeea736a23682103abffa37181201259e5fed7701322064affff77d459a4005
[00:00:01.368,896] <err> coredump: #CD:7ff3dbfe0489254cd9bffce132a01650a6fed2d73033484d67c9f7dd738018c0
[00:00:01.378,997] <err> coredump: #CD:b6e5db2244800442aff63fff40800101332db6ba04329084f73997f2100cc46c
[00:00:01.389,068] <err> coredump: #CD:34feed7d405080d68be6b8fd02308153bf7966cda0a31a047addbff540102c0b
[00:00:01.399,169] <err> coredump: #CD:a9fdf477231290409715df47bf991a0dfdb8eaad11125aaa5f3ffea741544806
[00:00:01.409,210] <err> coredump: #CD:ce79997f42d49e003ab7de8ab4108281fbffb5e502c6023356af3369004d0509
[00:00:01.419,311] <err> coredump: #CD:cf0f291e0116e14d371fffbf568320417ee9fb4e00a88688face8b1f404943a5
[00:00:01.429,382] <err> coredump: #CD:e3af9ffe332000013bddbfb39092c440b10e0000000000000000000000000000
[00:00:01.439,453] <err> coredump: #CD:bd767f7f544042109c08000000000001ff6b7fdfb44044ca9fe5fd9600000000
[00:00:01.449,523] <err> coredump: #CD:afb6fbef4298c870e99c2837466f705e7335ff4fb9065710bafbef8f524e9601
[00:00:01.459,594] <err> coredump: #CD:fc3fff9d828748c0d9b3fff7200b2349befa24cf27a912c2fb607fe635140868
[00:00:01.469,665] <err> coredump: #CD:dd5f7eee00c809076dadadf40811e3c8b4e8bf3e5432d8817d75751f202180cb
[00:00:01.479,736] <err> coredump: #CD:e2bffd3a620ad308defd75e6b0240e08d7da3fd30522c00001ea3ffca021662c
[00:00:01.489,807] <err> coredump: #CD:eeffee3f1420aa98732b7f5b6bc499a97ffc1bf480384a5017ebaddda503c830
[00:00:01.499,908] <err> coredump: #CD:fd6b27f5240016486f19d36f12098003af93d12d11022248f6af8ffb010000c4
[00:00:01.509,979] <err> coredump: #CD:dff4d5ef05e818c546d7bd69114120140fdf7f574412d04056ed27f409d1808a
[00:00:01.520,050] <err> coredump: #CD:1677ffe74190c080d678ef6690c1980979b15de782a000134e0feb975288c0d0
[00:00:01.530,120] <err> coredump: #CD:56e977e309145170fcbbf8fda068b000f77bdff64a1a911027bdfefa58802146
[00:00:01.540,222] <err> coredump: #CD:a5f98df410660861d7f6fddfc0212f395fefc23a0228c112d77fb93612244cb6
[00:00:01.550,262] <err> coredump: #CD:ff99dfe71109d401377cfdaccee0d4117ddedf6f43d92d46f0deebfd91d4c588
[00:00:01.560,363] <err> coredump: #CD:76fff79d0848880aff1ca7f4984b065563f28fca0930c464e363381328103006
[00:00:01.570,434] <err> coredump: #CD:7735fbfc09068f42769e27e84a100a51b9bfdf93712000001dbfef4c5a12c400
[00:00:01.580,505] <err> coredump: #CD:bef49c3e945b1988dfb7f47f2462c00077fa737f06404030dc3f5bf300008842
[00:00:01.590,576] <err> coredump: #CD:c5399dff1414deadeb5ffe7f05b08a01afffeae6802108e07df7b857210726e1
[00:00:01.600,646] <err> coredump: #CD:f7b3edef4696508cff97dece3a104000dfb7d7f12a42066467797eaf41056102
[00:00:01.610,717] <err> coredump: #CD:6ed779b113c1180da56bfd7d02254098a7565d7d60fb9643eff9fbf630ac8080
[00:00:01.620,819] <err> coredump: #CD:e573f9f8388466142e1def7f0588c425f869ee370c480021dffcf5b35982a2e0
[00:00:01.630,889] <err> coredump: #CD:e77feeff960cc0a1ddf5eda9028288154fdd7be9a41132a81fdbe9fe2240ac58
[00:00:01.640,960] <err> coredump: #CD:3b6bafb014168820cf9f47cb01cd902570f95b9a51101c016ef43bef04840000
[00:00:01.651,031] <err> coredump: #CD:54fd9ae70d97cb92cf3df34d850a0131e5d7fd5f3031c580c6d864a314acc103
[00:00:01.661,102] <err> coredump: #CD:ff57f87750aa425037fbfefe0c8e2012bffdbf5d15940302ff396f7660801015
[00:00:01.671,173] <err> coredump: #CD:7c5593f73118659db9f69fbd849030c0ee65bfcc51700bfd7dfdfedb42519747
[00:00:01.681,243] <err> coredump: #CD:e7e7debd085861843dfd5bb989835288bfa6e9ef81cb0828588dfefb08183908
[00:00:01.691,314] <err> coredump: #CD:bbeffbff0062536093efc66e0b000084c5fdf6da08028282f6365ffb9300dc74
[00:00:01.701,385] <err> coredump: #CD:fbb787eb9a601121b6f77dfeb1006a06f4fb6b61102b0206b23ccef601c43060
[00:00:01.711,486] <err> coredump: #CD:db9de62f422278305ff33f3760100078fff3dd7f04ac5182737f9fe900024524
[00:00:01.721,527] <err> coredump: #CD:7fc63f9f20e0a0851bf1f33f90631104bd2ceedf0023c0113eff727340080c05
[00:00:01.731,597] <err> coredump: #CD:ddf9df3e200a9090000000800000000000000000000000000000000001000020
[00:00:01.741,668] <err> coredump: #CD:ff27ef845092806165ffdfdf26c12008fafadb72b580d6c0f799ffe59aeb8482
[00:00:01.751,739] <err> coredump: #CD:fe0fca6d0012a092765e577f1e22a640f3cfec6e34186064a670377bbac8886a
[00:00:01.761,810] <err> coredump: #CD:ff6e7fb2d8481634d76cfd5f46054239ffe8f64210081877e6c7d0de0494c218
[00:00:01.771,911] <err> coredump: #CD:7db87f8e15020512fbff4f136008dde11dfdddec50491047e35f7e3e4c018492
[00:00:01.781,982] <err> coredump: #CD:ff7ec9471000623add7af3bec8849a2dfedf583f1507434df73bdeff89c48820
[00:00:01.792,053] <err> coredump: #CD:bfffebb6d08061b0f0ab3fa6fe84a548affbf79538010519ff9fe6bec0491042
[00:00:01.802,124] <err> coredump: #CD:b8e73fbf0c05443efd5bee7f2e8238e0bfdf73bba3405108b7bffd3f02000110
[00:00:01.812,225] <err> coredump: #CD:fac4c7ff024051321f5ef9ac4dc48193f5efdffb000742089eed6bfba2091189
[00:00:01.822,296] <err> coredump: #CD:7ef3ebf7e30161c23b4ffeed10e80190ffdfb6ff902302089ed4a1bb3b72d866
[00:00:01.832,366] <err> coredump: #CD:cfe7efd302980414b065ffde03028e9afb61efab84e0a086d3fcdbfb0f010a63
[00:00:01.842,437] <err> coredump: #CD:b77ff9f701882c40d92b0000d708002001000000d708002024660000ab150000
[00:00:01.852,539] <err> coredump: #CD:7468000001000000d60800208d15000074680000995c0000746800007c680000
[00:00:01.862,609] <err> coredump: #CD:0a0000000a000000b95c0000b15c00007c680000cf5c0000b95c000002000000
[00:00:01.872,680] <err> coredump: #CD:481200207f5e0000775e0000734e0000b95c000004000000775e00000a6b0000
[00:00:01.882,781] <err> coredump: #CD:775e000061500000303836000a6b0000775e00000b7000003631320004000000
[00:00:01.892,852] <err> coredump: #CD:775e0000086b0000481200207c680000b95c000000000000e803000001000000
[00:00:01.902,954] <err> coredump: #CD:377000000b21000000000200775e00000000000000000000b95c00007c680000
[00:00:01.913,024] <err> coredump: #CD:000002007c680000230000000f00000013000000091200007c68000048120020
[00:00:01.923,126] <err> coredump: #CD:ed120000086b0000d92b0000d708002001000000d708002024660000ab150000
[00:00:01.933,197] <err> coredump: #CD:7468000001000000d60800208d15000074680000995c0000746800007c680000
[00:00:01.943,267] <err> coredump: #CD:7c680000010000000f000000b15c00008e0300206b5d00000000000001000000
[00:00:01.953,338] <err> coredump: #CD:a0030020ee030020e0000020115500002000000008010020200000001b420000
[00:00:01.963,439] <err> coredump: #CD:b007002010680000f0030020e90d000020000000409c000000000000750f0000
[00:00:01.973,510] <err> coredump: #CD:e0000020a800000050040020171100000a000000141300200400000017110000
[00:00:01.983,581] <err> coredump: #CD:4e00000000000000c86700000e0000001600000041000000c8670000c0040020
[00:00:01.993,652] <err> coredump: #CD:4e0000004e00000026000000201300207013002080060000701300201c090020
[00:00:02.003,753] <err> coredump: #CD:057000003f13002000000000f9220000057000001a09002000000000f9220000
[00:00:02.013,824] <err> coredump: #CD:03000001057000001c0900200002002000000020a019000090060020d8130020
[00:00:02.023,895] <err> coredump: #CD:00000000d813002005000000c7210000000000004d010000000020a019002000
[00:00:02.033,996] <err> coredump: #CD:410200442800002014000000e3210000201400202d220000f81300205a450200
[00:00:02.044,067] <err> coredump: #CD:0300050014000000900600201400000020140020713f00000000000020140020
[00:00:02.054,107] <err> coredump: #CD:d013002014000000f8130020e0130020f8130020551600006819002040140020
[00:00:02.064,178] <err> coredump: #CD:0000000018140020040800000800000000000000511a0000000000000f000000
[00:00:02.074,279] <err> coredump: #CD:00000000900600209006002000000000d81900200153000060fbffff00000061
[00:00:02.084,350] <err> coredump: #CD:b8670000b86700005763000000000000000000002d1b000060140020fdffffff
[00:00:02.094,421] <err> coredump: #CD:77f5863b0492a502eef6fe9d30210a0ceebf5ff485419001673fbfdf1800a800
[00:00:02.104,492] <err> coredump: #CD:6bf6b3fb809451307bfff62f5120490af72bd9c387a010a07d95fff54e6d8366
[00:00:02.114,593] <err> coredump: #CD:9bfd9e3fa8400202beadffff54c04909fb7f5b812042f00dfdba6f504e888478
[00:00:02.124,664] <err> coredump: #CD:db2bfff79900a900f31e5ffa594446028cdfd7f721d004283fd6562f0489d400
[00:00:02.134,735] <err> coredump: #CD:fbfe0e7e2309038237fdd2ad924807a27efddf0644612140bbadbd790430cc60
[00:00:02.144,805] <err> coredump: #CD:ceff37bf83104100f7b6fb1f443ee65193feff1f66130339cff18e87443110d0
[00:00:02.154,876] <err> coredump: #CD:1f85ffdf2c2c4f137beeff6b2a011d109aff51a7a5c59206ffb16a6fc2104820
[00:00:02.164,978] <err> coredump: #CD:3ef2f7ee0cad61de3ff1bfeb2e722a61f68bbfc958808044feea4edd12a45813
[00:00:02.175,048] <err> coredump: #CD:ed66ffee084900c2edf8c6ffc380a2a3e5610000a40800200000000000000000
[00:00:02.185,119] <err> coredump: #CD:fde975b64c7101049c08000000000001f9f75ed770086606ffb94f3b00000000
[00:00:02.195,220] <err> coredump: #CD:766b7b6e16916a20efbe5ed79083204ae7c75a67b52024c3de18c7bf181a8094
[00:00:02.205,322] <err> coredump: #CD:f4b5aef8b000514bfffdefffa8304ae66bffb74fa22142a2ffb71deb6e348034
[00:00:02.215,393] <err> coredump: #CD:daf79be791742c00d336df6ab04260629fe97bde38009047ffecee3f04d020c0
[00:00:02.225,494] <err> coredump: #CD:b6efdfb7d504748997f7d7661ad11c800befffde3a0052e5bae77f59a84290c1
[00:00:02.235,565] <err> coredump: #CD:b7afdcbe4d3bb381db53f36b48608900b253504b187109587ce474ac900a1186
[00:00:02.245,635] <err> coredump: #CD:f776fde673003e609bffdc9b69290104a3bd5d8020004404d7bd35f120081526
[00:00:02.255,706] <err> coredump: #CD:f7f6bcde85812202cb5ab5e24068664dfcd79cf065308ca79c83bfb2064cb580
[00:00:02.265,808] <err> coredump: #CD:d4d75f399004b2aefffacb7f880700007ff3ffb00804cc838fabcfff4018e327
[00:00:02.275,878] <err> coredump: #CD:fbfe1dfb2c422216ffeacadf1014b902fd2f45df8520c080a59f3f3e98411360
[00:00:02.285,980] <err> coredump: #CD:5b7f5fba14334158efdeff3f446c9220cb3bffed2217092c2df77c5b41ac4428
[00:00:02.296,051] <err> coredump: #CD:f8a7ecbf01241d609de51feb888a2546f7ea6bc83c407b398b77bbaea0051130
[00:00:02.306,152] <err> coredump: #CD:cfb7ae779cc11a03fbf4dbdea423db04768b6ae348380108df6759fbe6203a70
[00:00:02.316,223] <err> coredump: #CD:e7fbfbfb40654a52fad598dba840011485bdd67d200b1027f5ee43cf9a0410c0
[00:00:02.326,293] <err> coredump: #CD:f5f5ddde802393843f97faf59084810afd5af6ffce214517eef799d2020095e8
[00:00:02.336,395] <err> coredump: #CD:c7fddf7c001512902343daaa31c0b284ffeffbf325c2800af415af515181823e
[00:00:02.346,466] <err> coredump: #CD:e7fefdbb8001666a377f6bbd244b8804c796ffbc83049e81ede137be71104a22
[00:00:02.356,536] <err> coredump: #CD:964d7dff41521af2e367ad3b08c81c00a7377d6c021000001fa7b9f7426a2100
[00:00:02.366,607] <err> coredump: #CD:fbc75e31160c6480faf277ed100a130971fdfc936a4aa408fff7020d560a0cb1
[00:00:02.376,678] <err> coredump: #CD:bff2aaff02069899eeedeefc1d0779a8b37fe7fd23650a30b73fffffcd260858
[00:00:02.386,749] <err> coredump: #CD:fdebfa6f5904c291ddee7d9f9840000af0e99dbf0434360bfbb35f3e430ba801
[00:00:02.396,850] <err> coredump: #CD:ee5faeb26544cc583ff3ededf64003203e47b6bca228b739dbfd3e7fe0004254
[00:00:02.406,921] <err> coredump: #CD:abffff5f64188c925eff779f30418c45e6ef2f77660901134fc5bf0f69c21020
[00:00:02.416,992] <err> coredump: #CD:1fd6cf9f2b2c12b2cf61f8c71404412c776a751b080385202eb6eace13e68010
[00:00:02.427,093] <err> coredump: #CD:9171000041feffdf0000000000000000000000000100000048feffdfa02088a8
[00:00:02.437,133] <err> coredump: #CD:e000002041570000000000000003000000000000000000000001000000000000
[00:00:02.447,204] <err> coredump: #CD:0000000000100000b00100200800000091710000000000005419002000000000
[00:00:02.457,275] <err> coredump: #CD:00000000c3110000541900205343000000000000000000000000000054190020
[00:00:02.467,346] <err> coredump: #CD:ff000000e0000020b001002003580000b0010020b8670000e000002000000000
[00:00:02.477,447] <err> coredump: #CD:b8670000815b000000000000000000009171000054190020b867000097540000
[00:00:02.487,518] <err> coredump: #CD:917100005419002000000000900600209006002000000000d819002001530000
[00:00:02.497,589] <err> coredump: #CD:60fbffff00000061b0d7fff103d80504000000009419002094190020e13f0000
[00:00:02.507,659] <err> coredump: #CD:00000000c3080000e13f0000571d0000cff9efa3068886040000000090060020
[00:00:02.517,700] <err> coredump: #CD:END#
[00:00:02.522,583] <err> os: Halting system
zhang-wenchao commented 1 month ago

This problem is very strange, torture me for a day. It looks like the problem is on the RP2040 board. I'm not sure, because it crash with static links? Perhaps Zephyr has other problems.

zhang-wenchao commented 1 month ago

Request investigation, Ask for investigation, I recovered on my nrf52840_mdk, the same problem.

west build -p always -b nrf52840_mdk
west flash
zhang-wenchao commented 1 month ago

I also have an ESP32C3, there is no problem, normal. I think the problem may appear on ARM compilation or DAPLink or OpenOCD. Perhaps this is a dual-core problem.

zhang-wenchao commented 1 month ago

Where can this problem be a problem? Request to improve priority.

zhang-wenchao commented 1 month ago

frdm_k64f I also have a FRDM-K64F, which is also this error, which looks like all ARMs will be like this.

zhang-wenchao commented 1 month ago

Breakpoint 1, main () at /home/life/Develop/test/rp/src/main.c:6
6         test();
(gdb) stepi
test () at /home/life/Develop/test/rp/lib/test.c:2
2       {
(gdb) stepi
0x00000412 in test () at /home/life/Develop/test/rp/lib/test.c:2
2       {
(gdb) stepi
0xfffffe70 in ?? ()
(gdb) stepi
z_arm_usage_fault () at /home/life/Develop/platform/zephyr-project/zephyr/arch/arm/core/cortex_m/fault_s.S:80
80              mrs r0, MSP
(gdb) 
nordicjm commented 1 month ago

Did you try using https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/application_development/external_lib ? Because this is tested and works

zhang-wenchao commented 1 month ago

This makes me difficult to understand, because it is just a empty test function. Arm can't, risc-v ok.

nordicjm commented 1 month ago
*** Booting Zephyr OS build v3.7.0-4639-g861fdae65dfc ***
Hello World!
mylib says: Hello World!

on nrf5340dk (arm cortex m33) so works fine

zhang-wenchao commented 1 month ago

I have positioned some questions,

zephyr_get_compile_options_for_lang_as_string(           C options)

Use options:

add_library(lib STATIC
    test.c
)

target_compile_options(lib PRIVATE -fno-strict-aliasing -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=/home/life/Develop/platform/zephyr-project/sdk/zephyr-sdk-0.16.8/arm-zephyr-eabi/arm-zephyr-eabi -imacros /home/life/Develop/platform/zephyr-project/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wformat -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/life/Develop/test/rp=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/life/Develop/platform/zephyr-project/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/life/Develop/platform/zephyr-project=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -std=c99)

It's ok, The reason is that the compilation option is not applied to add_subdirectory (lib)

zhang-wenchao commented 1 month ago

@nashif I don't know who can help me. Excuse me.

zhang-wenchao commented 1 month ago

I temporarily solved this problem.

# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(app)

zephyr_get_compile_options_for_lang_as_string(C options)

# get_cmake_property(_variableNames VARIABLES)
# foreach (_variableName ${_variableNames})
#   message(STATUS "${_variableName}=${${_variableName}}")
# endforeach()

target_sources(app PRIVATE src/main.c
)

add_subdirectory(crypto)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(app PRIVATE crypto)
add_library(lib STATIC
    test.c
)

message(STATUS "Zephyr Log: ${options}")

string(REGEX REPLACE "\\$<SEMICOLON>\\$<TARGET_PROPERTY:compiler,imacros>\\$<SEMICOLON>[^$]+/autoconf\\.h" "" options "${options}")

separate_arguments(options_list UNIX_COMMAND "${options}")
message(STATUS "Options list: ${options_list}")

target_compile_options(crypto PRIVATE ${options_list})

Use cmake add_subdirectory(lib) scene is very many, I think it is necessary to create an example.