Custom firmware error: cannot execute binary file: Exec format error



  • Hi, I am experiencing issues with using the pycom-micropython-sigfox library to build a custom firmware. I've created an issue ticket on github but would like to post it here in search for someone knowing a resolve here or could benefit from this when searching for the same problem. https://github.com/pycom/pycom-micropython-sigfox/issues/601

    Original Information

    Running into errors when building custom firmware and found no resolve in the issues forum. Could I please get some assistance?

    • Pycom board: FiPy

    • Firmware: (sysname='FiPy', nodename='FiPy', release='1.20.2.r6', version='v1.11-c5a0a97 on 2021-10-28', machine='FiPy with ESP32', lorawan='1.0.2', sigfox='1.0.1', pybytes='1.7.1')

    • Operating system: Linux raspberrypi 5.10.17-v7+ #1414 SMP Fri Apr 30 13:18:35 BST 2021 armv7l GNU/Linux

    • Exact steps to cause this issue

      1. I completed the setup as per instructed in README file.
      2. Then tried to build the firmware with make BOARD=FIPY clean - no problems there
      3. Then I tried to run make BOARD=FIPY which yielded the error below
    • What you expected

      • I expected the firmware to successfully build however this was not the case.
    • What happened instead

      • Instead I got the following error:
    $ make BOARD=FIPY V=1 
    Use make SECURE=on [optionally SECURE_KEY ?= secure_boot_signing_key.pem] to enable Secure Boot and Flash Encryption mechanisms.
    COAP Module Enabled
    LORA Module Enabled
    SIGFOX Module Enabled
    Variant: BASE
    bash tools/idfVerCheck.sh /home/pi/pycom-esp-idf "3394ee5"
    IDF Version OK! 3394ee5
    bash tools/mpy-build-check.sh FIPY release BASE
    python check_secure_boot.py --SECURE off
    CC bootloader/bootloader.c
    xtensa-esp32-elf-gcc -DESP_PLATFORM -Wpointer-arith -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wl,-EL -mlongcalls -Wall -ffunction-sections -fdata-sections -fno-common -Wno-sign-compare -Wno-old-style-declaration -fstrict-volatile-bitfields -Wno-error=deprecated-declarations -Wno-unused-parameter -DWITH_POSIX  -mfix-esp32-psram-cache-issue -Os -nostdlib -std=gnu99 -g3 -ggdb -fstrict-volatile-bitfields -Iboards/FIPY -DFFCONF_H=\"lib/oofatfs/ffconf.h\"  -DMOD_COAP_ENABLED -DMOD_LORA_ENABLED -DMOD_SIGFOX_ENABLED -I. -I.. -Ihal -Iutil -Imods -Itelnet -Iftp -Ilora -Ilte -Ican -Ibootloader -Ifatfs/src/drivers -Ilittlefs -Ibuild/FIPY/release -Ibuild/FIPY/release/genhdr -I/home/pi/pycom-esp-idf/components/bootloader_support/include -I/home/pi/pycom-esp-idf/components/bootloader_support/include_priv -I/home/pi/pycom-esp-idf/components/bootloader_support/include_bootloader -I/home/pi/pycom-esp-idf/components/mbedtls/mbedtls/include -I/home/pi/pycom-esp-idf/components/mbedtls/port/include -I/home/pi/pycom-esp-idf/components/driver/include -I/home/pi/pycom-esp-idf/components/driver/include/driver -I/home/pi/pycom-esp-idf/components/heap/include -I/home/pi/pycom-esp-idf/components/esp32 -I/home/pi/pycom-esp-idf/components/esp32/include -I/home/pi/pycom-esp-idf/components/esp_ringbuf/include -I/home/pi/pycom-esp-idf/components/esp_event/include -I/home/pi/pycom-esp-idf/components/esp_adc_cal/include -I/home/pi/pycom-esp-idf/components/soc/include -I/home/pi/pycom-esp-idf/components/soc/esp32/include -I/home/pi/pycom-esp-idf/components/expat/include -I/home/pi/pycom-esp-idf/components/freertos/include -I/home/pi/pycom-esp-idf/components/json/include -I/home/pi/pycom-esp-idf/components/expat/include -I/home/pi/pycom-esp-idf/components/lwip/include/lwip -I/home/pi/pycom-esp-idf/components/lwip/include/lwip/port -I/home/pi/pycom-esp-idf/components/lwip/include/apps -I/home/pi/pycom-esp-idf/components/lwip/port/esp32/include -I/home/pi/pycom-esp-idf/components/lwip/lwip/src/include -I/home/pi/pycom-esp-idf/components/lwip/include/lwip/posix -I/home/pi/pycom-esp-idf/components/newlib/include -I/home/pi/pycom-esp-idf/components/newlib/platform_include -I/home/pi/pycom-esp-idf/components/nvs_flash/include -I/home/pi/pycom-esp-idf/components/spi_flash/include -I/home/pi/pycom-esp-idf/components/tcpip_adapter/include -I/home/pi/pycom-esp-idf/components/log/include -I/home/pi/pycom-esp-idf/components/sdmmc/include -I/home/pi/pycom-esp-idf/components/vfs/include -I/home/pi/pycom-esp-idf/components/bt/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/device/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/device/include/device -I/home/pi/pycom-esp-idf/components/bt/bluedroid/bta/dm -I/home/pi/pycom-esp-idf/components/bt/bluedroid/bta/hh -I/home/pi/pycom-esp-idf/components/bt/bluedroid/bta/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/bta/sys/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/common/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/stack/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/stack/gatt/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/stack/gap/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/stack/l2cap/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/btcore/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/osi/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/hci/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/gki/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/api/include -I/home/pi/pycom-esp-idf/components/bt/bluedroid/btc/include -I/home/pi/pycom-esp-idf/components/coap/libcoap/include/coap -I/home/pi/pycom-esp-idf/components/coap/libcoap/examples -I/home/pi/pycom-esp-idf/components/coap/port/include -I/home/pi/pycom-esp-idf/components/coap/port/include/coap -I/home/pi/pycom-esp-idf/components/mdns/include -I../lib/mp-readline -I../lib/netutils -I../lib/oofatfs -I../lib -I../drivers/sx127x -I../ports/stm32 -I/home/pi/pycom-esp-idf/components/openthread/src -Ibsdiff -DMICROPY_NLR_SETJMP=1 -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' -DHAVE_CONFIG_H -DESP_PLATFORM -DFFCONF_H=\"lib/oofatfs/ffconf.h\" -DWITH_POSIX -DREGION_AS923 -DREGION_AU915 -DREGION_EU868 -DREGION_US915 -DREGION_CN470 -DREGION_EU433 -DREGION_IN865 -DBASE=0 -DPYBYTES=1  -DVARIANT=0 -DNDEBUG -D BOOTLOADER_BUILD=1 -c -MD -o build/FIPY/release/bootloader/bootloader.o bootloader/bootloader.c
    bash: /home/pi/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc: cannot execute binary file: Exec format error
    make: *** [../py/mkrules.mk:47: build/FIPY/release/bootloader/bootloader.o] Error 126
    
    


  • Hi @livius, thank you for pointing that out.

    Yes I had been running on RaspberryPi thinking it would be better than running on a substystem for Linux. I was initially struggling with using Windows Subsystem for Linux (WSL) and following the instructions listed on github. I had extracted the xtensa gcc compiler tar.gz file incorrectly, by using WinRAR onto my Ubuntu file system - this must've corrupted some of the data.

    This time, I copied the tar.gz file into the Ubuntu file system and extracted it using Linux commands, the process had run smoothly and I was able to build a binary file.

    Thank you very much!



  • @Anthony-Leung
    Hi, why did you write???
    Operating system: Linux raspberrypi 5.10.17-v7+ #1414 SMP Fri Apr 30 13:18:35 BST 2021 armv7l GNU/Linux

    Do you try to build this firmware on raspberrypi?
    If yes, try first to build on some more common system, if there will be ok, then probably not supported on rpi


Log in to reply
 

Pycom on Twitter