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

SDK12 DFU Nrf_dfu_settings.c used RAM 1.7k

  1. Nrf_dfu_settings.c used 1.7k RAM in examples\ble_peripheral\experimental_ble_app_buttonless_dfu project ?can used more less?

  2. Nrf_dfu_settings.c -> nrf_dfu_settings_write used "static nrf_dfu_settings_t temp_dfu_settings" can used "nrf_dfu_settings_t temp_dfu_settings", not static?

  • can used flow ?

    #if defined (__CC_ARM )
    
    	uint8_t*  m_dfu_settings_buffer = (uint8_t* )BOOTLOADER_SETTINGS_ADDRESS;
    
    #elif defined ( __GNUC__ )
    
    	uint8_t*  m_dfu_settings_buffer = (uint8_t* )BOOTLOADER_SETTINGS_ADDRESS;
    
    #elif defined ( __ICCARM__ )
    
    	uint8_t*  m_dfu_settings_buffer = (uint8_t* )BOOTLOADER_SETTINGS_ADDRESS;
    
    #else
    
    	#error Not a valid compiler/linker for m_dfu_settings placement.
    
    #endif
    
  • Hi Cesar,

    The Nrf_dfu_settings.c doesn't use 1.7kB. It actually only uses ~700 bytes. You can find the ZI data of 1.7kB but it's largely contributed by m_dfu_settings_buffer which is on flash , not RAM. It's a place holder we put to avoid the linker to put any code into that place on flash that we use to store bootloader setting. You can find m_dfu_settings_buffer is not located anywhere in RAM.

    1. No, you can't change it to non-static because the data stored in temp_dfu_settings will be used later on by fstorage to store data to flash. If you don't declare it as static the content will be discarded after the function finish (and before fstorage can store the data to flash).

    May I ask why you want to reduce RAM usage of the bootloader ? Note that the usage of RAM of the bootloader won't affect your application RAM size.

    1. examples\ble_peripheral\experimental_ble_app_buttonless_dfu project build result is 1720 ZI

    Code (inc. data) RO Data RW Data ZI Data Debug Object Name

      1898        664          4          6        216     121671   main.o
       416        188          0         20          0       6297   nrf_dfu_flash_buttonless.o
       588        352          0          8       1720       3961   nrf_dfu_settings.o
       264         36          0          0         20       9784   nrf_drv_clock.o
    

    2.I must inclulde nrf_dfu_settings.c in APP for user jump to bootlader witch DFU.

  • @Cesar: I don't understand what you mean in your reply. I already explained above, the nrf_dfu_settings.c occupied 1.7kB in ZI data but it won't consume 1.7kB in RAM as 1kB of the bootloader setting located on flash only.

  • @Hung Bui : your explained " ZI data of 1.7kB but it's largely contributed by m_dfu_settings_buffer which is on flash , not RAM", but I do not think so. Total RW Size= (RW Data + ZI Data) so ZI data is in RAM! can do testting

Related