niicoooo / esp32-elfloader

esp32 component to load in ram and relocate elf file
GNU General Public License v2.0
82 stars 12 forks source link

Example payload cannot run new compile ELF #3

Open tomphan opened 3 weeks ago

tomphan commented 3 weeks ago

Hi. I was able to run the test payload defined as a C array in the payload.h: unsigned char example_payload_payload_elf[].

However when I try to compile the example main.c code to new ELF and put the new ELF into the C array for loading & running, the board crashed.

The command line to compile:

d:\PlatformIO\packages\toolchain-xtensa-esp32\bin\xtensa-esp32-elf-gcc  -fno-common -Wl,-r -nostartfiles -nodefaultlibs -nostdlib -g -o payload.elf -Wl,-e,local_main -Wl,-Tesp32.ld main/main.c
d:\PlatformIO\packages\toolchain-xtensa-esp32\bin\xtensa-esp32-elf-strip --strip-unneeded payload.elf

My board is an ESP32-S3.

Please advise. Thanks.

tomphan commented 3 weeks ago

I was able to compile the payload, by downloading the archived ESP-IDF v3.3 (using makefile instead of CMake) and run it in Ubuntu instead of Windows.

The issue is resolved.