You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2023/08/02 19:38:50 UTC

[nuttx] branch master updated (4f83811a09 -> 17447622bf)

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


    from 4f83811a09 nucleo-f446re: add systemview configuration
     new 1197a80741 esp32s3: Enhance protected build linker scripts and memory layout
     new 17447622bf esp32s3/wifi: support the Wi-Fi to work with protected build

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/xtensa/src/esp32s3/Kconfig                    | 31 +++++++++++++++++++---
 arch/xtensa/src/esp32s3/Wireless.mk                |  2 +-
 arch/xtensa/src/esp32s3/esp32s3_userspace.c        |  2 +-
 .../xtensa/esp32s3/common/scripts/kernel-space.ld  | 12 +++++++++
 .../esp32s3/common/scripts/protected_memory.ld     | 16 +++++------
 .../esp32s3/esp32s3-devkit/configs/knsh/defconfig  |  3 ++-
 .../configs/{sta_softap => ksta_softap}/defconfig  | 19 +++++++++----
 tools/esp32s3/Config.mk                            | 14 ++++++++--
 8 files changed, 77 insertions(+), 22 deletions(-)
 copy boards/xtensa/esp32s3/esp32s3-devkit/configs/{sta_softap => ksta_softap}/defconfig (85%)


[nuttx] 01/02: esp32s3: Enhance protected build linker scripts and memory layout

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 1197a8074144f74ceed416cedf7ca0b13c24e802
Author: Tiago Medicci Serrano <ti...@espressif.com>
AuthorDate: Mon Jul 31 16:41:43 2023 -0300

    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.
---
 arch/xtensa/src/esp32s3/Kconfig                    | 31 +++++++++++++++++++---
 arch/xtensa/src/esp32s3/esp32s3_userspace.c        |  2 +-
 .../esp32s3/common/scripts/protected_memory.ld     | 16 +++++------
 .../esp32s3/esp32s3-devkit/configs/knsh/defconfig  |  3 ++-
 tools/esp32s3/Config.mk                            | 14 ++++++++--
 5 files changed, 50 insertions(+), 16 deletions(-)

diff --git a/arch/xtensa/src/esp32s3/Kconfig b/arch/xtensa/src/esp32s3/Kconfig
index caafe4be11..c7d5beba49 100644
--- a/arch/xtensa/src/esp32s3/Kconfig
+++ b/arch/xtensa/src/esp32s3/Kconfig
@@ -1355,13 +1355,36 @@ config ESP32S3_PARTITION_TABLE_OFFSET
 	default 0x8000
 	depends on ESP32S3_APP_FORMAT_LEGACY
 
+config ESP32S3_KERNEL_OFFSET
+	hex
+	default 0x10000
+	depends on ESP32S3_APP_FORMAT_LEGACY
+
 if BUILD_PROTECTED
 
-config ESP32S3_USER_IMAGE_OFFSET
-	hex "User image offset"
-	default 0x90000
+config ESP32S3_KERNEL_IMAGE_SIZE
+	hex "Kernel Image Size"
+	default 0x100000
+	depends on ESP32S3_APP_FORMAT_LEGACY
+	---help---
+		Max size of the kernel image. This parameter is used to 1) write to
+		the SPI flash, 2) calculate the offset for the user image and 3) set
+		the KIROM, KDROM, UIROM and UDROM parameters in the linker. Please
+		check boards/xtensa/esp32s3/common/scripts/protected_memory.ld for
+		more information.
+
+config ESP32S3_KERNEL_RAM_SIZE
+	hex "Kernel Allocated RAM"
+	default 0x29000
+	range 0x10000 0x54700
+	depends on ESP32S3_APP_FORMAT_LEGACY
 	---help---
-		Offset in SPI Flash for flashing the User application firmware image.
+		Selects the amount of RAM available to the kernel from the total
+		available amount (337,75KiB). The rest of the memory will be
+		allocated to the user space. Respectively, this config will set the
+		KDRAM and UDRAM parameters of the linker. Please check
+		boards/xtensa/esp32s3/common/scripts/protected_memory.ld for more
+		information.
 
 endif # BUILD_PROTECTED
 
diff --git a/arch/xtensa/src/esp32s3/esp32s3_userspace.c b/arch/xtensa/src/esp32s3/esp32s3_userspace.c
index fb52f186a8..ca94a1eef5 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_userspace.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_userspace.c
@@ -52,7 +52,7 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define USER_IMAGE_OFFSET   CONFIG_ESP32S3_USER_IMAGE_OFFSET
+#define USER_IMAGE_OFFSET   CONFIG_ESP32S3_KERNEL_OFFSET + CONFIG_ESP32S3_KERNEL_IMAGE_SIZE
 
 #define MMU_BLOCK0_VADDR    SOC_DROM_LOW
 #define MMU_SIZE            0x3f0000
diff --git a/boards/xtensa/esp32s3/common/scripts/protected_memory.ld b/boards/xtensa/esp32s3/common/scripts/protected_memory.ld
index 4c7e9f2e0a..10a73d0ea4 100644
--- a/boards/xtensa/esp32s3/common/scripts/protected_memory.ld
+++ b/boards/xtensa/esp32s3/common/scripts/protected_memory.ld
@@ -42,7 +42,7 @@
  * Application Image properly.
  *
  * For more information, refer to the bootloader linker scripts:
- * https://github.com/espressif/esp-idf/blob/v4.4.2/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld#L41-L47
+ * https://github.com/espressif/esp-idf/blob/dbb64db552068d440c2659294dcf2a5544fe3b6b/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld#L52
  */
 
 #define SRAM_IRAM_END       0x403cc700
@@ -73,7 +73,7 @@ MEMORY
 {
   metadata (RX) :   org = 0x0, len = 0x30
   ROM (RX) :        org = ORIGIN(metadata) + LENGTH(metadata),
-                    len = 0x100000 - ORIGIN(ROM)
+                    len = FLASH_SIZE - ORIGIN(ROM)
 
   /* Instruction RAM */
 
@@ -90,13 +90,13 @@ MEMORY
    * constraint that (paddr % 64KB == vaddr % 64KB).
    */
 
-  KIROM (RX) :      org = 0x42000020, len = 0x80000 - 0x20
-  UIROM (RX) :      org = 0x42080000, len = 0x180000
+  KIROM (RX) :      org = 0x42000020, len = CONFIG_ESP32S3_KERNEL_IMAGE_SIZE - 0x20
+  UIROM (RX) :      org = ORIGIN(KIROM) + LENGTH(KIROM), len = FLASH_SIZE - LENGTH(KIROM)
 
   /* Shared data RAM, excluding memory reserved for ROM bss/data/stack. */
 
-  KDRAM (RW) :      org = ORIGIN(KIRAM) + LENGTH(KIRAM) - I_D_SRAM_OFFSET, len = 64K
-  UDRAM (RW) :      org = ORIGIN(KDRAM) + LENGTH(KDRAM), len = 256K
+  KDRAM (RW) :      org = ORIGIN(KIRAM) + LENGTH(KIRAM) - I_D_SRAM_OFFSET, len = CONFIG_ESP32S3_KERNEL_RAM_SIZE
+  UDRAM (RW) :      org = ORIGIN(KDRAM) + LENGTH(KDRAM), len = I_D_SRAM_SIZE - LENGTH(KDRAM)
 
   /* Flash mapped constant data */
 
@@ -109,7 +109,7 @@ MEMORY
    * SRAM contents when loading the User application image.
    */
 
-  KDROM (R)  :      org = 0x3c000020, len = 0x80000 - 0x20
-  UDROM (R)  :      org = 0x3c080030, len = 0x180000 - ORIGIN(ROM)
+  KDROM (R)  :      org = 0x3c000020, len = CONFIG_ESP32S3_KERNEL_IMAGE_SIZE - 0x20
+  UDROM (R)  :      org = ORIGIN(KDROM) + LENGTH(KDROM) + ORIGIN(ROM), len = FLASH_SIZE - LENGTH(KDROM) - ORIGIN(ROM)
 }
 
diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/knsh/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/knsh/defconfig
index f0f9726de1..18ddbdb6c7 100644
--- a/boards/xtensa/esp32s3/esp32s3-devkit/configs/knsh/defconfig
+++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/knsh/defconfig
@@ -23,6 +23,8 @@ CONFIG_BUILD_PROTECTED=y
 CONFIG_BUILTIN=y
 CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
+CONFIG_ESP32S3_KERNEL_IMAGE_SIZE=0x80000
+CONFIG_ESP32S3_KERNEL_RAM_SIZE=0x10000
 CONFIG_ESP32S3_UART0=y
 CONFIG_ESP32S3_WCL=y
 CONFIG_FS_PROCFS=y
@@ -37,7 +39,6 @@ CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_FILEIOSIZE=512
 CONFIG_NSH_LINELEN=64
 CONFIG_NSH_READLINE=y
-CONFIG_NUTTX_USERSPACE=0x3c080030
 CONFIG_PASS1_BUILDIR="boards/xtensa/esp32s3/common/kernel"
 CONFIG_PREALLOC_TIMERS=4
 CONFIG_RAM_SIZE=114688
diff --git a/tools/esp32s3/Config.mk b/tools/esp32s3/Config.mk
index 65d1ea38d0..039f1e7c54 100644
--- a/tools/esp32s3/Config.mk
+++ b/tools/esp32s3/Config.mk
@@ -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


[nuttx] 02/02: esp32s3/wifi: support the Wi-Fi to work with protected build

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 17447622bff26758cc09cffaa8c1a46745c87387
Author: Tiago Medicci Serrano <ti...@espressif.com>
AuthorDate: Wed Mar 22 16:10:50 2023 -0300

    esp32s3/wifi: support the Wi-Fi to work with protected build
    
    - Added Wi-Fi related symbols to the kernel-space linker;
    - Allocate more RAM to the kernel (to be useb by the Wi-Fi driver).
    - Create a specific defconfig.
---
 arch/xtensa/src/esp32s3/Wireless.mk                |   2 +-
 .../xtensa/esp32s3/common/scripts/kernel-space.ld  |  12 +++
 .../esp32s3-devkit/configs/ksta_softap/defconfig   | 101 +++++++++++++++++++++
 3 files changed, 114 insertions(+), 1 deletion(-)

diff --git a/arch/xtensa/src/esp32s3/Wireless.mk b/arch/xtensa/src/esp32s3/Wireless.mk
index 7600e6cdc1..e9b3086f92 100644
--- a/arch/xtensa/src/esp32s3/Wireless.mk
+++ b/arch/xtensa/src/esp32s3/Wireless.mk
@@ -21,7 +21,7 @@
 ESP_HAL_3RDPARTY_REPO   = esp-hal-3rdparty
 ESP_HAL_3RDPARTY_PATH   = $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)
 ifndef ESP_HAL_3RDPARTY_VERSION
-	ESP_HAL_3RDPARTY_VERSION = 56fd5fee26de81a321f46dfd930298c43dcec909
+	ESP_HAL_3RDPARTY_VERSION = 2c8e45665ea37dfe3c7b6206cc2b53701eb7dcde
 endif
 
 ifndef ESP_HAL_3RDPARTY_URL
diff --git a/boards/xtensa/esp32s3/common/scripts/kernel-space.ld b/boards/xtensa/esp32s3/common/scripts/kernel-space.ld
index a14a51b83c..12aaaf667b 100644
--- a/boards/xtensa/esp32s3/common/scripts/kernel-space.ld
+++ b/boards/xtensa/esp32s3/common/scripts/kernel-space.ld
@@ -102,6 +102,7 @@ SECTIONS
 
     _iram_text_start = ABSOLUTE(.);
     *(.iram1 .iram1.*)
+
     esp32s3_userspace.*(.literal .text .literal.* .text.*)
     *librtc.a:(.literal .text .literal.* .text.*)
     *libkarch.a:esp32s3_spiflash.*(.literal .text .literal.* .text.*)
@@ -117,6 +118,12 @@ SECTIONS
     *libsched.a:irq_csection.*(.literal .text .literal.* .text.*)
     *libsched.a:irq_dispatch.*(.literal .text .literal.* .text.*)
 
+    *(.wifirxiram .wifirxiram.*)
+    *(.wifi0iram  .wifi0iram.*)
+    *(.wifiorslpiram .wifiorslpiram.*)
+    *(.wifislpiram .wifislpiram.*)
+    *(.wifislprxiram .wifislprxiram.*)
+
     /* align + add 16B for CPU dummy speculative instr. fetch */
 
     . = ALIGN(4) + 16;
@@ -263,6 +270,11 @@ SECTIONS
 
     *(.rodata)
     *(.rodata.*)
+    *(.rodata_wlog_verbose.*)
+    *(.rodata_wlog_debug.*)
+    *(.rodata_wlog_info.*)
+    *(.rodata_wlog_warning.*)
+    *(.rodata_wlog_error.*)
     *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
     *(.gnu.linkonce.r.*)
     *(.rodata1)
diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/ksta_softap/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/ksta_softap/defconfig
new file mode 100644
index 0000000000..7d0adcaf83
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/ksta_softap/defconfig
@@ -0,0 +1,101 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed .config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that includes your
+# modifications.
+#
+# CONFIG_ARCH_LEDS is not set
+# CONFIG_NDEBUG is not set
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ALLOW_BSD_COMPONENTS=y
+CONFIG_ARCH="xtensa"
+CONFIG_ARCH_BOARD="esp32s3-devkit"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32S3_DEVKIT=y
+CONFIG_ARCH_CHIP="esp32s3"
+CONFIG_ARCH_CHIP_ESP32S3=y
+CONFIG_ARCH_CHIP_ESP32S3WROOM1=y
+CONFIG_ARCH_INTERRUPTSTACK=4096
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_XTENSA=y
+CONFIG_BOARDCTL_RESET=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_BUILD_PROTECTED=y
+CONFIG_BUILTIN=y
+CONFIG_DEFAULT_TASK_STACKSIZE=4096
+CONFIG_DRIVERS_IEEE80211=y
+CONFIG_DRIVERS_WIRELESS=y
+CONFIG_ESP32S3_RT_TIMER_TASK_STACK_SIZE=4096
+CONFIG_ESP32S3_SPIFLASH=y
+CONFIG_ESP32S3_SPIFLASH_SPIFFS=y
+CONFIG_ESP32S3_STORAGE_MTD_OFFSET=0x200000
+CONFIG_ESP32S3_UART0=y
+CONFIG_ESP32S3_WCL=y
+CONFIG_ESP32S3_WIFI=y
+CONFIG_ESP32S3_WIFI_STATION_SOFTAP=y
+CONFIG_EXAMPLES_DHCPD=y
+CONFIG_EXAMPLES_RANDOM=y
+CONFIG_FS_PROCFS=y
+CONFIG_IDLETHREAD_STACKSIZE=3072
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INIT_STACKSIZE=8192
+CONFIG_INTELHEX_BINARY=y
+CONFIG_IOB_NBUFFERS=124
+CONFIG_IOB_THROTTLE=24
+CONFIG_LIBC_PERROR_STDOUT=y
+CONFIG_LIBC_STRERROR=y
+CONFIG_LIBM=y
+CONFIG_NAME_MAX=48
+CONFIG_NETDB_DNSCLIENT=y
+CONFIG_NETDEV_LATEINIT=y
+CONFIG_NETDEV_PHY_IOCTL=y
+CONFIG_NETDEV_WIRELESS_IOCTL=y
+CONFIG_NETUTILS_CJSON=y
+CONFIG_NETUTILS_DHCPD=y
+CONFIG_NETUTILS_IPERF=y
+CONFIG_NET_BROADCAST=y
+CONFIG_NET_ETH_PKTSIZE=1514
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_SOCKET=y
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_DELAYED_ACK=y
+CONFIG_NET_TCP_WRITE_BUFFERS=y
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_WRITE_BUFFERS=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_PASS1_BUILDIR="boards/xtensa/esp32s3/common/kernel"
+CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_PTHREAD_MUTEX_TYPES=y
+CONFIG_RAM_SIZE=114688
+CONFIG_RAM_START=0x20000000
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_LPWORK=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_SIG_DEFAULT=y
+CONFIG_SPINLOCK=y
+CONFIG_START_DAY=6
+CONFIG_START_MONTH=12
+CONFIG_START_YEAR=2011
+CONFIG_SYSLOG_BUFFER=y
+CONFIG_SYSTEM_DHCPC_RENEW=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_PING=y
+CONFIG_TESTING_GETPRIME=y
+CONFIG_TESTING_GETPRIME_STACKSIZE=2048
+CONFIG_TESTING_OSTEST=y
+CONFIG_TESTING_OSTEST_FPUTESTDISABLE=y
+CONFIG_TIMER=y
+CONFIG_TLS_TASK_NELEM=4
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_WIRELESS=y
+CONFIG_WIRELESS_WAPI=y
+CONFIG_WIRELESS_WAPI_CMDTOOL=y
+CONFIG_WIRELESS_WAPI_INITCONF=y
+CONFIG_WIRELESS_WAPI_STACKSIZE=8192