How to read memory map of nRF52840 DK generated by nRF Connect Programmer

I have created an application using SoftDevice S112 using board pca10056e and installed it on the nRF52840 DK. I want this application to run on the nRF52805 so I want to get an idea of how big the application is since the nRF52805 has limited memory. So I flashed the DK, ran it, and then used nRF Connect's Programmer application to read the flash memory map on the DK. What surprised me was the size of the application. It seemed quite large; at least a lot larger than I expected. The application was also broken up into several sections, including sections at high memory. There wasn't much free space though part of that was graphics as the widths are clearly not to scale. The HEX file was generated by the Segger IDE which always seems a lot larger than that generated by Keil. Of course that is the HEX file on the PC and I understand that is an unreliable indication of the size of the program in flash.

Where is a good source of information about what I see using the nRF COnnect Porgrammer? Is it possible to have more than one application erroneously installed on the DK when using the Segger 'build and run' option? I do use the DK to test many different versions of the application using different SoftDevice options.

Thanks

  • Hi,

    The application was also broken up into several sections, including sections at high memory.

    The different sections might be other application data besides the main application. As an example, when using a bootloader, there will be some memory regions containing MBR, MBR parameter storage, the bootloader, and bootloader settings.

    The HEX file was generated by the Segger IDE which always seems a lot larger than that generated by Keil.

    Is only the hex file larger, or do you see a big difference when looking at the memory layout after programming the device using SES compared to Keil? After building an example in SES, you should see Flash and RAM usage in the Output window:

    As for Keil, you can look at the map file. You can open this by double clicking on the project folder in Keil:

    At the bottom of the file you should be able to find total ROM size:

    Is it possible to have more than one application erroneously installed on the DK when using the Segger 'build and run' option?

     The 'build and run' option will do an erase, but you should erase the memory of the chip before programming an example to it, to make sure that this does not happen. You can do this in SES by selecting Target -> Connect J-Link to connect to the kit, and then erase with Target -> Erase All. You can also use nrfjprog to eraseall:

    nrfjprog -f nrf52 --eraseall

    Best regards,

    Marte

  • The nRF Connect Programmer tool did identify SoftDevice and the Bootloader. It'a all the application sections that I see. I think there must have been garbage code on the DK because I examined the DK for the same application and it was much smaller. I don't recall what I did in between. I have many versions of an application each of which can be configured using different health device types and using either S112 or S140 so the flashed used in each case is going to be quite different.

    I am a little concerned about size because I would like to be able to run this application on the nRF52805 MCU. That MCU has limited memory and flash. But I have not been able to configure a project to support this MCU because I have an nRF52840 DK and not an nRF52 DK.  Arrg.

    As far as SES is concerned, my output window does NOT show the sizes as you show above. It does show the two lines above it. That clarifies why I have been unable to get that info from SES.

  • Hi,

    What you saw might have been caused by the chip not being fully erased, especially if you do not see it anymore. It can also be data stored in persistent storage, such as data stored by the BLE Peer Manager, or the Zigbee stack. As for Zigbee, the persistent data is by default stored at the end of the flash memory.

    Since you want to use the nRF52805, I would recommend looking at Developing for the nRF52805 with nRF5 SDK if you want to use the nRF5 SDK.

    Best regards,

    Marte

  • I am only using SoftDevice for all BTLE and flash. I am not using ZigBee, I still can't get sizes in SES like I can in Keil. Using nRF Connect, the Keil build of the same code creates a smaller footprint in flash. I have tired to set the optimizations to optimize for size in both cases, though it is not clear what some of the optimizations do (I think that is in SES). My guess is that Keil is better at removing unused methods than SES.

  • Hi,

    You will see some difference in flash and RAM sizes between different compilers, as compilers behave differently, especially with regards to optimization. You can see a comparison between different compilers in Comparing compilers/IDEs for development with nRF5x series devices.

    Best regards,

    Marte

Related