ESP32-P4 Boot loop, Illegal Instruction panics 55.03.37 & 55.03.35

Hi,

I recently tried to update the platform version for my project from 53.XX.XX to latest 55.03.37. This caused a looping boot crash of Illegal Instruction panics, i also tried 55.03.35, same issue, it was only 54.03.21-2 that i could get working.

Its an Arduino framework project.

The project ini currently:

; ============================================================================
; Creo_Presenter_Remote - PlatformIO configuration (ESP32-P4)
; Mainline build targets:
;   - olimex-esp32-p4        (default)
;   - olimex-esp32-p4_debug  (debug)
; Legacy / esp32dev environments live in: platformio_legacy.ini
; ============================================================================
[platformio]
default_envs = olimex-esp32-p4
src_dir = src

; ----------------------------------------------------------------------------
; Common settings applied to all envs in this file
; ----------------------------------------------------------------------------

[env]
; NOTE (ESP32-P4): 55.03.36+ / 55.03.37 can boot-loop with pre-setup
; Illegal Instruction panics on some P4 devices. Keep the default on 55.03.35
; and provide explicit fallback envs below for fast A/B checks.

platform          = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21-2/platform-espressif32.zip
framework         = arduino
monitor_speed     = 115200
monitor_filters   = esp32_exception_decoder
extra_scripts     =
pre:buildscript_versioning.py
pre:toolchain_path_fix.py
; If you want to pin Arduino core later, you can re-enable this section
;platform_packages =
; Shared include paths + diagnostic flags
build_flags =
  -DCONFIG_ARDUHAL_POST_SETUP_HEAP_DUMP=0
  -I"${PROJECT_DIR}/include"
  -I"${PROJECT_DIR}/src/app/include"
  -I"${PROJECT_DIR}/src/hal/bsp/include"
  -Wl,-Map,${PROGNAME}.map
  -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_ERROR
  -DLOG_LOCAL_LEVEL=0
; -------------------------------------------------------------------------
; Log toggles (compile-time). Default to quiet logs for production.
; Enable as needed by adding =1.
; -------------------------------------------------------------------------
  -DDISPLAY_LOG_CAMSTATUS=0
  -DPWRLIGHT_LOG_OFFLINE_GUARD=0
  -DNETWORK_RECOVERY_LOG_STATE=0
; -------------------------------------------------------------------------
; Recovery / reachability probe tuning (compile-time).
; Note: “ping” is a strictly time-bounded reachability probe used by central
; recovery (and a couple of module-local health checks).
; -------------------------------------------------------------------------
  -DNETWORK_RECOVERY_PING_TIMEOUT_MS=200
  -DCAMS_PING_TIMEOUT_MS=250
  -DPWRLIGHT_CLIENT_HEALTH_TIMEOUT_MS=200
  -DBOARD_HAS_PSRAM
  -DCUSTOM_DISPLAY_LIB
  -DCONFIG_FREERTOS_USE_TRACE_FACILITY=1
  -DCONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=1
  -DCONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER=1
  -DCONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=1
  -DCONFIG_ASYNC_TCP_STACK_SIZE=32768
  -Wno-deprecated-declarations

; -------------------------------------------------------------------------
; CAN / TWAI (classic CAN) config (compile-time)
; -------------------------------------------------------------------------
; Default is disabled so builds work without wiring.
; Set CREO_CAN_ENABLE=1 and pick valid GPIOs for your transceiver module.
  -DCREO_CAN_ENABLE=1
  ; -DCREO_CAN_TX_PIN=22
  ; -DCREO_CAN_RX_PIN=21
   -DCREO_CAN_BITRATE=500000
  -DCREO_PMU16_SIM=0

  ; Optional CAN bus sniffer + BlinkMarine self-test helpers (debug only)
  ; -DCREO_CAN_SNIFF=1
  -DCREO_BM_TEST=1
  -DCREO_BM_NODEID=0x15
; -DCREO_CAN_SELFTEST=1 ; internal self-reception test (prints PASS/FAIL once at boot)
; -DCREO_CAN_TWAI_MODE=2 ; 2=listen-only (passive sniff), 1=no-ack, 0=normal
; -DCREO_CAN_DIAG=1  ; prints TWAI error counters/state once per second
; -DCREO_FD_VERBOSE_DIAG=1 ; FD tracking diag (heavy, can cause boot WDT on P4 - debug only)
; If your keypad powers up in J1939 mode, try forcing a switch to CANopen:
; -DCREO_BM_TRY_J1939_TO_CANOPEN=1
; -DCREO_BM_J1939_ADDR=0x21
; Libraries shared across both release + debug

lib_deps =
  ESP32Async/AsyncTCP@3.4.2
  ESP32Async/ESPAsyncWebServer@3.7.7
  bblanchon/ArduinoJson@^7.4.1
  Networking
  adafruit/Adafruit GFX Library@^1.12.1
  adafruit/Adafruit SSD1351 Library@^1.0.6

lib_ignore =
  AsyncTCP_RP2040W
  ESPAsyncTCP

; Filesystem and partitions
board_build.filesystem = spiffs

; ----------------------------------------------------------------------------
; Mainline environment (ESP32-P4)
; ----------------------------------------------------------------------------
[env:olimex-esp32-p4]
board = olimex-esp32-p4
board_build.partitions = default_16MB.csv
build_flags =
  ${env.build_flags}
  -DCREO_BOARD_ESP32_P4
  -DARDUINO_USB_MODE=1
  -DARDUINO_USB_CDC_ON_BOOT=1
  -DSERVICE_MANAGER_ENABLED
; ----------------------------------------------------------------------------
; Debug environment (ESP32-P4) - extends mainline env
; ----------------------------------------------------------------------------
[env:olimex-esp32-p4_debug]
extends = env:olimex-esp32-p4
build_type = debug
build_flags =
  ${env:olimex-esp32-p4.build_flags}
  -DDEBUG_LONG_CRIT
  -DWSDEBUG_ENABLED=1
  ; -DDEV_FORCE_DELETE_ON_STOP_TIMEOUT=1   ; removed: unsafe in production (avoid vTaskDelete() fallback)

I had to delete some of the ini as apparently the post cannot contain more the 2 links….

Has anyone experienced similar issues on the ESP32-P4 using Arduino Framework?

Many thanks

You are using PioArduino instead of the official ESP32 platform (as is understandable for ESP32P4 support). As thus, file an issue against https://github.com/pioarduino/platform-espressif32/issues if you think the platform is at fault. You should verify that the most simple “blink” sketch can be compiled and uploaded without crashing.

Yeah thats a fair point, I will do that, thanks

And yes, from what i understand pioarduino is the only real option for updated P4 support, is that a branch of PIO that will merge in the future or are they diverging in terms of IDF and Arduino now?