flash.c: fix write error for STM32H72x
Add a flash lock/unlock sequence after erasing and before writing to the flash
memory
Signed off by: Robin Gay <robingay67@gmail.com>
Avoid wrapping the sector index, as that could potentially result in
erasing the booloader itself.
Also, move the stm32f4_sector_index() inline into erase_page().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 4d969764 changed the "eof" command to return the number of
blocks instead of the number of pages written. Report the number of
pages written again.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't gather "blocks" into flash pages. Instead, write each "block"
to flash on each flash_write_block() request.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid read-modify-write operations on the FLASH->CR register. Write
out the desired valid explicitly.
Use writew() and writel() to write the flash bytes out to avoid gcc
reordering the memory write relative to the flash register writes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move application_check_valid() in bootentry.c to armcm_boot.c and make
the check specific to the ARM cortex-m. On these ARM machines it is
easier to validate the application stack address.
Also rename jump_to_application() to application_jump().
Also rename flash_read_block() to application_read_flash() and move to
armcm_boot.c .
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>