Hello,
I’m migrating the project from mbed cli 1 to mbed cli 2. Target is NRF52xxxx. During CMakeLists.txt creation I discovered the following issue. If I add source files in the following order the app inits fine:
target_sources(${APP_TARGET}
PRIVATE
main.cpp
${APPLICATION_SOURCES}
${DRIVERS_SOURCES}
${MIDDLEWARE_SOURCES}
)
But if I swap the order of sources:
target_sources(${APP_TARGET}
PRIVATE
main.cpp
${APPLICATION_SOURCES}
${MIDDLEWARE_SOURCES}
${DRIVERS_SOURCES}
)
Then I’ve got errors on the initialization of one of the Middleware components.
++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x8DE8
Error Value: 0x200032F4
Current Thread: main Id: 0x200021A8 Entry: 0x1512F StackSize: 0x800 StackMem: 0x20002AB0 SP: 0x20003290
The order of sources determines the order of code in the linkage map and in the final application. Further investigation has shown that if I call any function which address is near the 0x0000000000008de8, then I get a hardfault. In the first case, the Middleware module initialization function has the address 0x0000000000008de8. In the second case, this address is occupied by the ToF driver, and if I try to use ToF sensor, the hardfault occurs.
I’ve never seen such type of problem before. Do you have any idea how I should debug this issue? Is it a compiler/linker error or hardware error (broken loading app from flash to RAM)?