C++ and zbus with nrf54l15

I have an application with the nrf52840 that was trying to port to nrf54l15 using ncs 3.2.1 but i ran into various issues. I decided to look into some samples that could help narrow down the problem. The application code is written in C++ for the most part

I started with this sample https://github.com/Toastee0/Seeed-Xiao-nRF54L15/blob/main/bluetooth/ble_button

removed these nodes from the overlay

&bt_hci_controller {
    status = "okay";
};

&bt_hci_sdc {
    status = "okay";
};

to make it actually use the softdevice (which seems counterintuitive) otherwise it would yell about the split link layer

renamed main.c to main.cpp and changed it in the CmakeLists.txt

and added this to the prj.conf

CONFIG_CPP=y
CONFIG_ZBUS
=y
CONFIG_ZBUS_CHANNEL_NAME=y
CONFIG_ZBUS_OBSERVER_NAME=y
CONFIG_ZBUS_RUNTIME_OBSERVERS=y



 It does however work fine if CONFIG_CPP is not set. I can assume something is missing in the linker setup, but I couldn't see where, or why it would be different than with the nrf52840 where i have a very similar set of options, except there I set a specific standard.

I remember having a similiar problem with a pure zephyr project with the esp32 and zbus before this PR was merge https://github.com/zephyrproject-rtos/zephyr/pull/75915/

I get a bus fault when it is set like this

*** Booting nRF Connect SDK v3.2.1-73e28134fde1 ***
*** Using Zephyr OS v4.2.99-c8f087707f57 ***
[00:43:25.740,607] <inf> BLE_Button_Xiao: Starting BLE Button Sample for XIAO nRF54L15
[00:43:25.740,658] <inf> BLE_Button_Xiao: Set up button at gpio@10a000 pin 0
[00:43:25.740,723] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                            14 5e 00 04 a0 74 05 5d  9b 39 61 8b d7 51 28 2a |.^...t.] .9a..Q(*
                                            fa c2 93 b8                                      |....             
[00:43:25.740,928] <err> os: ***** BUS FAULT *****
[00:43:25.740,934] <err> os:   Precise data bus error
[00:43:25.740,938] <err> os:   BFAR Address: 0x4770e74d
[00:43:25.740,949] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000001  r2/a3:  0x00000000
[00:43:25.740,956] <err> os: r3/a4:  0xaaaaaaab r12/ip:  0x9b5065a6 r14/lr:  0x00014947
[00:43:25.740,970] <err> os:  xpsr:  0x01000000
[00:43:25.740,974] <err> os: Faulting instruction address (r15/pc): 0x00014946
[00:43:25.740,994] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
[00:43:25.741,012] <err> os: Current thread: 0x20003b00 (MPSL Work)
[00:43:27.501,958] <err> os: Halting system

If iti s necessary I can package this up in a complete sample, but I don't think the actual code matters here.



Parents
  • Hi John,

    I have an application with the nrf52840 that was trying to port to nrf54l15 using ncs 3.2.1 but i ran into various issues. I decided to look into some samples that could help narrow down the problem. The application code is written in C++ for the most part

    This previous code you are trying to port, was that made for another version of NCS? I would think some sw that worked well for a 52840 would also work for 54L15.

    I started with this sample

    I would recommend that you base what you create on something made by Nordic, preferably on the NCS SDK. Unfortunately there is no go-to sample directly from Nordic on how to work with C++, but there are two from Zephyr. Though I see that the sample you link to is rather straight forward, and based on the DevAcademy, so that should be fine.

    Regards,

    Elfving

Reply
  • Hi John,

    I have an application with the nrf52840 that was trying to port to nrf54l15 using ncs 3.2.1 but i ran into various issues. I decided to look into some samples that could help narrow down the problem. The application code is written in C++ for the most part

    This previous code you are trying to port, was that made for another version of NCS? I would think some sw that worked well for a 52840 would also work for 54L15.

    I started with this sample

    I would recommend that you base what you create on something made by Nordic, preferably on the NCS SDK. Unfortunately there is no go-to sample directly from Nordic on how to work with C++, but there are two from Zephyr. Though I see that the sample you link to is rather straight forward, and based on the DevAcademy, so that should be fine.

    Regards,

    Elfving

Children
Related