From 41ddb87715a3a26855533a23d9208c9e54682df5 Mon Sep 17 00:00:00 2001 From: Gillian Minnehan <41022382+gminn@users.noreply.github.com> Date: Wed, 11 Sep 2024 14:44:54 -0400 Subject: [PATCH] chore(zephyr): upgrade to Zephyr v3.7.0 (#10) ### Summary There are several fixes for this app to build with Zephyr 3.7.0 and the latest Memfault SDK: - Updated s3 board overlay & board argument to match hardware model v2 - Updated heap pool size to eliminate warning compile message -- they increased it - Removed enabling of `CONFIG_MEMFAULT_TLS_CERTS_USE_DER` since it is now the default - Updated readme with new args for `wifi connect` shell command - Enabled `CONFIG_MBEDTLS_AES_ROM_TABLES` explicitly -- this used to be enabled by default. It saves ~8kB in RAM space. With the jump to 3.7.0, the build for the esp32c3 overflowed by 70kb: ``` /Users/gminnehan/.local/zephyr-sdk-0.16.1-rc1/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/../../../../riscv64-zephyr-elf/bin/ld.bfd: zephyr/zephyr_pre0.elf section `.dram0.bss' will not fit in region `dram0_0_seg' /Users/gminnehan/.local/zephyr-sdk-0.16.1-rc1/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/../../../../riscv64-zephyr-elf/bin/ld.bfd: DRAM segment data does not fit. /Users/gminnehan/.local/zephyr-sdk-0.16.1-rc1/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/../../../../riscv64-zephyr-elf/bin/ld.bfd: region `dram0_0_seg' overflowed by 71104 bytes ``` After investigating, there appears to be a few culprits, including a drop in the DRAM segment by 20kB in 3.7.0. To unblock build testing with Memfault for both the RISC-V and Xtensa arch on Zephyr 3.7.0, the MBEDTLS heap has been shrunk for the c3 build for now. Users can still test out Memfault shell commands but will have to post chunks via the chunks debug log. Since this support has been removed, the default board is now the s3. ### Test Plan CI, also flashed a esp32s3 locally & uploaded chunks successfully ---- Related: MCU-569 --- .github/workflows/ci.yml | 2 +- CMakeLists.txt | 2 +- README.md | 8 +++++--- boards/esp32c3_devkitm.conf | 10 +++++++++- ...evkitm.conf => esp32s3_devkitm_esp32s3_procpu.conf} | 0 ....overlay => esp32s3_devkitm_esp32s3_procpu.overlay} | 0 prj.conf | 6 ++++-- west.yml | 4 ++-- 8 files changed, 22 insertions(+), 10 deletions(-) rename boards/{esp32s3_devkitm.conf => esp32s3_devkitm_esp32s3_procpu.conf} (100%) rename boards/{esp32s3_devkitm.overlay => esp32s3_devkitm_esp32s3_procpu.overlay} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a8635c..2cf0c21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: west build --sysbuild \ --pristine=always \ - --board=esp32s3_devkitm zephyr-esp32-example \ + --board=esp32s3_devkitm/esp32s3/procpu zephyr-esp32-example \ -- \ -DCONFIG_MEMFAULT_PROJECT_KEY=\"1234\" diff --git a/CMakeLists.txt b/CMakeLists.txt index 515d549..800e273 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 # Default board -set(BOARD esp32c3_devkitm) +set(BOARD esp32s3_devkitm/esp32s3/procpu) cmake_minimum_required(VERSION 3.20.0) diff --git a/README.md b/README.md index 25a1fbe..a88f634 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,10 @@ This sample app is based on the Zephyr `samples/net/wifi` example. It demonstrates a Zephyr + ESP32 integration with the Memfault SDK. It has been tested on the following boards: -- `esp32c3_devkitm` (default board) -- `esp32s3_devkitm` +- `esp32s3_devkitm/esp32s3/procpu` (default board) +- `esp32c3_devkitm`* + +\* _NOTE: Currently does not have support for data upload. Export chunks to memfault with `mflt export` and upload via the [chunks debug log](https://mflt.io/chunks-debug). ## Getting Started @@ -56,7 +58,7 @@ To try out this example app: [00:09:21.911,000] mflt: HW version: esp32c3_devkitm # connect wifi - uart:~$ wifi connect + uart:~$ wifi connect -s "" -k -p "" # test memfault export over uart uart:~$ mflt export diff --git a/boards/esp32c3_devkitm.conf b/boards/esp32c3_devkitm.conf index f7a7e8e..9d37f54 100644 --- a/boards/esp32c3_devkitm.conf +++ b/boards/esp32c3_devkitm.conf @@ -11,4 +11,12 @@ CONFIG_NET_IPV4=y CONFIG_NET_DHCPV4=y CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4=y -CONFIG_NET_LOG=y +# Override selections from prj.conf to save space on this chip +CONFIG_LOG=y +CONFIG_NET_LOG=n +CONFIG_MEMFAULT_LOGGING_ENABLE=n +CONFIG_NET_SHELL=n + +# TODO: Add support for TLS on this chip +# Removed to free up RAM and allow build check to succeed. +CONFIG_MBEDTLS_HEAP_SIZE=0 diff --git a/boards/esp32s3_devkitm.conf b/boards/esp32s3_devkitm_esp32s3_procpu.conf similarity index 100% rename from boards/esp32s3_devkitm.conf rename to boards/esp32s3_devkitm_esp32s3_procpu.conf diff --git a/boards/esp32s3_devkitm.overlay b/boards/esp32s3_devkitm_esp32s3_procpu.overlay similarity index 100% rename from boards/esp32s3_devkitm.overlay rename to boards/esp32s3_devkitm_esp32s3_procpu.overlay diff --git a/prj.conf b/prj.conf index 77dca50..a68d198 100644 --- a/prj.conf +++ b/prj.conf @@ -41,11 +41,11 @@ CONFIG_NET_L2_WIFI_SHELL=y CONFIG_MEMFAULT=y CONFIG_MEMFAULT_LOGGING_ENABLE=y CONFIG_MEMFAULT_HTTP_ENABLE=y -CONFIG_MEMFAULT_TLS_CERTS_USE_DER=y CONFIG_MEMFAULT_HTTP_PERIODIC_UPLOAD=y # Additional network configuration for Memfault features CONFIG_DNS_RESOLVER=y +CONFIG_POSIX_API=y CONFIG_NET_SOCKETS=y CONFIG_TLS_CREDENTIALS=y CONFIG_NET_SOCKETS_SOCKOPT_TLS=y @@ -53,12 +53,14 @@ CONFIG_NET_STATISTICS=y CONFIG_NET_STATISTICS_USER_API=y # MbedTLS config +CONFIG_MBEDTLS_SHA1=y CONFIG_MBEDTLS_SERVER_NAME_INDICATION=y CONFIG_MBEDTLS_ENABLE_HEAP=y CONFIG_MBEDTLS_HEAP_SIZE=30000 CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=4096 CONFIG_MBEDTLS_MEMORY_DEBUG=y CONFIG_MBEDTLS_SHELL=y +CONFIG_MBEDTLS_AES_ROM_TABLES=y # More verbose Memfault component logs CONFIG_MEMFAULT_LOG_LEVEL_DBG=y @@ -76,7 +78,7 @@ CONFIG_MEMFAULT_COREDUMP_COLLECT_TASKS_REGIONS=n # Memfault's http client needs a small amount of heap. Zephyr requires a minimum # heap size for the applied configuration, so select that here to prevent a # build time message -CONFIG_HEAP_MEM_POOL_SIZE=51200 +CONFIG_HEAP_MEM_POOL_SIZE=52224 CONFIG_SYS_HEAP_RUNTIME_STATS=y CONFIG_SHELL_STACK_SIZE=4096 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 diff --git a/west.yml b/west.yml index 01bec9a..b31534b 100644 --- a/west.yml +++ b/west.yml @@ -2,7 +2,7 @@ manifest: projects: - name: zephyr url: https://github.com/zephyrproject-rtos/zephyr - revision: v3.6.0 + revision: v3.7.0 import: # Limit the Zephyr modules to the required set name-allowlist: @@ -13,4 +13,4 @@ manifest: - name: memfault-firmware-sdk url: https://github.com/memfault/memfault-firmware-sdk path: modules/lib/memfault-firmware-sdk - revision: 1.10.1 + revision: 1.11.4