• AVR Freaks

Helpful ReplyHot!Firmware update and saved data in flash

Author
ggkitsas
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2018/07/27 08:18:37
  • Location: 0
  • Status: offline
2018/10/29 11:59:49 (permalink)
0

Firmware update and saved data in flash

Hello,
 
I am working on a custom board that uses the PIC32MZ2048. The board doesn't feature any additional external memory component, I am left only with the flash memory included inside the PIC chip.
 
I am currently scratching my head on how to manage to use firmware updates while keeping saved data in the PIC's flash memory intact. Did anyone stumble across this situation before?
 
My research results that the only solution would be to develop or modify a bootloader that will update the flash partially (skipping the areas that are used for non-volatile data), but this seems tedious and I am really hoping there is another solution.
 
Best regards,
George
post edited by ggkitsas - 2018/10/29 12:00:56
#1
friesen
Super Member
  • Total Posts : 2058
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
Re: Firmware update and saved data in flash 2018/10/29 12:32:29 (permalink)
5 (1)
How about using an external flash or eeprom?  You really are stuck wasting 1 page of flash if you must do it this way.

Erik Friesen
#2
ggkitsas
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2018/07/27 08:18:37
  • Location: 0
  • Status: offline
Re: Firmware update and saved data in flash 2018/10/30 03:43:07 (permalink)
0
Hey friesen, you are right, but for now wasting a page is fine. Sadly I don't have any other options.
 
My main problem/concern though is that I cannot find a way to use firmware upgrades without erasing/overwriting the flash page that I use for storing data, do you have any ideas on that?
 
post edited by ggkitsas - 2018/12/18 03:30:48
#3
friesen
Super Member
  • Total Posts : 2058
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
Re: Firmware update and saved data in flash 2018/10/30 04:36:22 (permalink) ☄ Helpfulby ggkitsas 2018/10/31 10:09:00
0
Maybe add a protected page to your bootloader area? There is no atomic way otherwise. You could store the data in ram and re write, but that's risky.

Erik Friesen
#4
ggkitsas
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2018/07/27 08:18:37
  • Location: 0
  • Status: offline
Re: Firmware update and saved data in flash 2018/10/31 06:17:05 (permalink)
0
Thanks, Erik, I will give the protected-page approach a try. Writing to RAM and back is too risky indeed.
#5
maxruben
Super Member
  • Total Posts : 3316
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re: Firmware update and saved data in flash 2018/11/01 14:33:58 (permalink)
0
There is nothing to prevent you from only erasing the application code without erasing the data stored elsewhere in flash. The bootloader actually does that already since it can't erase itself.
 
/Ruben
 
#6
Jump to:
© 2019 APG vNext Commercial Version 4.5