Skip to content

Commit ace4551

Browse files
authored
Merge pull request wled#1352 from Aircoookie/1m_ota
Merge new platformio to FS branch
2 parents 5119799 + fe57bfc commit ace4551

20 files changed

+316
-81
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
.pio
2+
.cache
23
.pioenvs
34
.piolibdeps
45
.vscode
56
!.vscode/extensions.json
67
/wled00/Release
78
/wled00/extLibs
89
/platformio_override.ini
10+
/wled00/my_config.h
11+
/build_output
912
.DS_Store
1013
.gitignore
1114
.clang-format

.gitpod.Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM gitpod/workspace-full
2+
3+
USER gitpod
4+
5+
RUN pip3 install -U platformio

.gitpod.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
tasks:
2+
- command: platformio run
3+
4+
image:
5+
file: .gitpod.Dockerfile
6+
7+
vscode:
8+
extensions:
9+
- [email protected]:u3GsZ5PK12Ddr79vh4TWgQ==
10+
- [email protected]:e0IYyp0efFqVsrZwsIe8CA==
11+
- [email protected]:fbZNfSpnd8XkAHGfAPS2rA==
12+
- [email protected]:Tbu8dTz0i+/bgcKQTQ5b8g==

pio/gzip-firmware.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Import('env')
2+
import os
3+
import shutil
4+
import gzip
5+
6+
OUTPUT_DIR = "build_output{}".format(os.path.sep)
7+
8+
def bin_gzip(source, target, env):
9+
variant = str(target[0]).split(os.path.sep)[2]
10+
11+
# create string with location and file names based on variant
12+
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant)
13+
gzip_file = "{}firmware{}{}.bin.gz".format(OUTPUT_DIR, os.path.sep, variant)
14+
15+
# check if new target files exist and remove if necessary
16+
if os.path.isfile(gzip_file): os.remove(gzip_file)
17+
18+
# write gzip firmware file
19+
with open(bin_file,"rb") as fp:
20+
with gzip.open(gzip_file, "wb", compresslevel = 9) as f:
21+
shutil.copyfileobj(fp, f)
22+
23+
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_gzip])

pio/name-firmware.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Import('env')
2+
import os
3+
import shutil
4+
5+
OUTPUT_DIR = "build_output{}".format(os.path.sep)
6+
7+
def bin_rename_copy(source, target, env):
8+
variant = str(target[0]).split(os.path.sep)[2]
9+
10+
# check if output directories exist and create if necessary
11+
if not os.path.isdir(OUTPUT_DIR):
12+
os.mkdir(OUTPUT_DIR)
13+
14+
for d in ['firmware', 'map']:
15+
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)):
16+
os.mkdir("{}{}".format(OUTPUT_DIR, d))
17+
18+
# create string with location and file names based on variant
19+
map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant)
20+
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant)
21+
22+
# check if new target files exist and remove if necessary
23+
for f in [map_file, bin_file]:
24+
if os.path.isfile(f):
25+
os.remove(f)
26+
27+
# copy firmware.bin to firmware/<variant>.bin
28+
shutil.copy(str(target[0]), bin_file)
29+
30+
# copy firmware.map to map/<variant>.map
31+
if os.path.isfile("firmware.map"):
32+
shutil.move("firmware.map", map_file)
33+
34+
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_rename_copy])

pio/obj-dump.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Little convenience script to get an object dump
2+
3+
Import('env')
4+
5+
def obj_dump_after_elf(source, target, env):
6+
print("Create firmware.asm")
7+
env.Execute("xtensa-lx106-elf-objdump "+ "-D " + str(target[0]) + " > "+ "${PROGNAME}.asm")
8+
9+
env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf", [obj_dump_after_elf])

pio/strip-floats.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Import('env')
2+
3+
#
4+
# Dump build environment (for debug)
5+
#print env.Dump()
6+
#
7+
8+
flags = " ".join(env['LINKFLAGS'])
9+
flags = flags.replace("-u _printf_float", "")
10+
flags = flags.replace("-u _scanf_float", "")
11+
newflags = flags.split()
12+
13+
env.Replace(
14+
LINKFLAGS=newflags
15+
)

pio/user_config_copy.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Import('env')
2+
import os
3+
import shutil
4+
5+
# copy WLED00/my_config_sample.h to WLED00/my_config.h
6+
if os.path.isfile("wled00/my_config.h"):
7+
print ("*** use existing my_config.h ***")
8+
else:
9+
shutil.copy("wled00/my_config_sample.h", "wled00/my_config.h")

0 commit comments

Comments
 (0)