This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Softdevice S132 3.1.0 on NRF52840 in CrossStudio 3.7.4

Downloaded the S132 from the NRF52840 site and loaded it onto the NRF52840DK board using NRFgo studio.

Then created a new project in CrossStudio. Imported the memory map and changed the flash start to 0x0001f000 and RAM start to 0x200019c0 as per the S132 documentation.

The only code in the project is this :

uint32_t error_code = 0; nrf_clock = { .source = NRF_CLOCK_LF_SRC_RC, .rc_ctiv = 16, .rc_temp_ctiv = 2, .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM};

// Initialize SoftDevice. error_code = sd_softdevice_enable(&nrf_clock, softdevice_fault_handler);

Running full speed, or stepping through gives the same result. If stepping into the function call into softdevice I can see from the CPU registers that an SVC interrupt is called, but only after a few assembly instructions it jumps to Hardfault ( Not my error handler ) and stays there.

I've tried several softdevice functions, but they all lead to the same assembly instructions and shortly thereafter hardfault.

Assuming that there is nothing wrong with softdevice, but something else that is causing this issue.. Anyone experienced the same problems using CrossStudio, is there any particular settings that needs to be set in order for this to work ?

The final two instructions before hardfault are ldr r2, [r2] and then the bx r2 which leads to hardfault. ( Located around 0x0000092e approx ).

Parents
  • Ok. Seems to be working here. I didn't start totally from scratch though. I installed the nRF5 CPU Support Package Version 3.5. I'm not sure if you did that. I used the same memory settings as you did. In addition I changed the following things:

    • Add "nonexistant" in Entry PointSymbol.
    • Add STARTUP_FROM_RESET in Preprocessor Definitions.
    • Change Can Erase All to "No" in Target Loader Options.

    According to this. I guess this also could be of help.

Reply
  • Ok. Seems to be working here. I didn't start totally from scratch though. I installed the nRF5 CPU Support Package Version 3.5. I'm not sure if you did that. I used the same memory settings as you did. In addition I changed the following things:

    • Add "nonexistant" in Entry PointSymbol.
    • Add STARTUP_FROM_RESET in Preprocessor Definitions.
    • Change Can Erase All to "No" in Target Loader Options.

    According to this. I guess this also could be of help.

Children
  • Finally! The nonexistant did the trick. Before when adding this the execution started at 0x212B0 ( my application init code ), but when adding the nonexistant to the entry pointsymbol it starts at 0x8E4 ( inside softdevice )...

    After googling "nonexistant + rowley" I found some information that this is necessary to make sure execution starts in softdevice, and not my application, so fits with what I saw when running with/without nonexistant.

    But anyways, thanks alot!

Related