TimJTi commented on code in PR #3068:
URL: https://github.com/apache/nuttx-apps/pull/3068#discussion_r2073755151
##########
boot/nxboot/loader/boot.c:
##########
@@ -403,6 +440,42 @@ static int perform_update(struct nxboot_state *state, bool
check_only)
return OK;
}
+#ifdef CONFIG_NXBOOT_COPY_TO_RAM
+int nxboot_ramcopy(void)
+{
+ int primary;
+ struct nxboot_img_header header;
+ ssize_t bytes;
+ static uint8_t *buf;
+ size_t size;
+
+ primary = flash_partition_open(CONFIG_NXBOOT_PRIMARY_SLOT_PATH);
+ if (primary < 0)
+ {
+ return ERROR;
+ }
+
+ get_image_header(primary, &header);
+ buf = malloc(header.size);
+ if (!buf)
+ {
+ return ERROR;
Review Comment:
done
##########
boot/nxboot/loader/boot.c:
##########
@@ -403,6 +440,42 @@ static int perform_update(struct nxboot_state *state, bool
check_only)
return OK;
}
+#ifdef CONFIG_NXBOOT_COPY_TO_RAM
+int nxboot_ramcopy(void)
+{
+ int primary;
+ struct nxboot_img_header header;
+ ssize_t bytes;
+ static uint8_t *buf;
+ size_t size;
+
+ primary = flash_partition_open(CONFIG_NXBOOT_PRIMARY_SLOT_PATH);
+ if (primary < 0)
+ {
+ return ERROR;
+ }
+
+ get_image_header(primary, &header);
+ buf = malloc(header.size);
+ if (!buf)
+ {
+ return ERROR;
+ }
+
+ size = header.size - CONFIG_NXBOOT_HEADER_SIZE;
+ bytes = pread(primary, buf, size, CONFIG_NXBOOT_HEADER_SIZE);
+ if (bytes != size)
+ {
+ return ERROR;
+ }
+
+ memcpy((uint32_t *)CONFIG_NXBOOT_RAMSTART, buf, size);
+ flash_partition_close(primary);
+
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]