I develop for ESP32 with VS Code using the arduino framework.
I want to have a compact .bin file for upload with OTA.
How I build the binary without embedded source code?
I have tried the option -s and -Wl,-s without success.
thank You for advice
…where do you see source code embedded? Are you talking about the filenames that apepars through asserts in the
the file firmware.bin is too big.
If I analyze them with an editor I see much text from source.
Can you show an example of that?
Only thing that comes to mind would be Error/Debug Messages in .bin file - #6 by owenh-mgp with adding
I put this lines in platform.ini
But there are still source lines in firmware.bin
the line to compile is:
xtensa-esp32-elf-g++ -o .pio\build\esp32cam\src\app_httpd.cpp.o -c -fno-rtti -fno-exceptions -std=gnu++11 -mfix-esp32-psram-cache-issue -O3 -Wall -nostdlib -Wpointer-arith -Wno-error=unused-but-set-variable -Wno-error=unused-variable -mlongcalls -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wno-error=deprecated-declarations -Wno-error=unused-function -Wno-unused-parameter -Wno-sign-compare -fstack-protector -fexceptions -Werror=reorder -DPLATFORMIO=60111 -DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DNDEBUG -DCORE_DEBUG_LEVEL=0 -DESP32 -DESP_PLATFORM -DF_CPU=240000000L -DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DARDUINO=10805 -DARDUINO_ARCH_ESP32
The first lines in firmware.bin you find in
That’s not “source code”. Those are text strings that the firmware uses for HTTP handling and logging. A lot of it seems to be coming from the camera module or code, your code was maybe inspired by this. If you don’t want these (optional) strings to show up, you’ll have to find where they are in code and comment them out, or put them in a
block, or convert them to
ESP_LOGI, etc, like show here, so that they are optimized away through the
CORE_DEBUG_LEVEL=0 setting (this disables all ESP_LOGx functions).
Of course, some strings will be mandatory. You can’t really e.g. optimze away the HTTP header strings your program is using in its HTTP transmissions.
Thank You so much.
I will be satisfied with the result.