Upload Filesystem Image OTA issue on macbook air M2 issue

Hello,
I get the “bad cpu type in executable” when I try to create spiffs.bin in my project, see error:
Executing task: platformio run --target uploadfsota --environment az-delivery-devkit-v4

Processing az-delivery-devkit-v4 (platform: espressif32; board: az-delivery-devkit-v4; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: Espressif 32 (6.0.0) > AZ-Delivery ESP-32 Dev Kit C V4
HARDWARE: ESP32 240MHz, 520KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

  • framework-arduinoespressif32 @ 3.20006.221224 (2.0.6)
  • tool-esptoolpy @ 1.40400.0 (4.4.0)
  • tool-mkfatfs @ 2.0.1
  • tool-mklittlefs @ 1.203.210628 (2.3)
  • tool-mkspiffs @ 2.230.0 (2.30)
  • toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
    LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 37 compatible libraries
    Scanning dependencies…
    Dependency Graph
    |-- AsyncElegantOTA @ 2.2.7
    | |-- AsyncTCP-esphome @ 2.0.0
    | |-- ESPAsyncWebServer-esphome @ 3.0.0
    | | |-- AsyncTCP-esphome @ 2.0.0
    | | |-- FS @ 2.0.0
    | | |-- WiFi @ 2.0.0
    | |-- FS @ 2.0.0
    | |-- Update @ 2.0.0
    | |-- WiFi @ 2.0.0
    |-- ESPAsyncWebServer-esphome @ 3.0.0
    | |-- AsyncTCP-esphome @ 2.0.0
    | |-- FS @ 2.0.0
    | |-- WiFi @ 2.0.0
    |-- AsyncTCP-esphome @ 2.0.0
    |-- Arduino_JSON @ 0.2.0
    |-- SPIFFS @ 2.0.0
    | |-- FS @ 2.0.0
    |-- WiFi @ 2.0.0
    Building in release mode
    Building FS image from ‘data’ directory to .pio/build/az-delivery-devkit-v4/spiffs.bin
    sh: /Users/christianleleux/.platformio/packages/tool-mkspiffs/mkspiffs_espressif32_arduino: Bad CPU type in executable
    *** [.pio/build/az-delivery-devkit-v4/spiffs.bin] Error 126
    ======================================== [FAILED] Took 0.51 seconds ========================================
  • The terminal process “platformio ‘run’, ‘–target’, ‘uploadfsota’, ‘–environment’, ‘az-delivery-devkit-v4’” terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

I’m using the Platforio IDE v2.5.5

Is this issue related to the Apple silicon (M2) or I have to dig elsewhere?
Thanks for your help

Do you have Rosetta 2 installed to be able to execute Intel x64 binaries?

Hi, I check to install it but seems that the install start ‘automatically’ when needed. Seems there is no option to install it pro-activelly (that’s my research so far…).
I’m using macos Ventura on a macbookair M2

Just check my configuration and discovers that I’ve Rosetta 2 installed.

Unfortunatelly, this didn’t solve my issue.
Thanks for your help

To double check, can you paste the first detection script into a check.sh file and execute it in the terminal?

Also what is the result of

otool -L /Users/christianleleux/.platformio/packages/tool-mkspiffs/mkspiffs_espressif32_arduino
file /Users/christianleleux/.platformio/packages/tool-mkspiffs/mkspiffs_espressif32_arduino

in the terminal?

Here are the results

  • Detection script : Missing
  • The second commands :

/Users/christianleleux/.platformio/packages/tool-mkspiffs/mkspiffs_espressif32_arduino (architecture i386):
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/Users/christianleleux/.platformio/packages/tool-mkspiffs/mkspiffs_espressif32_arduino (architecture x86_64):
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can’t open file: file (No such file or directory)
/Users/christianleleux/.platformio/packages/tool-mkspiffs/mkspiffs_espressif32_arduino (architecture i386):
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/Users/christianleleux/.platformio/packages/tool-mkspiffs/mkspiffs_espressif32_arduino (architecture x86_64):
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
christianleleux@chris HomePilot %

I’m a newbee to macos, so I have some trouble to understand the “missing” script output as I see the Rosetta 2 in the list of installed app :frowning:

But that’s the smoking gun then, the script tried to execute arch -x86_64 /usr/bin/true and it got back an error message, indicating Rosetta 2 is not not installed. What happens when you enter the suggested install command in the terminal?

/usr/sbin/softwareupdate –install-rosetta –agree-to-license

I need to sudo it maybe?

No the website auto-concatenated two -- into one long -. Please execute

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

instead.

1 Like

Problem solved with the right softwareupdate command!
A warm thank you for your help, especially apreciated by a macos newbee.
Rosetta install solve the issue; The script out put is installed now. Here is the result of the creation of the spiffs.bin

 *  Executing task: platformio run --target buildfs --environment az-delivery-devkit-v4 

Processing az-delivery-devkit-v4 (platform: espressif32; board: az-delivery-devkit-v4; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/az-delivery-devkit-v4.html
PLATFORM: Espressif 32 (6.0.0) > AZ-Delivery ESP-32 Dev Kit C V4
HARDWARE: ESP32 240MHz, 520KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20006.221224 (2.0.6) 
 - tool-esptoolpy @ 1.40400.0 (4.4.0) 
 - tool-mkspiffs @ 2.230.0 (2.30) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 37 compatible libraries
Scanning dependencies...
Dependency Graph
|-- AsyncElegantOTA @ 2.2.7
|   |-- AsyncTCP-esphome @ 2.0.0
|   |-- ESPAsyncWebServer-esphome @ 3.0.0
|   |   |-- AsyncTCP-esphome @ 2.0.0
|   |   |-- FS @ 2.0.0
|   |   |-- WiFi @ 2.0.0
|   |-- FS @ 2.0.0
|   |-- Update @ 2.0.0
|   |-- WiFi @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.0.0
|   |-- AsyncTCP-esphome @ 2.0.0
|   |-- FS @ 2.0.0
|   |-- WiFi @ 2.0.0
|-- AsyncTCP-esphome @ 2.0.0
|-- Arduino_JSON @ 0.2.0
|-- SPIFFS @ 2.0.0
|   |-- FS @ 2.0.0
|-- WiFi @ 2.0.0
Building in release mode
Building FS image from 'data' directory to .pio/build/az-delivery-devkit-v4/spiffs.bin
/index.html
/script.js
/style.css
========================================================= [SUCCESS] Took 0.51 seconds =========================================================
 *  Terminal will be reused by tasks, press any key to close it.
1 Like