Skip to content

Commit

Permalink
chore(zephyr): upgrade to Zephyr v3.7.0 (#10)
Browse files Browse the repository at this point in the history
### 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
  • Loading branch information
gminn authored Sep 11, 2024
1 parent 4f5e136 commit 41ddb87
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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\"
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -56,7 +58,7 @@ To try out this example app:
[00:09:21.911,000] <inf> mflt: HW version: esp32c3_devkitm

# connect wifi
uart:~$ wifi connect <ssid> <pw>
uart:~$ wifi connect -s "<ssid>" -k <key type> -p "<pw>"

# test memfault export over uart
uart:~$ mflt export
Expand Down
10 changes: 9 additions & 1 deletion boards/esp32c3_devkitm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,26 @@ 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
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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

0 comments on commit 41ddb87

Please sign in to comment.