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

DFU_APP_DATA_RESERVED vs IROM1 lower size

Hi everybody,

I need to preserve 3 pages of data in flash memory during DFU. I know there is the macro DFU_APP_DATA_RESERVED defined in dfu_types.h but, I was wondering...what is the difference between using that macro and, instead, reduce the IROM1 size, in the Option for target in Keil, in order to leave free the 3 pages I need to preserve?

Doing this way can I still use those 3 pages with FDS?

-------------------------

		BOOTLOADER
		

0x3C000
-------------------------

			FDS
		
0x3B400
-------------------------




		APPLICATION
		
		
		
		
		
0x1B000
-------------------------

Thanks in advance

Massimo

Parents
  • Hi,

    FDS/FSTORAGE determines memory layout at runtime based on the FICR and UICR values stored on the device, see fds.c->flash_end_addr() and fds.c-> flash_bounds_set(). So I would recommend to use the DFU_APP_DATA_RESERVED to preserve the application data section. 

  • Hi Vidar and thanks for your reply.

    Maybe I was not so clear in my question, and also I forgot something, so I'll try to do better.

    Beyond the 3 pages managed with FDS, I need another one in order to store some static data I will read at startup. Those static data will be stored in flash in EOL and never more updated. Please, see the following outline:

    -------------------------
    
    		BOOTLOADER
    		
    0x3C000
    -------------------------
    
    			FDS
    		
    0x3B400
    -------------------------
    
            RESERVED
    
    0x3B00
    -------------------------
    
    
    		APPLICATION
    		
    		
    0x1B000
    -------------------------

    I cannot modify the bootloader firmware and perform a DFU of it because I'm working on a single-bank and there isn't enough space to perform an APP+BOOTLOADER DFU.

    So, if I limit the application end address to 0x3B00 in the option for target in Keil, could I be sure to preserve all the 4 pages of data (1 RESERVED + 3 FDS) during a DFU even if the macro DFU_APP_DATA_RESERVED is set to 0x800 (2 pages)?

    Thanks again

    Massimo

  • Hi Massimo,

    The bootloader will not overwrite the reserved section if the DFU image fits between the app start address and 0x3B000. Updating the linker settings will ensure that you get a link time error in case application size exceeds this limit. Just be aware that the bootloader will still accept larger images since  DFU_APP_DATA_RESERVED is set to two instead of three pages.  

  • Hi Vidar,

    Just to be sure...if I would set DFU_APP_DATA_RESERVED to 0 and perform a DFU with a firmware size fitting my application region (let's say not upper then 0x3B000), i wont encounter no problem. Is it correct?

    thanks again

    Massimo

Reply Children
Related