mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
#remote build
This commit is contained in:
11
.gitignore
vendored
11
.gitignore
vendored
@@ -1,7 +1,6 @@
|
|||||||
.pio
|
.pio
|
||||||
.vscode/.browse.c_cpp.db*
|
.vscode
|
||||||
.vscode/c_cpp_properties.json
|
lib
|
||||||
.vscode/launch.json
|
build.log
|
||||||
.vscode/ipch
|
build_output
|
||||||
lib/libraies-master
|
.cache
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "Clock.h"
|
#include "Clock.h"
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Utils/TimeUtils.h"
|
#include "Utils/TimeUtils.h"
|
||||||
#include "Utils\SerialPrint.h"
|
#include "Utils/SerialPrint.h"
|
||||||
|
|
||||||
extern void clock_init();
|
extern void clock_init();
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = esp8266
|
default_envs = esp8266
|
||||||
|
build_cache_dir = .cache
|
||||||
|
|
||||||
;=============================================================================================================================================
|
;=============================================================================================================================================
|
||||||
[common_env_data]
|
[common_env_data]
|
||||||
|
lib_ldf_mode = chain+
|
||||||
lib_deps_external =
|
lib_deps_external =
|
||||||
bblanchon/ArduinoJson @5.*
|
bblanchon/ArduinoJson @5.*
|
||||||
thomasfredericks/Bounce2
|
thomasfredericks/Bounce2
|
||||||
@@ -31,7 +34,9 @@ monitor_filters = esp32_exception_decoder
|
|||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
extra_scripts = ./tools/littlefsbuilder.py
|
extra_scripts =
|
||||||
|
tools/littlefsbuilder.py
|
||||||
|
${scripts_defaults.extra_scripts}
|
||||||
;=============================================================================================================================================
|
;=============================================================================================================================================
|
||||||
[env:esp8266_01_1m]
|
[env:esp8266_01_1m]
|
||||||
framework = arduino
|
framework = arduino
|
||||||
@@ -65,4 +70,11 @@ monitor_filters = esp8266_exception_decoder
|
|||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
|
extra_scripts =
|
||||||
|
${scripts_defaults.extra_scripts}
|
||||||
;=============================================================================================================================================
|
;=============================================================================================================================================
|
||||||
|
|
||||||
|
[scripts_defaults]
|
||||||
|
extra_scripts =
|
||||||
|
tools/name-firmware.py
|
||||||
|
tools/gzip-firmware.py
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "Utils/FileUtils.h"
|
#include "Utils/FileUtils.h"
|
||||||
#include "Utils\SerialPrint.h"
|
#include "Utils/SerialPrint.h"
|
||||||
#include "Utils/StringUtils.h"
|
#include "Utils/StringUtils.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "Utils\SerialPrint.h"
|
#include "Utils/SerialPrint.h"
|
||||||
|
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
|
||||||
|
|||||||
28
tools/gzip-firmware.py
Normal file
28
tools/gzip-firmware.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
Import('env')
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import gzip
|
||||||
|
|
||||||
|
OUTPUT_DIR = "build_output{}".format(os.path.sep)
|
||||||
|
|
||||||
|
def bin_gzip(source, target, env):
|
||||||
|
variant = str(target[0]).split(os.path.sep)[2]
|
||||||
|
|
||||||
|
# create string with location and file names based on variant
|
||||||
|
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant)
|
||||||
|
gzip_file = "{}firmware{}{}.bin.gz".format(OUTPUT_DIR, os.path.sep, variant)
|
||||||
|
|
||||||
|
# check if new target files exist and remove if necessary
|
||||||
|
if os.path.isfile(gzip_file): os.remove(gzip_file)
|
||||||
|
|
||||||
|
# write gzip firmware file
|
||||||
|
with open(bin_file,"rb") as fp:
|
||||||
|
with gzip.open(gzip_file, "wb", compresslevel = 9) as f:
|
||||||
|
shutil.copyfileobj(fp, f)
|
||||||
|
|
||||||
|
ORG_FIRMWARE_SIZE = os.stat(bin_file).st_size
|
||||||
|
GZ_FIRMWARE_SIZE = os.stat(gzip_file).st_size
|
||||||
|
|
||||||
|
print("Compressed to {:.0f}% ({} bytes)".format((GZ_FIRMWARE_SIZE / ORG_FIRMWARE_SIZE) * 100, ORG_FIRMWARE_SIZE, GZ_FIRMWARE_SIZE))
|
||||||
|
|
||||||
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_gzip])
|
||||||
34
tools/name-firmware.py
Normal file
34
tools/name-firmware.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
Import('env')
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
OUTPUT_DIR = "build_output{}".format(os.path.sep)
|
||||||
|
|
||||||
|
def bin_map_copy(source, target, env):
|
||||||
|
variant = str(target[0]).split(os.path.sep)[2]
|
||||||
|
|
||||||
|
# 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))
|
||||||
|
|
||||||
|
# create string with location and file names based on variant
|
||||||
|
map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant)
|
||||||
|
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant)
|
||||||
|
|
||||||
|
# check if new target files exist and remove if necessary
|
||||||
|
for f in [map_file, bin_file]:
|
||||||
|
if os.path.isfile(f):
|
||||||
|
os.remove(f)
|
||||||
|
|
||||||
|
# copy firmware.bin to firmware/<variant>.bin
|
||||||
|
shutil.copy(str(target[0]), bin_file)
|
||||||
|
|
||||||
|
# copy firmware.map to map/<variant>.map
|
||||||
|
if os.path.isfile("firmware.map"):
|
||||||
|
shutil.move("firmware.map", map_file)
|
||||||
|
|
||||||
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_map_copy])
|
||||||
Reference in New Issue
Block a user