From: OpenOCD-Gerrit <ope...@us...> - 2022-09-27 08:40:33
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 84d73d0225407594ed9cf646fa3dd8a5752df7ad (commit) from 47ed1c1eab82ee329915e04ea61f857dae89fc6a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 84d73d0225407594ed9cf646fa3dd8a5752df7ad Author: Tomas Vanek <va...@fb...> Date: Sun Sep 11 12:11:31 2022 +0200 flash/nor/rp2040: fix size of flash write buffer The size of the flash write buffer should be rounded down to the multiply of flash page size. Using write chunks of unadjusted size results in write of chunks unaligned to flash pages. Change-Id: If7931362ee193dff4dc2df7ec78f13530658cf08 Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/7187 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/rp2040.c b/src/flash/nor/rp2040.c index 1c57424f9..ce09fea08 100644 --- a/src/flash/nor/rp2040.c +++ b/src/flash/nor/rp2040.c @@ -217,7 +217,11 @@ static int rp2040_flash_write(struct flash_bank *bank, const uint8_t *buffer, ui if (err != ERROR_OK) goto cleanup; - const unsigned int chunk_size = target_get_working_area_avail(target); + unsigned int avail_pages = target_get_working_area_avail(target) / priv->dev->pagesize; + /* We try to allocate working area rounded down to device page size, + * al least 1 page, at most the write data size + */ + unsigned int chunk_size = MIN(MAX(avail_pages, 1) * priv->dev->pagesize, count); err = target_alloc_working_area(target, chunk_size, &bounce); if (err != ERROR_OK) { LOG_ERROR("Could not allocate bounce buffer for flash programming. Can't continue"); ----------------------------------------------------------------------- Summary of changes: src/flash/nor/rp2040.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |