17 Commits

Author SHA1 Message Date
Kevin O'Connor
cdb5b56911 stm32: Add support for stm32g431 chips
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-05-19 14:55:00 -04:00
Robin GAY
25482ba0d8
flash.c: fix write error for STM32H72x (#78)
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>
2023-07-10 16:44:25 -04:00
Kevin O'Connor
88e208a083
stm32: Add support for flashing stm32h7 boards
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-22 12:18:23 -05:00
Kevin O'Connor
115582ce88 stm32: Add stm32g0 support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-17 19:29:58 -04:00
Kevin O'Connor
4857a70189 stm32: Improve out-of-bounds check on erase sector index calculation
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>
2022-05-17 19:29:58 -04:00
Kevin O'Connor
1e6a2de3b1 stm32: Enable support on other stm32f0 chips
The remaining stm32f0 chips have flash hardware similar to stm32f1.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-17 19:29:58 -04:00
Kevin O'Connor
5cbc25d676 stm32: Enable support for stm32f2 - it has same flash interface as stm32f4
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-17 19:29:58 -04:00
Kevin O'Connor
6db366dc3f flash: Report pages written from "eof" command
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>
2022-05-16 20:37:54 -04:00
Kevin O'Connor
4d969764f1 flash: Write each block individually
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>
2022-05-16 19:21:51 -04:00
Kevin O'Connor
7287670002 flash: Move page handling from flashcmd.c to flash.c
Allow the low-level board code to handle each flash page.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 19:21:51 -04:00
Kevin O'Connor
9f9a872176 stm32: Avoid read-modify-write operations in flash.c
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>
2022-05-16 19:21:51 -04:00
Kevin O'Connor
8316d2f0af armcm_boot: Introduce application_check_valid()
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>
2022-05-16 19:21:51 -04:00
Eric Callahan
fbf59301b3 stm32: add support for stm32f4 flash operations
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-16 09:04:45 -04:00
Kevin O'Connor
468b756f8d stm32: Avoid alignment issues in flash_read_block()
Use a regular memcpy() call to avoid issues with pointer alignment.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 06:19:08 -04:00
Eric Callahan
beb06d600d canboot_main: use direct addressing
Rather than use indicies, use the desired address when requesting
a block write or read.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-09 17:12:24 -04:00
Kevin O'Connor
5279c33ea0 flash: Autodetect stm32f103 flash page size
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 14:06:43 -04:00
Arksine
2762299895 canboot: initial source commit
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-02-06 20:04:47 -05:00