mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
native build updates
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
; default_envs = esp32_4M
|
; default_envs = esp32_4M
|
||||||
; default_envs = esp32_16M
|
; default_envs = esp32_16M
|
||||||
default_envs = lolin_s3
|
default_envs = lolin_s3
|
||||||
|
; default_envs = lolin_c3_mini
|
||||||
; default_envs = native
|
; default_envs = native
|
||||||
; default_envs = debug
|
; default_envs = debug
|
||||||
; default_envs = custom
|
; default_envs = custom
|
||||||
@@ -26,11 +27,11 @@ default_envs = lolin_s3
|
|||||||
[env]
|
[env]
|
||||||
; upload settings
|
; upload settings
|
||||||
; for USB
|
; for USB
|
||||||
upload_protocol = esptool
|
; upload_protocol = esptool
|
||||||
upload_port = /dev/ttyUSB*
|
; upload_port = /dev/ttyUSB*
|
||||||
; for OTA add scripts/upload.py to extra_scripts
|
; for OTA add scripts/upload.py to extra_scripts
|
||||||
; upload_protocol = custom
|
upload_protocol = custom
|
||||||
custom_emsesp_ip = 10.10.10.173
|
custom_emsesp_ip = 10.10.10.175
|
||||||
; custom_emsesp_ip = ems-esp.local
|
; custom_emsesp_ip = ems-esp.local
|
||||||
custom_username = admin
|
custom_username = admin
|
||||||
custom_password = admin
|
custom_password = admin
|
||||||
@@ -42,59 +43,25 @@ custom_password = admin
|
|||||||
[env:native]
|
[env:native]
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
; pre:scripts/refresh_module_library_native.py
|
; pre:scripts/refresh_module_library_native.py
|
||||||
; post:scripts/run_native.py
|
post:scripts/run_native.py
|
||||||
|
|
||||||
[env:esp32_4M]
|
|
||||||
extra_scripts =
|
|
||||||
; pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
|
|
||||||
scripts/rename_fw.py
|
|
||||||
; scripts/upload.py
|
|
||||||
|
|
||||||
[env:lolin_s3]
|
[env:lolin_s3]
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
; pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
|
pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
|
||||||
scripts/rename_fw.py
|
scripts/rename_fw.py
|
||||||
; scripts/upload.py
|
scripts/upload.py
|
||||||
|
|
||||||
[env:esp32_16M]
|
[env:esp32_16M]
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
; pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
|
pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
|
||||||
scripts/rename_fw.py
|
scripts/rename_fw.py
|
||||||
; scripts/upload.py
|
; scripts/upload.py
|
||||||
|
|
||||||
[env:custom]
|
[env:lolin_c3_mini]
|
||||||
; use for basic ESP boards with 4MB flash
|
|
||||||
; make sure -D TASMOTA_SDK is also enabled
|
|
||||||
platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.01.00/platform-espressif32.zip
|
|
||||||
; use for S3 boards:
|
|
||||||
; platform = espressif32
|
|
||||||
framework = arduino
|
|
||||||
board = esp32dev
|
|
||||||
board_build.filesystem = littlefs
|
|
||||||
board_build.f_cpu = 240000000L
|
|
||||||
board_upload.flash_size = 4MB
|
|
||||||
board_build.partitions = esp32_partition_4M.csv
|
|
||||||
board_upload.use_1200bps_touch = false
|
|
||||||
board_upload.wait_for_upload_port = true
|
|
||||||
upload_port = /dev/ttyUSB0
|
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
pre:scripts/build_interface.py
|
; pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
|
||||||
scripts/rename_fw.py
|
scripts/rename_fw.py
|
||||||
build_unflags = ${common.unbuild_flags}
|
scripts/upload.py
|
||||||
build_flags =
|
|
||||||
${common.core_build_flags}
|
|
||||||
${factory_settings.build_flags}
|
|
||||||
${common.my_build_flags}
|
|
||||||
-D ONEWIRE_CRC16=0
|
|
||||||
-D NO_GLOBAL_ARDUINOOTA
|
|
||||||
-D ARDUINOJSON_ENABLE_STD_STRING=1
|
|
||||||
-D TASMOTA_SDK
|
|
||||||
; -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_WARN
|
|
||||||
-D EMSESP_TEST
|
|
||||||
-D EMSESP_DEBUG
|
|
||||||
-D CONFIG_ETH_ENABLED
|
|
||||||
-D CONFIG_ASYNC_TCP_STACK_SIZE=8192
|
|
||||||
'-DEMSESP_DEFAULT_BOARD_PROFILE="Test"'
|
|
||||||
|
|
||||||
; pio run -e debug
|
; pio run -e debug
|
||||||
; or from Visual Studio Code do PIO -> Project Tasks -> debug -> General -> Upload and Monitor
|
; or from Visual Studio Code do PIO -> Project Tasks -> debug -> General -> Upload and Monitor
|
||||||
|
|||||||
@@ -215,6 +215,8 @@ build_unflags = ${common.unbuild_flags}
|
|||||||
;
|
;
|
||||||
; It will generate an executbale which when run will show the EMS-ESP Console where you can run tests using the `test` command.
|
; It will generate an executbale which when run will show the EMS-ESP Console where you can run tests using the `test` command.
|
||||||
;
|
;
|
||||||
|
; See https://docs.platformio.org/en/latest/core/installation/shell-commands.html#piocore-install-shell-commands
|
||||||
|
;
|
||||||
; to build and run directly on linux: pio run -e native -t exec
|
; to build and run directly on linux: pio run -e native -t exec
|
||||||
;
|
;
|
||||||
; to build and run on Windows, it needs winsock for the console input so:
|
; to build and run on Windows, it needs winsock for the console input so:
|
||||||
@@ -245,7 +247,6 @@ build_src_flags =
|
|||||||
-I./lib/espMqttClient/src/Transport
|
-I./lib/espMqttClient/src/Transport
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
+<*>
|
+<*>
|
||||||
-<.git/>
|
|
||||||
+<../lib_standalone>
|
+<../lib_standalone>
|
||||||
+<../lib/uuid-common>
|
+<../lib/uuid-common>
|
||||||
+<../lib/uuid-console>
|
+<../lib/uuid-console>
|
||||||
|
|||||||
@@ -1,11 +1,60 @@
|
|||||||
|
import shutil
|
||||||
|
import re
|
||||||
import os
|
import os
|
||||||
|
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
def run_native():
|
OUTPUT_DIR = "build{}".format(os.path.sep)
|
||||||
print("Running native...")
|
|
||||||
os.system("pio run -e native")
|
|
||||||
|
|
||||||
if not (env.IsCleanTarget()):
|
def move_file(source, target, env):
|
||||||
run_native()
|
|
||||||
|
|
||||||
|
# get the build info
|
||||||
|
bag = {}
|
||||||
|
exprs = [(re.compile(r'^#define EMSESP_APP_VERSION\s+"(\S+)"'), 'app_version')]
|
||||||
|
with open('./src/version.h', 'r') as f:
|
||||||
|
for l in f.readlines():
|
||||||
|
for expr, var in exprs:
|
||||||
|
m = expr.match(l)
|
||||||
|
if m and len(m.groups()) > 0:
|
||||||
|
bag[var] = m.group(1)
|
||||||
|
|
||||||
|
app_version = bag.get('app_version')
|
||||||
|
platform = "native"
|
||||||
|
|
||||||
|
# this breaks the CI so removed
|
||||||
|
# flash_size = env["PIOENV"].split('_')[1]
|
||||||
|
|
||||||
|
# print(env.Dump())
|
||||||
|
# my_flags = env.ParseFlags(env['BUILD_FLAGS'])
|
||||||
|
# defines = {k: v for (k, v) in my_flags.get("CPPDEFINES")}
|
||||||
|
# print(my_flags)
|
||||||
|
# print(my_flags.get("CPPDEFINES")
|
||||||
|
|
||||||
|
# alternatively take platform from the pio target
|
||||||
|
# platform = str(target[0]).split(os.path.sep)[2]
|
||||||
|
|
||||||
|
print("app version: " + app_version)
|
||||||
|
print("platform: " + platform)
|
||||||
|
|
||||||
|
# TODO do I need .exe for windows?
|
||||||
|
variant = "native"
|
||||||
|
|
||||||
|
# check if output directories exist and create if necessary
|
||||||
|
if not os.path.isdir(OUTPUT_DIR):
|
||||||
|
os.mkdir(OUTPUT_DIR)
|
||||||
|
|
||||||
|
# create string with location and file names based on variant
|
||||||
|
bin_file = "{}firmware{}{}".format(OUTPUT_DIR, os.path.sep, variant)
|
||||||
|
|
||||||
|
# check if new target files exist and remove if necessary
|
||||||
|
for f in [bin_file]:
|
||||||
|
if os.path.isfile(f):
|
||||||
|
os.remove(f)
|
||||||
|
|
||||||
|
print("Renaming file to "+bin_file)
|
||||||
|
|
||||||
|
shutil.copy(str(target[0]), bin_file)
|
||||||
|
|
||||||
|
print("Executing file")
|
||||||
|
os.system(bin_file)
|
||||||
|
|
||||||
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}", [move_file])
|
||||||
|
|||||||
Reference in New Issue
Block a user