You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2018/03/30 09:40:13 UTC
[mynewt-core] branch master updated: Fix boot_serial to follow
flash write alignment
This is an automated email from the ASF dual-hosted git repository.
utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new 2268a67 Fix boot_serial to follow flash write alignment
2268a67 is described below
commit 2268a67a666c0e030335523d5dffd3d647850730
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Thu Mar 29 16:39:06 2018 -0300
Fix boot_serial to follow flash write alignment
This fixes an issue found on stm32f3 where newtmgr after writing an odd
sized packet, would hardfault on the next write due to trying to write an
odd address which is not valid on stm32f3 flash.
Signed-off-by: Fabio Utzig <ut...@apache.org>
---
boot/boot_serial/src/boot_serial.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/boot/boot_serial/src/boot_serial.c b/boot/boot_serial/src/boot_serial.c
index b888987..60c9694 100644
--- a/boot/boot_serial/src/boot_serial.c
+++ b/boot/boot_serial/src/boot_serial.c
@@ -185,6 +185,7 @@ bs_upload(char *buf, int len)
uint8_t img_data[512];
long long int off = UINT_MAX;
size_t img_blen = 0;
+ uint8_t rem_bytes;
long long int data_len = UINT_MAX;
size_t slen;
char name_str[8];
@@ -309,6 +310,12 @@ bs_upload(char *buf, int len)
rc = 0;
goto out;
}
+ if (curr_off + img_blen < img_size) {
+ rem_bytes = img_blen % flash_area_align(fap);
+ if (rem_bytes) {
+ img_blen -= rem_bytes;
+ }
+ }
rc = flash_area_write(fap, curr_off, img_data, img_blen);
if (rc == 0) {
curr_off += img_blen;
--
To stop receiving notification emails like this one, please contact
utzig@apache.org.