Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues in source/daplink/drag-n-drop/iap_flash_intf.c #1006

Open
mbrossard opened this issue Feb 4, 2023 · 0 comments
Open

Issues in source/daplink/drag-n-drop/iap_flash_intf.c #1006

mbrossard opened this issue Feb 4, 2023 · 0 comments

Comments

@mbrossard
Copy link
Contributor

Background: The file source/daplink/drag-n-drop/iap_flash_intf.c contains the implementation of the flash_intf_t interface to flash the probe in order to update the bootloader or interface firmware. One of the feature it contains is that it will erase the first "sector" but cache it's content and only write the sector at the end. This is to minimize the time window in which an interrupted update might start anyway (whereas if the interrupt vector is missing, the failure will be immediate).

The constants DAPLINK_SECTOR_SIZE and DAPLINK_MIN_WRITE_SIZE are defined in the interface. The use of DAPLINK_SECTOR_SIZE in the design is wrong for two reasons:

  • It assumes that all erase sectors have the same size (STM32F4x1xx have sectors of size 16 KiB, 64 KiB and 128 KiB).
  • It assumes a sector is always a reasonable amount of data to cache in RAM (STM32H7 have sectors of 128 KiB).

The following changes are needed:

  • The Flash HAL should be extended to add a function that returns the size of the sector (given the address of the start of the sector).
  • Either remove the functionality that caches the first sector, or reduce the size of the buffer to mainly cover the reset vector. In the latter case, a possible enhancement would be to share the buffer with the flash interface used to flash targets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant