Issue with BLE DFU in Zephyr, not enough space

I'm developping an application on the NRF52833 chip with DFU using BLE

I havn't deployed a lot of thing in my software and I was surprised to see that my software doesn't fits into half of flash.

Without Zephyr, I can use Soft Device Controller on a specific partition and put my software on an other. Making like that reduce the cost of the BLE in the flash more than 100 KB, since it is present only once !

I can't manage to do the same thing using Zephyr.

I try different methods like CONFIG_BT_LL_SW_SPLIT in my prj.conf but none succeeds.

So I took a simple peripheral_lbs software and add the CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU key.

It works, but it is using 190 KB / 232 KB to blink a led. No possible for me to add a lot of thing.

I think something I made is wrong because I found really strange to have a chip that is full only adding a library without any space for custom code .....

  • I feel your pain. Despite it "just blinking an LED" which is true it's also got a full bluetooth stack in it, a bootloader, file system, etc. It seems like others have run into this same problem when trying to use NCS on smaller nordic chips.

    It may help to go through and make sure that you don't have any Kconfig options or peripherals with status="okay" that you aren't using so those drivers don't get compiled.

    Also if you want a visual representation of where all your ROM is going you can use the memory report functionality. For instance, this shows on one of my builds that the bluetooth stack alone is using more than 10% of available ROM if I were using a similar sized chip.

    That being said, the 40KB you have left isn't insignificant since all you have left to do is implement application logic. All your drivers are already there and fully functional.

  • Also, if you need a little more space you can reduce the size of the MCUboot partition from the default (it only uses 67% of that ROM partition. If you gave it only exactly enough space to fit MCUboot, you could add about 7KB to each image slot.

  • Nice idea I will check for that. It will not solve all my problems but it could help a little

  • Thanks for your answer.
    I know I minimize the job done when I say "just blink a led" but in fact it is what is does !

    From my side, BLE wieght is around 80KB. Is there something special I can remove to lighten my stack ?

    Here the prj.conf of my BLE configuration

    # -------------
    # Bluetooth
    # -------------
    CONFIG_BT=y
    CONFIG_BT_SMP=y
    CONFIG_BT_SIGNING=n
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_SERIAL_NUMBER=y
    CONFIG_BT_DIS_SERIAL_NUMBER_STR="Zephyr Serial"
    CONFIG_BT_ATT_PREPARE_COUNT=5
    CONFIG_BT_BAS=y
    CONFIG_BT_HRS=y
    CONFIG_BT_IAS=n
    CONFIG_BT_PRIVACY=y
    CONFIG_BT_DEVICE_NAME="XXXXXXXX"
    CONFIG_BT_DEVICE_APPEARANCE=833
    CONFIG_BT_DEVICE_NAME_DYNAMIC=y
    CONFIG_BT_DEVICE_NAME_MAX=65
    CONFIG_BT_LL_SW_SPLIT=y
    # Below is setup to let DIS information be read from settings
    CONFIG_BT_SETTINGS=y
    CONFIG_SETTINGS_RUNTIME=y
    CONFIG_SETTINGS=y
    CONFIG_SETTINGS_NONE=y
    CONFIG_BT_DIS_SETTINGS=y
    CONFIG_BT_DIS_STR_MAX=21
    # Disable unused Bluetooth features
    CONFIG_BT_CTLR_LE_ENC=n
    CONFIG_BT_CTLR_LE_PING=n
    CONFIG_BT_DATA_LEN_UPDATE=n
    CONFIG_BT_PHY_UPDATE=n
    CONFIG_BT_CTLR_MIN_USED_CHAN=n
    CONFIG_BT_CTLR_PRIVACY=n

    I've tried to disable many elements and no one was impressive in reduction.

    The other problem I have, to be able to build I was obliged to remove the LOG module that's weight 40KB. If I don't do that I can't succeed in building my app and I can't see memory summary. 

Related