aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c')
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
index c2b228ffb..af7f13a00 100644
--- a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
+++ b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
@@ -57,10 +57,10 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b
// Enter a loop to erase all the requested flash pages beginning at the
// application start address (above the USB stick updater).
//
- for(ui32Idx = ui32FlashStart; ui32Idx < ui32FlashEnd; ui32Idx += 1024)
+ /*for(ui32Idx = ui32FlashStart; ui32Idx < ui32FlashEnd; ui32Idx += 1024)
{
ROM_FlashErase(ui32Idx);
- }
+ }*/
//
// Enter a loop to read sectors from the application image file and
@@ -108,4 +108,27 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b
//
return(1);
}
+#warning flash erase is now done only in init. should consider adding before config changes
+uint32_t EraseFlashSection(uint32_t ui32FlashStart,uint32_t ui32FileSize)
+{
+ volatile uint32_t ui32Idx;
+ for(ui32Idx = ui32FlashStart; ui32Idx < ui32FlashStart+ui32FileSize; ui32Idx += 1024)
+ {
+ ROM_FlashErase(ui32Idx);
+ }
+ return OK;
+
+}
+//Each word may not be subject to more than a specific number of programming cycles before an
+//erase cycle is required. In other words, for any given word, FlashProgram can only be called
+//twice before FlashErase is called.
+void FlashInit(void)
+{
+ volatile uint32_t ui32Idx;
+ //FlashUsecSet(120);
+ for(ui32Idx = FLASH_RAM_BASE; ui32Idx < FLASH_RAM_BASE+FLASH_SIZE; ui32Idx += 1024)
+ {
+ ROM_FlashErase(ui32Idx);
+ }
+}