Skip to content

Commit

Permalink
Esp32 build fixes (#2836)
Browse files Browse the repository at this point in the history
Further to #2819 the size mainly seems to relate to two things:

1. WPA3 support is enabled by default, but probably isn't necessary for most applications (could be wrong).
2. More debug stuff in IDF 5.2; release builds are comparable to IDF 4.4.

## Bug fixes

- esp32 timer definitions missing in RELEASE build
- sdkconfig definitions not picked up

## Size fixes

**Disable WPA3 by default**

This is also enabled by default in IDF 4.4 but can always be re-enabled if required.
It adds quite a lot to the image size.

**Don't pull in stdio code from newlib**

Sming doesn't use newlib stdio streams


## Others

- Revise CI tool `scanlog.py` to include missing builds (HostTests)
- Make `checksdk` a pre-requisite
  • Loading branch information
mikee47 committed Jun 25, 2024
1 parent 7806972 commit f69ea9c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 14 deletions.
18 changes: 9 additions & 9 deletions Sming/Arch/Esp32/Components/esp32/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ endif
ESP32_COMPONENT_PATH := $(COMPONENT_PATH)
SDK_DEFAULT_PATH := $(ESP32_COMPONENT_PATH)/sdk

SDK_PROJECT_PATH := $(ESP32_COMPONENT_PATH)/project/$(ESP_VARIANT)/$(BUILD_TYPE)
SDK_CONFIG_DEFAULTS := $(SDK_PROJECT_PATH)/sdkconfig.defaults

SDKCONFIG_MAKEFILE := $(SDK_PROJECT_PATH)/sdkconfig
ifeq ($(MAKE_DOCS),)
-include $(SDKCONFIG_MAKEFILE)
endif
export SDKCONFIG_MAKEFILE # sub-makes (like bootloader) will reuse this path

ifdef IDF_VERSION_52
GLOBAL_CFLAGS += \
-DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ \
Expand Down Expand Up @@ -405,15 +414,6 @@ EXTRA_LDFLAGS += \
-T sections.ld
endif

SDK_PROJECT_PATH := $(ESP32_COMPONENT_PATH)/project/$(ESP_VARIANT)/$(BUILD_TYPE)
SDK_CONFIG_DEFAULTS := $(SDK_PROJECT_PATH)/sdkconfig.defaults

SDKCONFIG_MAKEFILE := $(SDK_PROJECT_PATH)/sdkconfig
ifeq ($(MAKE_DOCS),)
-include $(SDKCONFIG_MAKEFILE)
endif
export SDKCONFIG_MAKEFILE # sub-makes (like bootloader) will reuse this path

FLASH_BOOT_LOADER := $(SDK_BUILD_BASE)/bootloader/bootloader.bin
FLASH_BOOT_CHUNKS := $(CONFIG_BOOTLOADER_OFFSET_IN_FLASH)=$(FLASH_BOOT_LOADER)

Expand Down
5 changes: 5 additions & 0 deletions Sming/Arch/Esp32/Components/esp32/sdk/config/common
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ CONFIG_ETH_USE_SPI_ETHERNET=y
CONFIG_ETH_SPI_ETHERNET_W5500=y
CONFIG_ETH_SPI_ETHERNET_DM9051=y

# WiFi
CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=n
CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=n
CONFIG_ESP_WIFI_SOFTAP_SAW_SUPPORT=n

# Bluetooth
CONFIG_BT_ENABLED=y
CONFIG_BT_BLUEDROID_ENABLED=n
Expand Down
3 changes: 3 additions & 0 deletions Sming/Arch/Esp32/Components/esp32/sdk/esp_system.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ endif
# linker will ignore panic_highint_hdl.S as it has no other files depending on any
# symbols in it.
SDK_UNDEF_SYMBOLS += ld_include_panic_highint_hdl

# IDF 5.2
SDK_WRAP_SYMBOLS += esp_newlib_init_global_stdio
4 changes: 4 additions & 0 deletions Sming/Arch/Esp32/Components/esp32/src/startup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ void main(void*)

} // namespace

extern "C" void __wrap_esp_newlib_init_global_stdio(const char*)
{
}

extern void sming_create_task(TaskFunction_t);

extern "C" void app_main(void)
Expand Down
1 change: 1 addition & 0 deletions Sming/Arch/Esp32/Components/esp32/src/system.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <esp_system.h>
#include <sys/time.h>
#include <esp_timer.h>
#include <esp_task_wdt.h>
#include <sming_attr.h>
#include <string.h>
Expand Down
18 changes: 13 additions & 5 deletions Tools/ci/scanlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def __next__(self):


def scan_log(filename: str):
BUILD_PREFIX = 'Building /home/runner/'
IGNORE_PREFIX = ['projects/', 'work/Sming/Sming/Sming/']
state = State.searching
table = Table(os.path.basename(filename))
target = None
Expand All @@ -97,10 +99,15 @@ def scan_log(filename: str):
dtstr, _, line = line.strip().partition(' ')
if not dtstr:
continue
_, sep, c = line.partition('** Building ')
if sep:
target, _, _ = c.partition(' ')
target = target.removeprefix('/home/runner/projects/')
if state == State.searching:
if not line.startswith(BUILD_PREFIX):
continue
if 'clib-App' not in line:
continue
c = line[len(BUILD_PREFIX):]
for prefix in IGNORE_PREFIX:
c = c.removeprefix(prefix)
target, _, _ = c.partition('/out/')
row = {
'target': target
}
Expand All @@ -121,7 +128,8 @@ def scan_log(filename: str):
elif ' : ' in line:
k, v = line.split(':')
else:
table.append(row)
if len(row) > 1: # Not just target (discard host builds)
table.append(row)
row = None
state = State.searching
continue
Expand Down

0 comments on commit f69ea9c

Please sign in to comment.