mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +00:00
Update config files, add merge_bin firmware
This commit is contained in:
parent
2bf1541f48
commit
184234bdd0
@ -86,13 +86,15 @@ lib_deps =
|
||||
|
||||
src_filter = +<*> -<.git/> -<examples/> -<test/> -<tests/> -<stm32f4/> -<lv_font_montserrat_*.c>
|
||||
|
||||
extra_scripts = tools/copy_fw.py ; tools/pre:extra_script.py
|
||||
|
||||
; -- Platform specific build flags
|
||||
[esp32]
|
||||
framework = arduino
|
||||
platform = espressif32
|
||||
board_build.partitions = user_setups/esp32/partition_app1536k_spiffs1024k.csv
|
||||
|
||||
board_upload.flash_size=4MB
|
||||
board_upload.maximum_size = 4194304
|
||||
board_build.partitions = user_setups/esp32/partition_app1704k_spiffs720k.csv
|
||||
|
||||
; ----- crash reporter
|
||||
monitor_filters = esp32_exception_decoder
|
||||
@ -143,9 +145,10 @@ ps_ram =
|
||||
-mfix-esp32-psram-cache-issue
|
||||
|
||||
extra_scripts =
|
||||
${env.extra_scripts}
|
||||
tools/copy_partitions.py
|
||||
tools/esp_merge_bin.py
|
||||
tools/analyze_elf.py
|
||||
; ${env.extra_scripts}
|
||||
; tools/copy_partitions.py
|
||||
|
||||
; -- The ESP32 has 2 SPI Hardware Busses available to use:
|
||||
vspi =
|
||||
@ -191,6 +194,8 @@ build_flags=
|
||||
-D HASP_USE_ETHERNET=0
|
||||
-D HASP_USE_CONFIG=1 ; Native application, not library
|
||||
|
||||
extra_scripts = tools/copy_fw.py ; tools/pre:extra_script.py
|
||||
|
||||
lib_ignore =
|
||||
ESP32 BLE Arduino
|
||||
GxTFT
|
||||
@ -200,6 +205,7 @@ lib_ignore =
|
||||
|
||||
lib_deps =
|
||||
|
||||
|
||||
[stm32f4]
|
||||
framework = arduino
|
||||
platform = ststm32
|
||||
|
@ -6,11 +6,11 @@
|
||||
[platformio]
|
||||
extra_configs =
|
||||
; Uncomment or edit the lines to show more User Setups in the PIO sidebar
|
||||
; user_setups/darwin_sdl/*.ini
|
||||
; user_setups/esp32/*.ini
|
||||
; user_setups/esp8266/*.ini
|
||||
; user_setups/stm32f4xx/*.ini
|
||||
; user_setups/darwin_sdl/*.ini
|
||||
; user_setups/linux_sdl/*.ini
|
||||
; user_setups/stm32f4xx/*.ini
|
||||
; user_setups/win32/*.ini
|
||||
|
||||
[override]
|
||||
@ -24,15 +24,16 @@ extra_default_envs =
|
||||
; Comment unneeded environments or create extra
|
||||
; d1-mini-esp32_ili9341
|
||||
; d1-mini-esp8266_ili9341
|
||||
; lolind32pro-lolintft24
|
||||
; esp32dev-mrb3511
|
||||
; esp12e-st7735
|
||||
; d132-unoshield
|
||||
; nodemcu32s-raspi
|
||||
; esp12e-st7735
|
||||
; esp32dev-mrb3511
|
||||
; esp32dev-ili9488
|
||||
; lanbon_l8
|
||||
; wt32-sc01
|
||||
; lolin-d32-pro_ili9341
|
||||
; my_custom_build
|
||||
; nodemcu32s-raspi
|
||||
; wt32-sc01
|
||||
; ttgo_esp32_poe-ili9341
|
||||
;endregion
|
||||
|
||||
;region -- Define your local COM ports for each environment ---
|
||||
@ -55,16 +56,16 @@ upload_port = 192.168.4.4 ; IP of the ESP
|
||||
upload_protocol = espota ; Use ArduinoOTA after flashing over serial
|
||||
upload_flags = --port=3232 ; --auth=haspadmin ; OTA password
|
||||
|
||||
[env:ttgo_esp32_poe-lolintft24]
|
||||
[env:ttgo_esp32_poe-ili9341]
|
||||
monitor_port = COM9 ; Change to the correct port
|
||||
;upload_port = ${env:ttgo_esp32_poe-lolintft24.monitor_port}
|
||||
;upload_port = ${env:ttgo_esp32_poe-ili9341.monitor_port}
|
||||
upload_port = 192.168.4.5 ; IP of the ESP
|
||||
upload_protocol = espota ; Use ArduinoOTA after flashing over serial
|
||||
upload_flags = --port=3232 ; --auth=haspadmin ; OTA password
|
||||
|
||||
[env:lolind32pro-lolintft24]
|
||||
monitor_port = COM3 ; Change to the correct port
|
||||
upload_port = ${env:lolind32pro-lolintft24.monitor_port}
|
||||
[env:lolin-d32-pro_ili9341]
|
||||
monitor_port = COM5 ; Change to the correct port
|
||||
upload_port = ${env:lolin-d32-pro_ili9341.monitor_port}
|
||||
;endregion
|
||||
|
||||
;region -- Custom Environment configuration example -----------------
|
||||
|
97
tools/esp_merge_bin.py
Normal file
97
tools/esp_merge_bin.py
Normal file
@ -0,0 +1,97 @@
|
||||
Import('env')
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
buildFlags = env.ParseFlags(env['BUILD_FLAGS'])
|
||||
OUTPUT_DIR = "build_output{}".format(os.path.sep)
|
||||
|
||||
platform = env.PioPlatform()
|
||||
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32")
|
||||
FRAMEWORK_DIR = "{}{}".format(FRAMEWORK_DIR, os.path.sep)
|
||||
|
||||
|
||||
def get_fw_version(source, target, env):
|
||||
global HASP_VER_MAJ
|
||||
global HASP_VER_MIN
|
||||
global HASP_VER_REV
|
||||
|
||||
for item in buildFlags.get("CPPDEFINES"):
|
||||
if (type(item) is list):
|
||||
if (item[0]=="HASP_VER_MAJ"): HASP_VER_MAJ = item[1]
|
||||
if (item[0]=="HASP_VER_MIN"): HASP_VER_MIN = item[1]
|
||||
if (item[0]=="HASP_VER_REV"): HASP_VER_REV = item[1]
|
||||
print(" * %s = %s" % (item[0],item[1]))
|
||||
else:
|
||||
print(" * %s" % item)
|
||||
|
||||
|
||||
def copy_merge_bins(source, target, env):
|
||||
version = 'v' + str(HASP_VER_MAJ) + '.' + str(HASP_VER_MIN) + '.' + str(HASP_VER_REV)
|
||||
name =str(target[0]).split(os.path.sep)[2]
|
||||
flash_size = env.GetProjectOption("board_upload.flash_size")
|
||||
|
||||
bootloader = "{}tools{}sdk{}bin{}bootloader_dio_40m.bin".format(FRAMEWORK_DIR, os.path.sep, os.path.sep, os.path.sep, os.path.sep)
|
||||
partitions = "{}{}partitions.bin".format(env.subst("$BUILD_DIR"), os.path.sep)
|
||||
boot_app0 = "{}tools{}partitions{}boot_app0.bin".format(FRAMEWORK_DIR, os.path.sep, os.path.sep, os.path.sep)
|
||||
firmware_dst ="{}firmware{}{}_full_{}_{}.bin".format(OUTPUT_DIR, os.path.sep, name, flash_size, version)
|
||||
firmware_src = str(target[0])
|
||||
|
||||
# check if output directories exist and create if necessary
|
||||
if not os.path.isdir(OUTPUT_DIR):
|
||||
os.mkdir(OUTPUT_DIR)
|
||||
|
||||
for d in ['firmware', 'map']:
|
||||
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)):
|
||||
os.mkdir("{}{}".format(OUTPUT_DIR, d))
|
||||
|
||||
# check if new target files exist and remove if necessary
|
||||
for f in [firmware_dst]:
|
||||
if os.path.isfile(f):
|
||||
os.remove(f)
|
||||
|
||||
print(bootloader)
|
||||
print(partitions)
|
||||
print(boot_app0)
|
||||
print(firmware_src)
|
||||
print(firmware_dst)
|
||||
print(flash_size)
|
||||
|
||||
process = subprocess.Popen(['python', 'tools/esptool_with_merge_bin.py', '--chip', 'esp32', 'merge_bin', '--output', firmware_dst, '--flash_mode', 'dio', '--flash_size', flash_size, '0x1000', bootloader, '0x8000', partitions, '0xe000', boot_app0, '0x10000', firmware_src],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
stdout, stderr = process.communicate()
|
||||
stdout, stderr
|
||||
print(stdout)
|
||||
print(stderr)
|
||||
|
||||
def copy_ota(source, target, env):
|
||||
version = 'v' + str(HASP_VER_MAJ) + '.' + str(HASP_VER_MIN) + '.' + str(HASP_VER_REV)
|
||||
name =str(target[0]).split(os.path.sep)[2]
|
||||
|
||||
firmware_src = str(target[0])
|
||||
firmware_dst ="{}firmware{}{}_ota_{}.bin".format(OUTPUT_DIR, os.path.sep, name, version)
|
||||
|
||||
# check if output directories exist and create if necessary
|
||||
if not os.path.isdir(OUTPUT_DIR):
|
||||
os.mkdir(OUTPUT_DIR)
|
||||
|
||||
for d in ['firmware', 'map']:
|
||||
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)):
|
||||
os.mkdir("{}{}".format(OUTPUT_DIR, d))
|
||||
|
||||
# check if new target files exist and remove if necessary
|
||||
for f in [firmware_dst]:
|
||||
if os.path.isfile(f):
|
||||
os.remove(f)
|
||||
|
||||
print(firmware_src)
|
||||
print(firmware_dst)
|
||||
|
||||
# copy firmware.bin to firmware/<variant>.bin
|
||||
shutil.copy(firmware_src, firmware_dst)
|
||||
|
||||
env.AddPreAction("$BUILD_DIR/${PROGNAME}.bin", [get_fw_version])
|
||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [copy_merge_bins])
|
||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [copy_ota])
|
4422
tools/esptool_with_merge_bin.py
Normal file
4422
tools/esptool_with_merge_bin.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -9,10 +9,6 @@
|
||||
extends = esp32
|
||||
board = wemos_d1_mini32
|
||||
|
||||
board_upload.flash_size=4MB
|
||||
board_upload.maximum_size = 4194304
|
||||
board_build.partitions = user_setups/esp32/partition_app1704k_spiffs720k.csv
|
||||
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${esp32.build_flags}
|
||||
@ -36,7 +32,3 @@ lib_ignore =
|
||||
${env.lib_ignore}
|
||||
${esp32.lib_ignore}
|
||||
;endregion
|
||||
|
||||
extra_scripts =
|
||||
${env.extra_scripts}
|
||||
${esp32.extra_scripts}
|
@ -8,10 +8,6 @@
|
||||
extends = esp32
|
||||
board = esp32dev
|
||||
|
||||
board_upload.flash_size=4MB
|
||||
board_upload.maximum_size = 4194304
|
||||
board_build.partitions = user_setups/esp32/partition_app1704k_spiffs720k.csv
|
||||
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${esp32.build_flags}
|
||||
|
@ -8,10 +8,6 @@
|
||||
extends = esp32
|
||||
board = esp32dev
|
||||
|
||||
board_upload.flash_size=4MB
|
||||
board_upload.maximum_size = 4194304
|
||||
board_build.partitions = user_setups/esp32/partition_app1704k_spiffs720k.csv
|
||||
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${esp32.build_flags}
|
||||
|
@ -9,10 +9,6 @@
|
||||
extends = esp32
|
||||
board = esp32dev
|
||||
|
||||
board_upload.flash_size=4MB
|
||||
board_upload.maximum_size = 4194304
|
||||
board_build.partitions = user_setups/esp32/partition_app1704k_spiffs720k.csv
|
||||
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${esp32.build_flags}
|
||||
@ -55,5 +51,4 @@ lib_ignore =
|
||||
${env.lib_ignore}
|
||||
; ${esp32.lib_ignore}
|
||||
lv_drv_fsmc_ili9341
|
||||
|
||||
;endregion
|
||||
|
@ -8,10 +8,6 @@
|
||||
extends = esp32
|
||||
board = esp32dev
|
||||
|
||||
board_upload.flash_size=4MB
|
||||
board_upload.maximum_size = 4194304
|
||||
board_build.partitions = user_setups/esp32/partition_app1704k_spiffs720k.csv
|
||||
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${esp32.build_flags}
|
||||
|
@ -13,8 +13,7 @@ board = esp32cam
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${esp32.build_flags}
|
||||
-DBOARD_HAS_PSRAM
|
||||
-mfix-esp32-psram-cache-issue
|
||||
${esp32.ps_ram}
|
||||
|
||||
;region -- TFT_eSPI build options ------------------------
|
||||
${lcd.raspberrypi}
|
||||
|
@ -9,10 +9,6 @@
|
||||
extends = esp32
|
||||
board = featheresp32
|
||||
|
||||
board_upload.flash_size=4MB
|
||||
board_upload.maximum_size = 4194304
|
||||
board_build.partitions = user_setups/esp32/partition_app1704k_spiffs720k.csv
|
||||
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${esp32.build_flags}
|
||||
|
@ -9,10 +9,6 @@
|
||||
extends = esp32
|
||||
board = featheresp32
|
||||
|
||||
board_upload.flash_size=4MB
|
||||
board_upload.maximum_size = 4194304
|
||||
board_build.partitions = user_setups/esp32/partition_app1704k_spiffs720k.csv
|
||||
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${esp32.build_flags}
|
||||
|
@ -54,7 +54,3 @@ lib_ignore =
|
||||
${esp32.lib_ignore}
|
||||
ESP32 BLE Arduino
|
||||
;endregion
|
||||
|
||||
extra_scripts =
|
||||
${env.extra_scripts}
|
||||
${esp32.extra_scripts}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
; !! This board already defines TFT_CS, TFT_DC and TFT_RST !!
|
||||
|
||||
[env:lolind32pro-lolintft24]
|
||||
[env:lolin-d32-pro_ili9341]
|
||||
extends = esp32
|
||||
board = lolin_d32_pro
|
||||
|
||||
@ -41,7 +41,3 @@ lib_ignore =
|
||||
${env.lib_ignore}
|
||||
${esp32.lib_ignore}
|
||||
;endregion
|
||||
|
||||
extra_scripts =
|
||||
${env.extra_scripts}
|
||||
${esp32.extra_scripts}
|
@ -53,7 +53,3 @@ lib_ignore =
|
||||
lv_drv_fsmc_ili9341
|
||||
lv_drivers
|
||||
;endregion
|
||||
|
||||
extra_scripts =
|
||||
${env.extra_scripts}
|
||||
${esp32.extra_scripts}
|
@ -6,14 +6,10 @@
|
||||
; - xpt2046 touch controller ;
|
||||
;***************************************************;
|
||||
|
||||
[env:ttgo_esp32_poe-lolintft24]
|
||||
[env:ttgo_esp32_poe-ili9341]
|
||||
extends = esp32
|
||||
board = esp32dev
|
||||
|
||||
board_upload.flash_size=4MB
|
||||
board_upload.maximum_size = 4194304
|
||||
board_build.partitions = user_setups/esp32/partition_app1704k_spiffs720k.csv
|
||||
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${esp32.build_flags}
|
||||
|
@ -9,10 +9,6 @@
|
||||
extends = esp32
|
||||
board = esp32dev
|
||||
|
||||
board_upload.flash_size=4MB
|
||||
board_upload.maximum_size = 4194304
|
||||
board_build.partitions = user_setups/esp32/partition_app1704k_spiffs720k.csv
|
||||
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${esp32.build_flags}
|
||||
@ -46,7 +42,3 @@ lib_ignore =
|
||||
${env.lib_ignore}
|
||||
${esp32.lib_ignore}
|
||||
;endregion
|
||||
|
||||
extra_scripts =
|
||||
${env.extra_scripts}
|
||||
${esp32.extra_scripts}
|
Loading…
x
Reference in New Issue
Block a user