diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-12-20 11:32:47 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-12-20 11:32:47 +0200 |
| commit | 295cc6981e5fca0f958c7aef06ee9cf8f25a762c (patch) | |
| tree | 865e7e83992953d3432060c5d9a5824e63fd32ea /Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c | |
| parent | 631fd1917ab3809b4b8d7e0066c49572f76688da (diff) | |
| download | Tango-295cc6981e5fca0f958c7aef06ee9cf8f25a762c.tar.gz Tango-295cc6981e5fca0f958c7aef06ee9cf8f25a762c.zip | |
Version 1.6.0 mostly changes in flash and EEPROM
Diffstat (limited to 'Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c index 10f65db1d..c757c3a3b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c +++ b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c @@ -132,18 +132,16 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b return(1); } int base_flashErased = false; -uint32_t EraseFlashSection(uint32_t ui32FlashStart) +uint32_t EraseFlashSection(void) { - volatile uint32_t ui32Idx = ui32FlashStart; + volatile uint32_t ui32Idx = FLASH_RAM_BASE; uint32_t status; - if (ui32FlashStart<GENHWCFG_SECTION_FLASH) - { - if (base_flashErased == true) - return ERROR; - else - base_flashErased = true; //once in a run - } + if (base_flashErased == true) + return WARNING; + else + base_flashErased = true; //once in a run + #ifdef FLASH_DEBUG Address[RxIndex] = ui32FlashStart; Size[RxIndex] = ui32FileSize; @@ -152,9 +150,27 @@ uint32_t EraseFlashSection(uint32_t ui32FlashStart) RxIndex = 0; #endif status = FlashErase(ui32Idx); + //FlashErase returns 0 or -1 return status; } +/*void FlashTest(void) +{ + int i; + uint32_t stack[0x200]; + uint32_t offset = 0; + + for (i = 0; i < 0x200; i++) + stack[i] = i; + + while (offset < FLASH_SIZE) + { + ReadAppAndProgram(FLASH_RAM_BASE+offset,0x200,stack); + offset+=0x200; + } + EraseFlashSection(); + +}*/ //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. |
