mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
esp32s3: Enhance protected build linker scripts and memory layout
Instead of setting kernel/user space instruction and data ROM as hard-coded values on linker, set them according to the max size of the kernel image set by CONFIG_ESP32S3_KERNEL_IMAGE_SIZE. This is done by making KIROM, UIROM, KDROM and UDROM dependent on the kernel size value. Also, override CONFIG_NUTTX_USERSPACE config according to CONFIG_ESP32S3_KERNEL_IMAGE_SIZE by using a custom PREBUILD definition.
This commit is contained in:
committed by
Petro Karashchenko
parent
4f83811a09
commit
1197a80741
+12
-2
@@ -80,7 +80,7 @@ ifdef ESPTOOL_BINDIR
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32S3_APP_FORMAT_LEGACY),y)
|
||||
APP_OFFSET := 0x10000
|
||||
APP_OFFSET := $(CONFIG_ESP32S3_KERNEL_OFFSET)
|
||||
APP_IMAGE := nuttx.bin
|
||||
FLASH_APP := $(APP_OFFSET) $(APP_IMAGE)
|
||||
else ifeq ($(CONFIG_ESP32S3_APP_FORMAT_MCUBOOT),y)
|
||||
@@ -103,7 +103,7 @@ endif
|
||||
ESPTOOL_BINS += $(FLASH_APP)
|
||||
|
||||
ifeq ($(CONFIG_BUILD_PROTECTED),y)
|
||||
ESPTOOL_BINS += $(CONFIG_ESP32S3_USER_IMAGE_OFFSET) nuttx_user.bin
|
||||
ESPTOOL_BINS += $(shell printf "%#x\n" $$(( $(CONFIG_ESP32S3_KERNEL_OFFSET) + $(CONFIG_ESP32S3_KERNEL_IMAGE_SIZE) ))) nuttx_user.bin
|
||||
endif
|
||||
|
||||
# MERGEBIN -- Merge raw binary files into a single file
|
||||
@@ -159,6 +159,16 @@ define MKIMAGE
|
||||
endef
|
||||
endif
|
||||
|
||||
# PREBUILD -- Perform pre build operations
|
||||
|
||||
ifeq ($(CONFIG_BUILD_PROTECTED),y)
|
||||
define PREBUILD
|
||||
$(Q) echo "CONFIG_NUTTX_USERSPACE=$(shell printf "%#x\n" $$(( 0x3c000030 + $(CONFIG_ESP32S3_KERNEL_IMAGE_SIZE) )))" > $(1)/.config.tmp
|
||||
$(Q) kconfig-merge -m $(1)/.config $(1)/.config.tmp
|
||||
$(Q)rm -f $(1)/.config.tmp
|
||||
endef
|
||||
endif
|
||||
|
||||
# POSTBUILD -- Perform post build operations
|
||||
|
||||
define POSTBUILD
|
||||
|
||||
Reference in New Issue
Block a user