Skip to content

Commit 439930a

Browse files
butokde-nordic
authored andcommitted
boot_serial: Fix serial recovery for LPC55x and MCXNx
- Increases the unaligned buffer default value for LPC55x and MCXNx. - Fixes the serial recovery for LPC55x and MCXNx. Signed-off-by: Andrej Butok <[email protected]>
1 parent 6b2c93c commit 439930a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

boot/boot_serial/src/boot_serial.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ bs_upload(char *buf, int len)
780780
const uint8_t *img_chunk = NULL; /* Pointer to buffer with received image chunk */
781781
size_t img_chunk_len = 0; /* Length of received image chunk */
782782
size_t img_chunk_off = SIZE_MAX; /* Offset of image chunk within image */
783-
uint8_t rem_bytes; /* Reminder bytes after aligning chunk write to
783+
size_t rem_bytes; /* Reminder bytes after aligning chunk write to
784784
* to flash alignment */
785785
uint32_t img_num_tmp = UINT_MAX; /* Temp variable for image number */
786786
static uint32_t img_num = 0;
@@ -947,7 +947,7 @@ bs_upload(char *buf, int len)
947947
if (flash_area_align(fap) > 1 &&
948948
(((size_t)img_chunk) & (flash_area_align(fap) - 1)) != 0) {
949949
/* Buffer address incompatible with write address, use buffer to write */
950-
uint8_t write_size = MCUBOOT_SERIAL_UNALIGNED_BUFFER_SIZE;
950+
size_t write_size = MCUBOOT_SERIAL_UNALIGNED_BUFFER_SIZE;
951951
uint8_t wbs_aligned[MCUBOOT_SERIAL_UNALIGNED_BUFFER_SIZE];
952952

953953
while (img_chunk_len >= flash_area_align(fap)) {

boot/zephyr/Kconfig.serial_recovery

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ config MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD
6565

6666
config BOOT_SERIAL_UNALIGNED_BUFFER_SIZE
6767
int "Stack buffer for unaligned memory writes"
68+
default 512 if SOC_SERIES_LPC55XXX
69+
default 128 if SOC_SERIES_MCXN
6870
default 64
69-
range 0 128
71+
range 0 1024
7072
help
7173
Specifies the stack usage for a buffer which is used for unaligned
7274
memory access when data is written to a device with memory alignment

0 commit comments

Comments
 (0)