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

Running NRF52 binary in Renode simulator

Renode (https://renode.io/ and https://github.com/renode/renode) is an open source simulator and used by Zephyr OS for example to validate binaries for different architectures.

I would like to use Renode as well, however I'm stuck as soon as the softdevice is initialized. I created github.com/.../renode-nrf52 which contains all the scripts, binary files, instructions and verbose logs that are needed to reproduce the issue.

As it's possible to use gdb, I did that:

(gdb) target remote :3333
Remote debugging using :3333
SVC_Handler () at ../../../../../../modules/nrfx/mdk/gcc_startup_nrf52.S:328
328 ../../../../../../modules/nrfx/mdk/gcc_startup_nrf52.S: No such file or directory.
(gdb) bt
#0 SVC_Handler () at ../../../../../../modules/nrfx/mdk/gcc_startup_nrf52.S:328
#1
#2 0x0002b596 in sd_softdevice_enable (p_clock_lf_cfg=p_clock_lf_cfg@entry=0x2000ff44, fault_handler=0x27351 ) at ../../../../../../components/softdevice/s132/headers/nrf_sdm.h:322
#3 0x0002b610 in nrf_sdh_enable_request () at ../../../../../../components/softdevice/common/nrf_sdh.c:214
#4 0x0002a2c8 in ble_stack_init () at ../../../main.c:573
#5 main () at ../../../main.c:573

The softdevice is available (loaded at memory position 0) - any hints whats wrong with my example?

  • Hi! 

    Are sure Renode is able to simulate the Softdevice behavior? From what I can see it is not, based on what I see in this GitHub issue. I suggest taking this to the appropriate Renode forum for support there.

    They did recently introduce support for the nRF52840 as indicated by the 1.1.0 release notes, and they are planning to support more Nordic devices in the future. However, from what I can see they do not support any BLE functionality as of now, as stated in the issue I linked above. 

    Best regards,
    Carl Richard

  • Thanks Carl. My plan is to boot my application - but currently Renode just freeze when softdevice is initialized:

    15:06:58.8514 [INFO] cpu: Entering function nrf_sdh_enable_request at 0x534C0
    15:06:58.8515 [NOISY] cpu: Allocated 64B pointer at 0x140561595633392.
    15:06:58.8515 [NOISY] cpu: Allocated is now 98.62MiB.
    15:06:58.8515 [NOISY] cpu: Deallocated a 64B pointer at 0x140561595633392.
    15:06:58.8515 [INFO] cpu: Entering function sd_softdevice_enable (entry) at 0x531D8
    15:06:58.8515 [NOISY] nvic: Internal IRQ 11.
    15:06:58.8515 [NOISY] cpu: IRQ 0, value True
    15:06:58.8516 [NOISY] cpu: Setting CPU IRQ #0 to True
    15:06:58.8516 [NOISY] nvic: Acknowledged IRQ 11.
    15:06:58.8516 [NOISY] cpu: IRQ 0, value False
    15:06:58.8516 [NOISY] cpu: Setting CPU IRQ #0 to False
    15:06:58.8516 [NOISY] cpu: Allocated 64B pointer at 0x140562385098992.
    15:06:58.8516 [NOISY] cpu: Allocated is now 98.62MiB.
    15:06:58.8517 [NOISY] cpu: Loop to itself detected
    15:06:58.8517 [NOISY] cpu: Deallocated a 64B pointer at 0x140562385098992.
    15:06:58.8517 [INFO] cpu: Entering function SVC_Handler (entry) at 0x262E6

    So I don't expect BT functionality yet. Do you have some clues what is essential when the softdevice is initialized, i.e. which peripherals are needed, what kind of while loop are in the init code?

    another question - do you have some mock softdevice implementation?

    Thanks again and have a nice day. 

  • Hi again, Michael!

    The SD will require a LF clock to be present and the error you are seeing seems similar to issues where the LF clock is missing. I'm not sure how that is handled in Renode. We do not have a mock Sofdevice implementation, but you can read about how someone has handled it in this thread (from what I can see they have some handling for the clock aswell).

    On another note, from my understanding Renode is used for the Zephyr RTOS mainly. Have you considered trying this with the nRF Connect SDK, which runs with Zephyr? It's the new generation of our SDK.

    Best regards,
    Carl Richard

Related