From 34084c6e7521f2f9acc67809770b990007fc70c7 Mon Sep 17 00:00:00 2001 From: Christian Baars Date: Sat, 3 Sep 2022 15:32:24 +0200 Subject: [PATCH 1/3] generate berry structures before every build process --- pio-tools/gen-berry-structures.py | 12 ++++++++++++ platformio_tasmota32.ini | 1 + 2 files changed, 13 insertions(+) create mode 100644 pio-tools/gen-berry-structures.py diff --git a/pio-tools/gen-berry-structures.py b/pio-tools/gen-berry-structures.py new file mode 100644 index 000000000..6fd1611e8 --- /dev/null +++ b/pio-tools/gen-berry-structures.py @@ -0,0 +1,12 @@ +Import("env") +import os +import subprocess +from os.path import join + +# generate all precompiled Berry structures from multiple modules +CURRENT_DIR = os.getcwd() +BERRY_GEN_DIR = join(CURRENT_DIR, "lib", "libesp32","berry") +os.chdir(BERRY_GEN_DIR) +cmd = ("python3",join("tools","coc","coc"),"-o","generate","src","default",join("..","berry_tasmota","src"),join("..","berry_mapping","src"),join("..","berry_int64","src"),join("..","..","libesp32_lvgl","lv_binding_berry","src"),join("..","..","libesp32_lvgl","lv_binding_berry","generate"),"-c",join("default","berry_conf.h")) +returncode = subprocess.call(cmd, shell=False) +os.chdir(CURRENT_DIR) diff --git a/platformio_tasmota32.ini b/platformio_tasmota32.ini index 81bdf580b..cb4b74838 100644 --- a/platformio_tasmota32.ini +++ b/platformio_tasmota32.ini @@ -35,6 +35,7 @@ build_flags = ${esp_defaults.build_flags} -Wl,--wrap=_Z11analogWritehi ; `analogWrite(unsigned char, int)` use the Tasmota version of analogWrite for deeper integration and phase control -Wl,--wrap=ledcReadFreq ; `uint32_t ledcReadFreq(uint8_t chan)` extra_scripts = pre:pio-tools/add_c_flags.py + pio-tools/gen-berry-structures.py post:pio-tools/post_esp32.py ${esp_defaults.extra_scripts} From a68d2726c5fabb7ee80fa9f603d84c63c8d304ea Mon Sep 17 00:00:00 2001 From: Christian Baars Date: Sat, 3 Sep 2022 17:22:27 +0200 Subject: [PATCH 2/3] refactor BERRY_GEN_DIR --- pio-tools/gen-berry-structures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pio-tools/gen-berry-structures.py b/pio-tools/gen-berry-structures.py index 6fd1611e8..49bb8e3d0 100644 --- a/pio-tools/gen-berry-structures.py +++ b/pio-tools/gen-berry-structures.py @@ -5,7 +5,7 @@ from os.path import join # generate all precompiled Berry structures from multiple modules CURRENT_DIR = os.getcwd() -BERRY_GEN_DIR = join(CURRENT_DIR, "lib", "libesp32","berry") +BERRY_GEN_DIR = join(env.subst("$PROJECT_DIR"), "lib", "libesp32","berry") os.chdir(BERRY_GEN_DIR) cmd = ("python3",join("tools","coc","coc"),"-o","generate","src","default",join("..","berry_tasmota","src"),join("..","berry_mapping","src"),join("..","berry_int64","src"),join("..","..","libesp32_lvgl","lv_binding_berry","src"),join("..","..","libesp32_lvgl","lv_binding_berry","generate"),"-c",join("default","berry_conf.h")) returncode = subprocess.call(cmd, shell=False) From eea3b0ed109088fc00fea62f6633b0d5ce167360 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 3 Sep 2022 22:04:56 +0200 Subject: [PATCH 3/3] add Pio env --- pio-tools/gen-berry-structures.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pio-tools/gen-berry-structures.py b/pio-tools/gen-berry-structures.py index 49bb8e3d0..b739fe17a 100644 --- a/pio-tools/gen-berry-structures.py +++ b/pio-tools/gen-berry-structures.py @@ -1,4 +1,6 @@ Import("env") +env = DefaultEnvironment() +platform = env.PioPlatform() import os import subprocess from os.path import join