Commit 84c68ace authored by Ederson de Souza's avatar Ederson de Souza Committed by Jamie
Browse files

boot/zephyr: Add CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD



This option basically enables MCUBOOT_RAM_LOAD in a single
slot configuration, meaning the image on slot0 will be loaded into RAM.

Signed-off-by: default avatarEderson de Souza <ederson.desouza@intel.com>
Signed-off-by: default avatarTom Burdick <thomas.burdick@intel.com>
(cherry picked from commit 249a71d1)
Signed-off-by: default avatarJamie McCrae <jamie.mccrae@nordicsemi.no>
parent 77d911f4
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ zephyr_library_sources(
  )
endif()

if(CONFIG_SINGLE_APPLICATION_SLOT)
if(CONFIG_SINGLE_APPLICATION_SLOT OR CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
zephyr_library_sources(
  ${BOOT_DIR}/zephyr/single_loader.c
  )
@@ -143,7 +143,7 @@ zephyr_library_sources(
  )
endif()

if(CONFIG_BOOT_RAM_LOAD)
if(CONFIG_BOOT_RAM_LOAD OR CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
  zephyr_library_sources(
    ${BOOT_DIR}/bootutil/src/ram_load.c
    )
@@ -398,7 +398,7 @@ if(CONFIG_BOOT_SWAP_USING_MOVE)
  endif()
endif()

if(NOT CONFIG_SINGLE_APPLICATION_SLOT)
if(NOT CONFIG_SINGLE_APPLICATION_SLOT AND NOT CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
  dt_nodelabel(slot1_flash NODELABEL "slot1_partition")
  dt_prop(slot1_size PATH "${slot1_flash}" PROPERTY "reg" INDEX 1)
  dt_get_parent(slot1_flash)
@@ -426,7 +426,7 @@ if(CONFIG_BOOT_MAX_IMG_SECTORS_AUTO)
    math(EXPR slot_min_sectors "${slot0_size} / ${erase_size_slot0}")
  endif()

  if(NOT CONFIG_SINGLE_APPLICATION_SLOT)
  if(NOT CONFIG_SINGLE_APPLICATION_SLOT AND NOT CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD)
    if(NOT DEFINED slot1_size)
      message(WARNING "Unable to determine size of slot1 partition, cannot calculate minimum sector usage")
    elseif(NOT DEFINED erase_size_slot1)
+22 −14
Original line number Diff line number Diff line
@@ -326,19 +326,6 @@ config BOOT_FIRMWARE_LOADER

endchoice

# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_SRAM := zephyr,sram

if BOOT_RAM_LOAD
config BOOT_IMAGE_EXECUTABLE_RAM_START
	hex "Boot image executable ram start"
	default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM))

config BOOT_IMAGE_EXECUTABLE_RAM_SIZE
	int "Boot image executable base size"
	default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM),0)
endif

config BOOT_DIRECT_XIP_REVERT
	bool "Enable the revert mechanism in direct-xip mode"
	depends on BOOT_DIRECT_XIP
@@ -375,6 +362,27 @@ config BOOT_SWAP_SAVE_ENCTLV

endif # !SINGLE_APPLICATION_SLOT

config SINGLE_APPLICATION_SLOT_RAM_LOAD
	bool "RAM load for single application slot"
	help
	  If y, the image is loaded to RAM and executed from there. For this reason,
	  the image has to be linked to be executed from RAM. The address that the
	  image is copied to is specified using the load-addr argument to the
	  imgtool.py script which writes it to the image header.

# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_SRAM := zephyr,sram

if BOOT_RAM_LOAD || SINGLE_APPLICATION_SLOT_RAM_LOAD
config BOOT_IMAGE_EXECUTABLE_RAM_START
	hex "Boot image executable ram start"
	default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM))

config BOOT_IMAGE_EXECUTABLE_RAM_SIZE
	int "Boot image executable base size"
	default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM),0)
endif

config BOOT_ENCRYPTION_SUPPORT
	bool
	help
@@ -683,7 +691,7 @@ config BOOT_INTR_VEC_RELOC
config UPDATEABLE_IMAGE_NUMBER
	int "Number of updateable images"
	default 1
	range 1 1 if SINGLE_APPLICATION_SLOT
	range 1 1 if SINGLE_APPLICATION_SLOT || SINGLE_APPLICATION_SLOT_RAM_LOAD
	help
	  Enables support of multi image update.

+8 −0
Original line number Diff line number Diff line
@@ -118,6 +118,14 @@

#endif /* CONFIG_SINGLE_APPLICATION_SLOT */

#ifdef CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD
#define MCUBOOT_RAM_LOAD    1
#define MCUBOOT_IMAGE_NUMBER    1
#define MCUBOOT_SINGLE_APPLICATION_SLOT_RAM_LOAD    1
#define IMAGE_EXECUTABLE_RAM_START CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START
#define IMAGE_EXECUTABLE_RAM_SIZE CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE
#endif

#ifdef CONFIG_LOG
#define MCUBOOT_HAVE_LOGGING 1
#endif