apache / mynewt-core

An OS to build, deploy and securely manage billions of devices
https://mynewt.apache.org/
Apache License 2.0
813 stars 365 forks source link

nrf51.cpu -- clearing lockup after double fault #2769

Open atoncetti opened 2 years ago

atoncetti commented 2 years ago

Running apache-mynewt-nimble/apps/bleprph app on a micro:bit v1 yields the following problem:

$ newt run myperiph 0
App image successfully generated: ...
Loading app image into slot 1  ...
; nrf51.cpu configure -event gdb-detach {if {[nrf51.cpu curstate] eq "halted"} resume;shutdown}
GNU gdb (GNU Arm Embedded Toolchain 10.3-2021.10) 10.2.90.20210621-git

--Type <RET> for more, q to quit, c to continue without paging--

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ...
0xfffffffe in ?? ()
target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0xfffffffe msp: 0xfffffffc
0xfffffffe in ?? ()
target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0xfffffffe msp: 0xfffffffc
(gdb) c
Continuing.
nrf51.cpu -- clearing lockup after double fault

Program received signal SIGINT, Interrupt.
0xfffffffe in ?? ()

Setup:

# target.yml
target.app: "@apache-mynewt-nimble/apps/bleprph"
target.bsp: "@apache-mynewt-core/hw/bsp/bbc_microbit"
target.build_profile: optimized
# syscfg.yml
syscfg.vals:
      LOG_LEVEL: 255
      BLE_LL_CFG_FEAT_LE_ENCRYPTION: 0
      BLE_SM_LEGACY: 0
      BLE_SM_SC: 0
# project.yml

...

repository.apache-mynewt-core:
    type: github
    vers: 0-dev
    user: apache
    repo: mynewt-core

The same problem occurs with other example apps.

OancaAndrei commented 1 week ago

Hi, had a similar issue, from what I could gather you need to load both the bootloader and your app. When you halt reset your device you can see that pc is pointing at 0xfffffffe when it should be something more like 0x000000c0.

In the tutorials you'll find that there are two targets that need to be created, built and uploaded onto the device.

You've created the app but you might be missing the nrf51_boot target. This is at least what solved my issue.