Error programming LN02 board(LN882x chipset)

Hello! I am trying to program a LN02 board (hosting a LN882x chipset) using ESPHOME. I get the following error from ESPHome builder:

INFO ESPHome 2025.10.5
INFO Reading configuration /config/esphome/ln02.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing ln02 (board: ln-02; framework: arduino; platform: libretiny @ 1.9.1)
--------------------------------------------------------------------------------
Warning! Non-Git installations are NOT SUPPORTED.
HARDWARE: LN882HK 160MHz, 295KB RAM, 1.17MB Flash
 - framework-arduino-api @ 2022.8.24+sha.237b10a 
 - framework-lightning-ln882h @ 0.0.0+v2025.01.18.sha.8794085 
 - library-flashdb @ 1.2.0+sha.d5c892f 
 - library-freertos @ 9.0.0+sha.95cc959 
 - library-freertos-port @ 2025.1.18+sha.dbfc408 
 - library-lwip @ 2.1.3-ln882h+sha.7ef5aac 
 - library-printf @ 6.1.0+sha.28a79bd 
 - library-uf2ota @ 5.0.0+sha.f955412 
PLATFORM VERSIONS:
 - libretiny @ 1.9.1
 - ltchiptool @ 4.12.2
CUSTOM OPTIONS:
 - fw_name = esphome
 - fw_version = 2025.10.5
Dependency Graph
|-- AsyncTCP @ 3.4.5
|-- ESPAsyncWebServer @ 3.7.10
|-- DNSServer @ 1.1.0
|-- noise-c @ 0.1.10
Linking .pioenvs/ln02/raw_firmware.elf
|-- Image 1: raw_firmware.elf
/data/cache/platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: .pioenvs/ln02/libln882h_sdk.a(cm_backtrace.c.o): in function `get_cur_thread_stack_info':
/data/cache/platformio/packages/framework-lightning-ln882h/components/utils/debug/CmBacktrace/cm_backtrace.c:211: undefined reference to `vTaskStackAddr'
/data/cache/platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /data/cache/platformio/packages/framework-lightning-ln882h/components/utils/debug/CmBacktrace/cm_backtrace.c:212: undefined reference to `vTaskStackSize'
/data/cache/platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: .pioenvs/ln02/libln882h_sdk.a(cm_backtrace.c.o): in function `get_cur_thread_name':
/data/cache/platformio/packages/framework-lightning-ln882h/components/utils/debug/CmBacktrace/cm_backtrace.c:244: undefined reference to `vTaskName'
/data/cache/platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /data/cache/platformio/packages/framework-lightning-ln882h/components/utils/debug/CmBacktrace/cm_backtrace.c:244: undefined reference to `vTaskName'
collect2: error: ld returned 1 exit status
|-- Generated file not found: .pioenvs/ln02/raw_firmware.elf
*** [.pioenvs/ln02/raw_firmware.elf] Error 1
========================= [FAILED] Took 17.14 seconds =========================

Any idea on how to address this? I have created the device without any specific sensors configuration, so I get the error with the default YAML created by the builder.

Thanks in advance!

Is that the latest version of ESPHome?

Maybe post the yaml (formatted) for clues.

I also have LED bulbs with LN882 and only LibreTiny works, but I would like to switch directly to esphome.

@Grax71
I installed ESPHome to a LN02 quiet a while ago, but switched back to OpenBeken, because of the poor compatibility. Maybe it is better meanwhile.

Just tested now. ESPHome Builder compiles the basic LN2.uf2 with success.
Maybe have a try with clean build files befor compiling.
And I think for first ESPHome-flash you need to do by uart.

Compiling .pioenvs/xxx/ln882h_sdk/mcu/ln882h/system_ln882h.c.o
Archiving .pioenvs/xxx/libln882h_sdk.a
Linking .pioenvs/xxx/raw_firmware.elf
|-- Image 1: raw_firmware.elf
|   |-- image_firmware.0x000000.bin
|   |   |-- raw_firmware.bin
PASS -- checking .pioenvs/xxx/boot.bin
PASS -- checking .pioenvs/xxx/raw_firmware.bin
RAM:   [====      ]  37.7% (used 113968 bytes from 302080 bytes)
Flash: [====      ]  43.6% (used 535236 bytes from 1228800 bytes)
Building UF2 OTA image
|-- esphome_2025.11.1_ln-02_ln882hk_lt1.9.1.uf2
|-- firmware.uf2
|-- firmware.bin
======================== [SUCCESS] Took 363.14 seconds ========================
Warning! Non-Git installations are NOT SUPPORTED.
INFO Successfully compiled program.

Hello,
I’m getting the same error as @Grax71. ESPHome versions I tried: 2025.11.2, 2025.10.4, maybe earlier as well. Here is my .yaml:

substitutions:
  mac: "d9fc"
  area: ""
  instance: "${mac} test"

  name: "wdh02"
  friendly_name: "WDH02"

  domain: ".xxxxxxx"
  ssid: "xxxxxxx"
  psk: "xxxxxxxxxxxx"

esphome:
  name: "${name}-${mac}"
  area: "${area}"
  friendly_name: "${friendly_name}/${instance}"

ln882x:
  board: ln-02

wifi:
  ssid: "${ssid}"
  password: "${psk}"
  domain: "${domain}"
  use_address: "${friendly_name}-${mac}${domain}"
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap: {}

captive_portal:
    
# Enable logging
logger:
  baud_rate: 0
  level: DEBUG

# Enable Home Assistant API
api:

ota:
  - platform: esphome

web_server:
  version: 2
  port: 80

button:
  - id: restart_btn
    platform: restart
    name: "restart"

  - id: safe_btn
    platform: safe_mode
    name: "safe mode"