File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/python3
2+
3+ import sys ;
4+
5+ booloaderData = open ("bootloader.bin" , "rb" ).read ()
6+ partitionData = open ("partition-table.bin" , "rb" ).read ()
7+ networkData = open ("network_adapter.bin" , "rb" ).read ()
8+
9+ # 0x0 bootloader.bin 0x8000 partition-table.bin 0x10000 network_adapter.bin
10+
11+
12+ # calculate the output binary size, app offset
13+ outputSize = 0x10000 + len (networkData )
14+ if (outputSize % 1024 ):
15+ outputSize += 1024 - (outputSize % 1024 )
16+
17+ # allocate and init to 0xff
18+ outputData = bytearray (b'\xff ' ) * outputSize
19+
20+ # copy data: bootloader, partitions, app
21+ for i in range (0 , len (booloaderData )):
22+ outputData [0x0000 + i ] = booloaderData [i ]
23+
24+ for i in range (0 , len (partitionData )):
25+ outputData [0x8000 + i ] = partitionData [i ]
26+
27+ for i in range (0 , len (networkData )):
28+ outputData [0x10000 + i ] = networkData [i ]
29+
30+
31+ outputFilename = "ESP32-C3.bin"
32+ if (len (sys .argv ) > 1 ):
33+ outputFilename = sys .argv [1 ]
34+
35+ # write out
36+ with open (outputFilename ,"w+b" ) as f :
37+ f .seek (0 )
38+ f .write (outputData )
You can’t perform that action at this time.
0 commit comments