aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-02-27 15:29:38 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-02-27 15:29:38 +0200
commitdcaadc1886a2f5169821ba568a78990cc6ced4bc (patch)
tree1e9e8d906415a2ce8976f454abef8ab02176509e /Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
parent067e34ae548d2125cf92477af4e8afb4e85f63ce (diff)
downloadTango-dcaadc1886a2f5169821ba568a78990cc6ced4bc.tar.gz
Tango-dcaadc1886a2f5169821ba568a78990cc6ced4bc.zip
program the alarm definitions and the IDS control to the internal flash. motor info did not work well - probably performance problem in thread PID
Diffstat (limited to 'Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c')
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
index 2fc66bcf3..c2b228ffb 100644
--- a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
+++ b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
@@ -31,6 +31,7 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b
uint32_t ui32DataSize;
uint32_t ui32Remaining;
uint32_t ui32ProgAddr;
+ uint32_t ui32BufferAddr;
volatile uint32_t ui32Idx;
uint32_t ui32FlashEnd;
@@ -67,6 +68,7 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b
// stick updater).
//
ui32ProgAddr = ui32FlashStart;
+ ui32BufferAddr = buffer;
ui32Remaining = ui32FileSize;
while(ui32Remaining)
{
@@ -74,6 +76,7 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b
// Compute how much data was read from this sector and adjust the
// remaining amount.
//
+
ui32DataSize = ui32Remaining >= 512 ? 512 : ui32Remaining;
ui32Remaining -= ui32DataSize;
@@ -81,7 +84,7 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b
// Call the function to program a block of flash. The length of the
// block passed to the flash function must be divisible by 4.
//
- ROM_FlashProgram((uint32_t *)buffer, ui32ProgAddr,
+ ROM_FlashProgram((uint32_t *)ui32BufferAddr, ui32ProgAddr,
(ui32DataSize + 3) & ~3);
//
@@ -92,6 +95,7 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b
if(ui32Remaining)
{
ui32ProgAddr += ui32DataSize;
+ ui32BufferAddr += ui32DataSize;
}
}