Skip to content

Commit 47267c1

Browse files
committed
partitions: add spiffs to combine script
1 parent 08e4898 commit 47267c1

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

combine.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
phyData = open("data/phy.bin", "rb").read()
88
certsData = open("data/roots.pem", "rb").read()
99
appData = open("build/nina-fw.bin", "rb").read()
10+
spiffsData = open("data/spiffs.bin", "rb").read()
1011

1112
# Offset Size Name
1213
# 0x001000 0x007000 bootloader
@@ -17,15 +18,15 @@
1718
# 0x1B0000 0x040000 spiffs
1819
# 0x1F0000 0x010000 nvs
1920

20-
# calculate the output binary size, app offset
21+
# calculate the output binary size, app offset
2122
outputSize = 0x30000 + len(appData)
2223
if (outputSize % 1024):
2324
outputSize += 1024 - (outputSize % 1024)
2425

2526
# allocate and init to 0xff
26-
outputData = bytearray(b'\xff') * outputSize
27+
outputData = bytearray(b'\xff') * 0x200000
2728

28-
# copy data: bootloader, partitions, app
29+
# copy data: bootloader, partitions, phy, certs, app
2930
for i in range(0, len(booloaderData)):
3031
outputData[0x1000 + i] = booloaderData[i]
3132

@@ -44,11 +45,34 @@
4445
for i in range(0, len(appData)):
4546
outputData[0x30000 + i] = appData[i]
4647

48+
# add empty spiffs
49+
for i in range(0, len(spiffsData)):
50+
outputData[0x1B0000 + i] = spiffsData[i]
4751

48-
outputFilename = "NINA_W102.bin"
52+
53+
baseFilename = "NINA_W102"
4954
if (len(sys.argv) > 1):
50-
outputFilename = sys.argv[1]
55+
baseFilename = sys.argv[1]
56+
57+
outputFilename = baseFilename + ".bin"
58+
# write out
59+
with open(outputFilename,"w+b") as f:
60+
f.seek(0)
61+
f.write(outputData[:outputSize])
62+
63+
outputFilename = baseFilename + "_BOOT_APP.bin"
64+
# write out
65+
with open(outputFilename,"w+b") as f:
66+
f.seek(0)
67+
f.write(outputData[:outputSize])
68+
69+
outputFilename = baseFilename + "_APP.bin"
70+
# write out
71+
with open(outputFilename,"w+b") as f:
72+
f.seek(0)
73+
f.write(outputData[0x30000:outputSize])
5174

75+
outputFilename = baseFilename + "_ALL.bin"
5276
# write out
5377
with open(outputFilename,"w+b") as f:
5478
f.seek(0)

0 commit comments

Comments
 (0)