I found Arduino very slow to compile. After a day of struggle, I managed to get it working in Visual Studio Code + PlatformIO, which is a lot faster (few seconds instead of 5 minutes)
Here is how to do it:
Install visual studio code and platformio.
Install some heltec esp board so it will download the compilers.
Create a new file in the “boards” directory of .platformio:
c:\Users\user.platformio\platforms\espressif32\boards\heltec_wireless_tracker.json
{
“build”: {
“arduino”: {
“ldscript”: “esp32s3_out.ld”,
“partitions”: “default.csv”
},
“core”: “esp32”,
“extra_flags”: [
“-DWireless_Track”,
“-DARDUINO_USB_MODE=1”,
“-DARDUINO_RUNNING_CORE=1”,
“-DARDUINO_EVENT_RUNNING_CORE=1”,
“-DARDUINO_USB_CDC_ON_BOOT”
],
“f_cpu”: “240000000L”,
“f_flash”: “80000000L”,
“flash_mode”: “qio”,
“hwids”: [
[
“0x303A”,
“0x1001”
]
],
“mcu”: “esp32s3”,
“variant”: “heltec_wireless_tracker”
},
“connectivity”: [
“wifi”,
“bluetooth”,
“lora”,
“gps”
],
“debug”: {
“openocd_target”: “esp32s3.cfg”
},
“frameworks”: [
“arduino”,
“espidf”
],
“name”: “Heltec Wireless Tracker”,
“upload”: {
“flash_size”: “8MB”,
“maximum_ram_size”: 327680,
“maximum_size”: 8388608,
“require_upload_port”: true,
“speed”: 1036800
},
“url”: “https://heltec.org/project/wireless-tracker/”,
“vendor”: “Heltec”
}
add the following to:
c:\Users\user.platformio\packages\framework-arduinoespressif32\boards.txt
Note: Not sure which are needed but it works as is.
heltec_wireless_tracker.name=Wireless Tracker
heltec_wireless_tracker.vid.0=0x303a
heltec_wireless_tracker.pid.0=0x1001
heltec_wireless_tracker.bootloader.tool=esptool_py
heltec_wireless_tracker.bootloader.tool.default=esptool_py
heltec_wireless_tracker.upload.tool=esptool_py
heltec_wireless_tracker.upload.tool.default=esptool_py
heltec_wireless_tracker.upload.tool.network=esp_ota
heltec_wireless_tracker.upload.maximum_size=1310720
heltec_wireless_tracker.upload.maximum_data_size=327680
heltec_wireless_tracker.upload.flags=
heltec_wireless_tracker.upload.extra_flags=
heltec_wireless_tracker.upload.use_1200bps_touch=false
heltec_wireless_tracker.upload.wait_for_upload_port=false
heltec_wireless_tracker.serial.disableDTR=false
heltec_wireless_tracker.serial.disableRTS=false
heltec_wireless_tracker.build.tarch=xtensa
heltec_wireless_tracker.build.bootloader_addr=0x0
heltec_wireless_tracker.build.target=esp32s3
heltec_wireless_tracker.build.mcu=esp32s3
heltec_wireless_tracker.build.core=esp32
heltec_wireless_tracker.build.variant=wireless_track
heltec_wireless_tracker.build.board=Wireless_Track
heltec_wireless_tracker.build.usb_mode=1
heltec_wireless_tracker.build.cdc_on_boot=0
heltec_wireless_tracker.build.msc_on_boot=0
heltec_wireless_tracker.build.dfu_on_boot=0
heltec_wireless_tracker.build.f_cpu=240000000L
heltec_wireless_tracker.build.flash_size=4MB
heltec_wireless_tracker.build.flash_freq=80m
heltec_wireless_tracker.build.flash_mode=dio
heltec_wireless_tracker.build.boot=qio
heltec_wireless_tracker.build.boot_freq=80m
heltec_wireless_tracker.build.partitions=default
heltec_wireless_tracker.build.loop_core=
heltec_wireless_tracker.build.event_core=
heltec_wireless_tracker.build.psram_type=qspi
heltec_wireless_tracker.build.memory_type={build.boot}_{build.psram_type}
heltec_wireless_tracker.menu.PSRAM.disabled=Disabled
heltec_wireless_tracker.menu.PSRAM.disabled.build.psram_val=
heltec_wireless_tracker.menu.PSRAM.disabled.build.psram_type=qspi
heltec_wireless_tracker.menu.PSRAM.enabled=QSPI PSRAM
heltec_wireless_tracker.menu.PSRAM.enabled.build.psram_val=-DBOARD_HAS_PSRAM
heltec_wireless_tracker.menu.PSRAM.enabled.build.psram_type=qspi
heltec_wireless_tracker.menu.PSRAM.opi=OPI PSRAM
heltec_wireless_tracker.menu.PSRAM.opi.build.psram_val=-DBOARD_HAS_PSRAM
heltec_wireless_tracker.menu.PSRAM.opi.build.psram_type=opi
heltec_wireless_tracker.menu.FlashMode.qio=QIO 80MHz
heltec_wireless_tracker.menu.FlashMode.qio.build.flash_mode=dio
heltec_wireless_tracker.menu.FlashMode.qio.build.boot=qio
heltec_wireless_tracker.menu.FlashMode.qio.build.boot_freq=80m
heltec_wireless_tracker.menu.FlashMode.qio.build.flash_freq=80m
heltec_wireless_tracker.menu.FlashMode.qio120=QIO 120MHz
heltec_wireless_tracker.menu.FlashMode.qio120.build.flash_mode=dio
heltec_wireless_tracker.menu.FlashMode.qio120.build.boot=qio
heltec_wireless_tracker.menu.FlashMode.qio120.build.boot_freq=120m
heltec_wireless_tracker.menu.FlashMode.qio120.build.flash_freq=80m
heltec_wireless_tracker.menu.FlashMode.dio=DIO 80MHz
heltec_wireless_tracker.menu.FlashMode.dio.build.flash_mode=dio
heltec_wireless_tracker.menu.FlashMode.dio.build.boot=dio
heltec_wireless_tracker.menu.FlashMode.dio.build.boot_freq=80m
heltec_wireless_tracker.menu.FlashMode.dio.build.flash_freq=80m
heltec_wireless_tracker.menu.FlashMode.opi=OPI 80MHz
heltec_wireless_tracker.menu.FlashMode.opi.build.flash_mode=dout
heltec_wireless_tracker.menu.FlashMode.opi.build.boot=opi
heltec_wireless_tracker.menu.FlashMode.opi.build.boot_freq=80m
heltec_wireless_tracker.menu.FlashMode.opi.build.flash_freq=80m
heltec_wireless_tracker.menu.FlashSize.4M=4MB (32Mb)
heltec_wireless_tracker.menu.FlashSize.4M.build.flash_size=4MB
heltec_wireless_tracker.menu.FlashSize.8M=8MB (64Mb)
heltec_wireless_tracker.menu.FlashSize.8M.build.flash_size=8MB
heltec_wireless_tracker.menu.FlashSize.8M.build.partitions=default_8MB
heltec_wireless_tracker.menu.FlashSize.16M=16MB (128Mb)
heltec_wireless_tracker.menu.FlashSize.16M.build.flash_size=16MB
#heltec_wireless_tracker.menu.FlashSize.32M=32MB (256Mb)
#heltec_wireless_tracker.menu.FlashSize.32M.build.flash_size=32MB
heltec_wireless_tracker.menu.LoopCore.1=Core 1
heltec_wireless_tracker.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1
heltec_wireless_tracker.menu.LoopCore.0=Core 0
heltec_wireless_tracker.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0
heltec_wireless_tracker.menu.EventsCore.1=Core 1
heltec_wireless_tracker.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1
heltec_wireless_tracker.menu.EventsCore.0=Core 0
heltec_wireless_tracker.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0
heltec_wireless_tracker.menu.USBMode.hwcdc=Hardware CDC and JTAG
heltec_wireless_tracker.menu.USBMode.hwcdc.build.usb_mode=1
heltec_wireless_tracker.menu.USBMode.default=USB-OTG (TinyUSB)
heltec_wireless_tracker.menu.USBMode.default.build.usb_mode=0
heltec_wireless_tracker.menu.CDCOnBoot.default=Disabled
heltec_wireless_tracker.menu.CDCOnBoot.default.build.cdc_on_boot=0
heltec_wireless_tracker.menu.CDCOnBoot.cdc=Enabled
heltec_wireless_tracker.menu.CDCOnBoot.cdc.build.cdc_on_boot=1
heltec_wireless_tracker.menu.MSCOnBoot.default=Disabled
heltec_wireless_tracker.menu.MSCOnBoot.default.build.msc_on_boot=0
heltec_wireless_tracker.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode)
heltec_wireless_tracker.menu.MSCOnBoot.msc.build.msc_on_boot=1
heltec_wireless_tracker.menu.DFUOnBoot.default=Disabled
heltec_wireless_tracker.menu.DFUOnBoot.default.build.dfu_on_boot=0
heltec_wireless_tracker.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode)
heltec_wireless_tracker.menu.DFUOnBoot.dfu.build.dfu_on_boot=1
heltec_wireless_tracker.menu.UploadMode.default=UART0 / Hardware CDC
heltec_wireless_tracker.menu.UploadMode.default.upload.use_1200bps_touch=false
heltec_wireless_tracker.menu.UploadMode.default.upload.wait_for_upload_port=false
heltec_wireless_tracker.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB)
heltec_wireless_tracker.menu.UploadMode.cdc.upload.use_1200bps_touch=true
heltec_wireless_tracker.menu.UploadMode.cdc.upload.wait_for_upload_port=true
heltec_wireless_tracker.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
heltec_wireless_tracker.menu.PartitionScheme.default.build.partitions=default
heltec_wireless_tracker.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
heltec_wireless_tracker.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
heltec_wireless_tracker.menu.PartitionScheme.default_8MB=8M Flash (3MB APP/1.5MB FAT)
heltec_wireless_tracker.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
heltec_wireless_tracker.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
heltec_wireless_tracker.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
heltec_wireless_tracker.menu.PartitionScheme.minimal.build.partitions=minimal
heltec_wireless_tracker.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
heltec_wireless_tracker.menu.PartitionScheme.no_ota.build.partitions=no_ota
heltec_wireless_tracker.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
heltec_wireless_tracker.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
heltec_wireless_tracker.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
heltec_wireless_tracker.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
heltec_wireless_tracker.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
heltec_wireless_tracker.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
heltec_wireless_tracker.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
heltec_wireless_tracker.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
heltec_wireless_tracker.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
heltec_wireless_tracker.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
heltec_wireless_tracker.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
heltec_wireless_tracker.menu.PartitionScheme.huge_app.build.partitions=huge_app
heltec_wireless_tracker.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
heltec_wireless_tracker.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
heltec_wireless_tracker.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
heltec_wireless_tracker.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
heltec_wireless_tracker.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FAT)
heltec_wireless_tracker.menu.PartitionScheme.fatflash.build.partitions=ffat
heltec_wireless_tracker.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
heltec_wireless_tracker.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS)
heltec_wireless_tracker.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
heltec_wireless_tracker.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
heltec_wireless_tracker.menu.PartitionScheme.rainmaker=RainMaker
heltec_wireless_tracker.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
heltec_wireless_tracker.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728
heltec_wireless_tracker.menu.CPUFreq.240=240MHz (WiFi)
heltec_wireless_tracker.menu.CPUFreq.240.build.f_cpu=240000000L
heltec_wireless_tracker.menu.CPUFreq.160=160MHz (WiFi)
heltec_wireless_tracker.menu.CPUFreq.160.build.f_cpu=160000000L
heltec_wireless_tracker.menu.CPUFreq.80=80MHz (WiFi)
heltec_wireless_tracker.menu.CPUFreq.80.build.f_cpu=80000000L
heltec_wireless_tracker.menu.CPUFreq.40=40MHz
heltec_wireless_tracker.menu.CPUFreq.40.build.f_cpu=40000000L
heltec_wireless_tracker.menu.CPUFreq.20=20MHz
heltec_wireless_tracker.menu.CPUFreq.20.build.f_cpu=20000000L
heltec_wireless_tracker.menu.CPUFreq.10=10MHz
heltec_wireless_tracker.menu.CPUFreq.10.build.f_cpu=10000000L
heltec_wireless_tracker.menu.UploadSpeed.921600=921600
heltec_wireless_tracker.menu.UploadSpeed.921600.upload.speed=921600
heltec_wireless_tracker.menu.UploadSpeed.115200=115200
heltec_wireless_tracker.menu.UploadSpeed.115200.upload.speed=115200
heltec_wireless_tracker.menu.UploadSpeed.256000.windows=256000
heltec_wireless_tracker.menu.UploadSpeed.256000.upload.speed=256000
heltec_wireless_tracker.menu.UploadSpeed.230400.windows.upload.speed=256000
heltec_wireless_tracker.menu.UploadSpeed.230400=230400
heltec_wireless_tracker.menu.UploadSpeed.230400.upload.speed=230400
heltec_wireless_tracker.menu.UploadSpeed.460800.linux=460800
heltec_wireless_tracker.menu.UploadSpeed.460800.macosx=460800
heltec_wireless_tracker.menu.UploadSpeed.460800.upload.speed=460800
heltec_wireless_tracker.menu.UploadSpeed.512000.windows=512000
heltec_wireless_tracker.menu.UploadSpeed.512000.upload.speed=512000
heltec_wireless_tracker.menu.DebugLevel.none=None
heltec_wireless_tracker.menu.DebugLevel.none.build.code_debug=0
heltec_wireless_tracker.menu.DebugLevel.error=Error
heltec_wireless_tracker.menu.DebugLevel.error.build.code_debug=1
heltec_wireless_tracker.menu.DebugLevel.warn=Warn
heltec_wireless_tracker.menu.DebugLevel.warn.build.code_debug=2
heltec_wireless_tracker.menu.DebugLevel.info=Info
heltec_wireless_tracker.menu.DebugLevel.info.build.code_debug=3
heltec_wireless_tracker.menu.DebugLevel.debug=Debug
heltec_wireless_tracker.menu.DebugLevel.debug.build.code_debug=4
heltec_wireless_tracker.menu.DebugLevel.verbose=Verbose
heltec_wireless_tracker.menu.DebugLevel.verbose.build.code_debug=5
heltec_wireless_tracker.menu.LORAWAN_REGION.0=REGION_EU868
heltec_wireless_tracker.menu.LORAWAN_REGION.0.build.band=REGION_EU868
heltec_wireless_tracker.menu.LORAWAN_REGION.1=REGION_EU433
heltec_wireless_tracker.menu.LORAWAN_REGION.1.build.band=REGION_EU433
heltec_wireless_tracker.menu.LORAWAN_REGION.2=REGION_CN470
heltec_wireless_tracker.menu.LORAWAN_REGION.2.build.band=REGION_CN470
heltec_wireless_tracker.menu.LORAWAN_REGION.3=REGION_US915
heltec_wireless_tracker.menu.LORAWAN_REGION.3.build.band=REGION_US915
heltec_wireless_tracker.menu.LORAWAN_REGION.4=REGION_AU915
heltec_wireless_tracker.menu.LORAWAN_REGION.4.build.band=REGION_AU915
heltec_wireless_tracker.menu.LORAWAN_REGION.5=REGION_CN779
heltec_wireless_tracker.menu.LORAWAN_REGION.5.build.band=REGION_CN779
heltec_wireless_tracker.menu.LORAWAN_REGION.6=REGION_AS923
heltec_wireless_tracker.menu.LORAWAN_REGION.6.build.band=REGION_AS923
heltec_wireless_tracker.menu.LORAWAN_REGION.7=REGION_KR920
heltec_wireless_tracker.menu.LORAWAN_REGION.7.build.band=REGION_KR920
heltec_wireless_tracker.menu.LORAWAN_REGION.8=REGION_IN865
heltec_wireless_tracker.menu.LORAWAN_REGION.8.build.band=REGION_IN865
heltec_wireless_tracker.menu.LORAWAN_REGION.9=REGION_US915_HYBRID
heltec_wireless_tracker.menu.LORAWAN_REGION.9.build.band=REGION_US915_HYBRID
heltec_wireless_tracker.menu.LoRaWanDebugLevel.0=None
heltec_wireless_tracker.menu.LoRaWanDebugLevel.0.build.LoRaWanDebugLevel=0
heltec_wireless_tracker.menu.LoRaWanDebugLevel.1=Freq
heltec_wireless_tracker.menu.LoRaWanDebugLevel.1.build.LoRaWanDebugLevel=1
heltec_wireless_tracker.menu.LoRaWanDebugLevel.2=Freq && DIO
heltec_wireless_tracker.menu.LoRaWanDebugLevel.2.build.LoRaWanDebugLevel=2
heltec_wireless_tracker.menu.LoRaWanDebugLevel.3=Freq && DIO && PW
heltec_wireless_tracker.menu.LoRaWanDebugLevel.3.build.LoRaWanDebugLevel=3
heltec_wireless_tracker.menu.LORAWAN_DEVEUI.0=CUSTOM
heltec_wireless_tracker.menu.LORAWAN_DEVEUI.0.build.LORAWAN_DEVEUI_AUTO=0
heltec_wireless_tracker.menu.LORAWAN_DEVEUI.1=Generate By ChipID
heltec_wireless_tracker.menu.LORAWAN_DEVEUI.1.build.LORAWAN_DEVEUI_AUTO=1
heltec_wireless_tracker.menu.LORAWAN_PREAMBLE_LENGTH.0=8(default)
heltec_wireless_tracker.menu.LORAWAN_PREAMBLE_LENGTH.0.build.LORAWAN_PREAMBLE_LENGTH=8
heltec_wireless_tracker.menu.LORAWAN_PREAMBLE_LENGTH.1=16(For M00 and M00L)
heltec_wireless_tracker.menu.LORAWAN_PREAMBLE_LENGTH.1.build.LORAWAN_PREAMBLE_LENGTH=16
heltec_wireless_tracker.build.defines=-D{build.band} {build.psram_val} -DLoRaWAN_DEBUG_LEVEL={build.LoRaWanDebugLevel} -DACTIVE_REGION=LORAMAC_{build.band} -DLORAWAN_PREAMBLE_LENGTH={build.LORAWAN_PREAMBLE_LENGTH} -DLORAWAN_DEVEUI_AUTO={build.LORAWAN_DEVEUI_AUTO} -D{build.board}
heltec_wireless_tracker.build.extra_libs=-lheltec_{build.cdc_on_boot}
Except folder “variants”, move the folders from c:\Users\user.platformio\packages\framework-arduinoespressif32\ somewhere else (you might need to look around for missing files in case my instructions are not perfect) and
copy the folders from 0.0.8 (except “variants”) to c:\Users\user.platformio\packages\framework-arduinoespressif32\
Remember to keep the original folder variants!
from 0.0.8\variants\wireless_track\pins_arduino.h
copy to
C:\Users\user.platformio\packages\framework-arduinoespressif32\variants\heltec_wireless_tracker\pins_arduino.h
Now start Visual Studio Code and go to platformio. Create a project using “heltec_wireless_tracker” which should now be available if you’ve done the steps above and I didn’t miss anything in these instructions
Edit your platform.ini in your project:
[env:heltec_wireless_tracker]
platform = espressif32
board = heltec_wireless_tracker
framework = arduino
monitor_speed = 115200
build_flags =
-DLoRaWAN_DEBUG_LEVEL=0
-DREGION_EU868
-DACTIVE_REGION=LORAMAC_REGION_EU868
-DLoRaWAN_DEBUG_LEVEL=0
-DLORAWAN_PREAMBLE_LENGTH=8
-DLORAWAN_DEVEUI_AUTO=0
-D${board}
-lheltec_0
; here are some notes for your defines in heltec_wireless_tracker.json
; -lheltec_0 ; for no CDC on boot or
; -lheltec_1 ; for CDC on BOOT
; -DBOARD_HAS_PSRAM ; add it if it has psram
; -DLoRaWAN_DEBUG_LEVEL =0 ; 0 = None / 1 = Freq / 2 = Freq && DIO / 3 = Freq && DIO && PW
; -DREGION_xxnnn = EU868 ; EU868 / EU433 / CN470 / US915 / AU915 / CN779 / AS923 / KR920 / IN865 / US915_HYBRID
; -DACTIVE_REGION=LORAMAC_REGION_xxnnn ; EU868 / EU433 / CN470 / US915 / AU915 / CN779 / AS923 / KR920 / IN865 / US915_HYBRID
; -DLORAWAN_PREAMBLE_LENGTH=8 ; 8 / 16
; -DLORAWAN_DEVEUI_AUTO=0 ; 0 = Custom / 1 = Generate By ChipID
That should be it.