esp32: runtime panic on empty main function
I'm trying out tinygo on an ESP32-D0WD-V3 (revision v3.1) chip. Minimal code.
package main
func main() {
for {
}
}
tinygo build -target=esp32 -o firmware.bin ./
flash
esptool.py v4.10.0
Serial port COM11
Connecting....
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 44:1d:64:f6:0a:bc
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00010000 to 0x00010fff...
Compressed 2896 bytes to 2261...
Wrote 2896 bytes (2261 compressed) at 0x00010000 in 0.1 seconds (effective 323.6 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...`
And result is:
`PS C:\repo\tinyGo_esp32> tinygo monitor -port COM11
Connected to COM11. Press Ctrl-C to exit.
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6380
ho 0 tail 12 room 4
load:0x40078000,len:15916
load:0x40080400,len:3860
entry 0x40080638
I (29) boot: ESP-IDF v5.5.1 2nd stage bootloader
I (29) boot: compile time Nov 1 2025 18:10:02
I (29) boot: Multicore bootloader
I (31) boot: chip revision: v3.1
I (33) boot.esp32: SPI Speed : 40MHz
I (37) boot.esp32: SPI Mode : DIO
I (41) boot.esp32: SPI Flash Size : 2MB
I (44) boot: Enabling RNG early entropy source...
I (49) boot: Partition Table:
I (51) boot: ## Label Usage Type ST Offset Length
I (58) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (64) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (71) boot: 2 factory factory app 00 00 00010000 00100000
I (77) boot: End of partition table
I (81) esp_image: segment 0: paddr=00010020 vaddr=3ffaf000 size=00098h ( 152) load
I (88) esp_image: segment 1: paddr=000100c0 vaddr=40080000 size=00a6ch ( 2668) load
I (97) boot: Loaded app from partition at offset 0x10000
I (100) boot: Disabling RNG early entropy source...
abort() was called at PC 0x4007958d```
I tried to flash the card using tinygo flash but got
PS C:\repo\tinyGo_esp32> tinygo flash -target=esp32 -port=COM11 failed to flash C:\Users\ALSEME~1\AppData\Local\Temp\tinygo2720689625\main.bin: fork/exec C:\esp\v5.5.1\esp-idf\components\esptool_py\esptool\esptool.py: %1 is not a valid Win32 application. PS C:\repo\tinyGo_esp32>
-target=esp32
That is not a valid board target. You have to specify a board such as -target=esp32_coreboard_v2.
Also that is not really valid code. Perhaps you want to flash something like the blinky example?
Hope that helps!
Hope that helps!
Sorry but no
I changed the code, took it from the example.
package main
import (
"machine"
"time"
)
func main() {
led := machine.LED
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
for {
led.Low()
time.Sleep(time.Millisecond * 500)
led.High()
time.Sleep(time.Millisecond * 500)
}
}
PS C:\repo\tinyGo_esp32> tinygo build -target=esp32-coreboard-v2 -o firmware.bin ./
PS C:\repo\tinyGo_esp32> C:\Espressif\python_env\idf5.5_py3.11_env\Scripts\python.exe C:\esp\v5.5.1\esp-idf\components\esptool_py\esptool\esptool.py -p COM11 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash 0x10000 firmware.bin
esptool.py v4.10.0
Serial port COM11
Connecting....
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 44:1d:64:f6:0a:bc
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00010000 to 0x00010fff...
Compressed 3616 bytes to 2817...
Wrote 3616 bytes (2817 compressed) at 0x00010000 in 0.1 seconds (effective 340.3 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
PS C:\repo\tinyGo_esp32> tinygo monitor -port COM11
Connected to COM11. Press Ctrl-C to exit.
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6380
ho 0 tail 12 room 4
load:0x40078000,len:15916
load:0x40080400,len:3860
entry 0x40080638
I (29) boot: ESP-IDF v5.5.1 2nd stage bootloader
I (29) boot: compile time Nov 1 2025 18:10:02
I (29) boot: Multicore bootloader
I (31) boot: chip revision: v3.1
I (33) boot.esp32: SPI Speed : 40MHz
I (37) boot.esp32: SPI Mode : DIO
I (41) boot.esp32: SPI Flash Size : 2MB
I (44) boot: Enabling RNG early entropy source...
I (49) boot: Partition Table:
I (51) boot: ## Label Usage Type ST Offset Length
I (58) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (64) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (71) boot: 2 factory factory app 00 00 00010000 00100000
I (77) boot: End of partition table
I (81) esp_image: segment 0: paddr=00010020 vaddr=3ffaf000 size=00098h ( 152) load
I (88) esp_image: segment 1: paddr=000100c0 vaddr=40080000 size=00d3ch ( 3388) load
I (97) boot: Loaded app from partition at offset 0x10000
I (100) boot: Disabling RNG early entropy source...
abort() was called at PC 0x4007958d
PS C:\repo\tinyGo_esp32>```
But it didn't help.