Skip to content

Commit 11f1b2f

Browse files
committed
bugfix not correctly moving to next erase address and program page rework
1 parent 61fc4aa commit 11f1b2f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

flash/flash_device.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,16 @@ int __attribute__ ((noinline)) SEGGER_OPEN_Program(uint32_t address, uint32_t si
169169

170170
for (uint32_t i = 0; i < pages; i++) {
171171
// program a page
172-
int r = ProgramPage(address + (i * PAGE_SIZE_SHIFT), (0x1 << PAGE_SIZE_SHIFT), &data[i * PAGE_SIZE_SHIFT]);
172+
int r = ProgramPage(address, (0x1 << PAGE_SIZE_SHIFT), data);
173173

174174
// check if something went wrong
175175
if (r) {
176176
// return a error
177177
return 1;
178178
}
179+
180+
address += (0x1 << PAGE_SIZE_SHIFT);
181+
data += (0x1 << PAGE_SIZE_SHIFT);
179182
}
180183

181184
// return everything went oke
@@ -203,6 +206,9 @@ int __attribute__ ((noinline)) SEGGER_OPEN_Program(uint32_t address, uint32_t si
203206
// return we have a error
204207
return 1;
205208
}
209+
210+
// go to the next sector address
211+
SectorAddr += (1 << SECTOR_SIZE_SHIFT);
206212
}
207213

208214
// return everything went oke
@@ -220,7 +226,7 @@ int __attribute__ ((noinline)) SEGGER_OPEN_Program(uint32_t address, uint32_t si
220226

221227
#if !NATIVE_READ
222228
int __attribute__ ((noinline, __used__)) BlankCheck(const uint32_t address, const uint32_t size, const uint8_t blank_value) {
223-
// TODO: implement verify
229+
// TODO: implement blank check
224230

225231
return 0;
226232
}

0 commit comments

Comments
 (0)