mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-24 09:26:52 +00:00
Merge pull request #3906 from Jorropo/remove-unused-imports/platformio-custom
bin: remove unused imports from platformio-custom.py
This commit is contained in:
commit
c04c589ae7
@ -1,13 +1,12 @@
|
|||||||
import subprocess
|
|
||||||
import configparser
|
|
||||||
import traceback
|
|
||||||
import sys
|
import sys
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
|
||||||
from readprops import readProps
|
from readprops import readProps
|
||||||
|
|
||||||
Import("env")
|
Import("env")
|
||||||
platform = env.PioPlatform()
|
platform = env.PioPlatform()
|
||||||
|
|
||||||
|
|
||||||
def esp32_create_combined_bin(source, target, env):
|
def esp32_create_combined_bin(source, target, env):
|
||||||
# this sub is borrowed from ESPEasy build toolchain. It's licensed under GPL V3
|
# this sub is borrowed from ESPEasy build toolchain. It's licensed under GPL V3
|
||||||
# https://github.com/letscontrolit/ESPEasy/blob/mega/tools/pio/post_esp32.py
|
# https://github.com/letscontrolit/ESPEasy/blob/mega/tools/pio/post_esp32.py
|
||||||
@ -20,8 +19,8 @@ def esp32_create_combined_bin(source, target, env):
|
|||||||
firmware_name = env.subst("$BUILD_DIR/${PROGNAME}.bin")
|
firmware_name = env.subst("$BUILD_DIR/${PROGNAME}.bin")
|
||||||
chip = env.get("BOARD_MCU")
|
chip = env.get("BOARD_MCU")
|
||||||
flash_size = env.BoardConfig().get("upload.flash_size")
|
flash_size = env.BoardConfig().get("upload.flash_size")
|
||||||
flash_freq = env.BoardConfig().get("build.f_flash", '40m')
|
flash_freq = env.BoardConfig().get("build.f_flash", "40m")
|
||||||
flash_freq = flash_freq.replace('000000L', 'm')
|
flash_freq = flash_freq.replace("000000L", "m")
|
||||||
flash_mode = env.BoardConfig().get("build.flash_mode", "dio")
|
flash_mode = env.BoardConfig().get("build.flash_mode", "dio")
|
||||||
memory_type = env.BoardConfig().get("build.arduino.memory_type", "qio_qspi")
|
memory_type = env.BoardConfig().get("build.arduino.memory_type", "qio_qspi")
|
||||||
if flash_mode == "qio" or flash_mode == "qout":
|
if flash_mode == "qio" or flash_mode == "qout":
|
||||||
@ -51,23 +50,27 @@ def esp32_create_combined_bin(source, target, env):
|
|||||||
print(f" - {hex(app_offset)} | {firmware_name}")
|
print(f" - {hex(app_offset)} | {firmware_name}")
|
||||||
cmd += [hex(app_offset), firmware_name]
|
cmd += [hex(app_offset), firmware_name]
|
||||||
|
|
||||||
print('Using esptool.py arguments: %s' % ' '.join(cmd))
|
print("Using esptool.py arguments: %s" % " ".join(cmd))
|
||||||
|
|
||||||
esptool.main(cmd)
|
esptool.main(cmd)
|
||||||
|
|
||||||
if (platform.name == "espressif32"):
|
|
||||||
|
if platform.name == "espressif32":
|
||||||
sys.path.append(join(platform.get_package_dir("tool-esptoolpy")))
|
sys.path.append(join(platform.get_package_dir("tool-esptoolpy")))
|
||||||
import esptool
|
import esptool
|
||||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin)
|
|
||||||
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin)
|
||||||
|
|
||||||
Import("projenv")
|
Import("projenv")
|
||||||
|
|
||||||
prefsLoc = projenv["PROJECT_DIR"] + "/version.properties"
|
prefsLoc = projenv["PROJECT_DIR"] + "/version.properties"
|
||||||
verObj = readProps(prefsLoc)
|
verObj = readProps(prefsLoc)
|
||||||
print("Using meshtastic platformio-custom.py, firmware version " + verObj['long'])
|
print("Using meshtastic platformio-custom.py, firmware version " + verObj["long"])
|
||||||
|
|
||||||
# General options that are passed to the C and C++ compilers
|
# General options that are passed to the C and C++ compilers
|
||||||
projenv.Append(CCFLAGS=[
|
projenv.Append(
|
||||||
"-DAPP_VERSION=" + verObj['long'],
|
CCFLAGS=[
|
||||||
"-DAPP_VERSION_SHORT=" + verObj['short']
|
"-DAPP_VERSION=" + verObj["long"],
|
||||||
])
|
"-DAPP_VERSION_SHORT=" + verObj["short"],
|
||||||
|
]
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user