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

How to determine available flash space?

Hi!

I have searched for this questoin, but not found anything useful. Probably I an not using a good search phrase.

How do I determine how much space is left on a nRF51 DK? I am using the Eclipse/gcc tolchain, and the linker reports something like:

   text	   data	    bss	    dec	   hex	filename
  123692	    420	  10836      134948	 20f24	_build/nrf51422_xxac_s130.out

The flash space seems to be 256kB, but I do not know how big the softdevice is.

Ideally, the Makefile should report that "You have XX octets of flash remaining for your application", like some IDEs do. How can the Makefile do that?

Dreaming on: Even better would be a grapf that is updated for each compilation. Then you could extrapolate and see when in the future the flash would be full. ;-)

regards, Elm

Parents
  • Hi Elm,

    If you make raw BIN output file (e.g. by -O binary flag in GCC from ELF file) then you can simply print its size by $(SIZE) -B --target=binary $(BIN) and that's exact number of bytes which will be written in HEX on top of base address. Now your base address is typically given by end of SoftDevice so by placing this number into Makefile (or by loading it from some other config - e.g. LD file) you could get your "total" code size which is written into nRF5x NVM (flash). However if your app uses flash area for data storage you obviously never see this during compilation...

    Cheers Jan

Reply
  • Hi Elm,

    If you make raw BIN output file (e.g. by -O binary flag in GCC from ELF file) then you can simply print its size by $(SIZE) -B --target=binary $(BIN) and that's exact number of bytes which will be written in HEX on top of base address. Now your base address is typically given by end of SoftDevice so by placing this number into Makefile (or by loading it from some other config - e.g. LD file) you could get your "total" code size which is written into nRF5x NVM (flash). However if your app uses flash area for data storage you obviously never see this during compilation...

    Cheers Jan

Children
No Data
Related