-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add wifi manager and .bin flash howto
- Loading branch information
Showing
10 changed files
with
209 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
|
||
# Visual Studio Code.pio | ||
.vscode | ||
|
||
#build folder | ||
binFiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@echo off | ||
|
||
RMDIR "binFiles" /S /Q | ||
|
||
set VERSION_number="3.0.2" | ||
|
||
set CURRENT_ENV=esp32dev | ||
pio run -e %CURRENT_ENV% | ||
echo F| xcopy ".pio\build\%CURRENT_ENV%\firmware.bin" "binFiles\%CURRENT_ENV%\firmware.bin" /v /f /y | ||
echo F| xcopy ".pio\build\%CURRENT_ENV%\partitions.bin" "binFiles\%CURRENT_ENV%\partitions.bin" /v /f /y | ||
echo F| xcopy "%userprofile%\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\bin\bootloader_dio_40m.bin" "binFiles\%CURRENT_ENV%\bootloader.bin" /v /f /y | ||
echo F| xcopy "%userprofile%\.platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin" "binFiles\%CURRENT_ENV%\boot_app0.bin" /v /f /y | ||
python script\esp32_binary_merger\merge_bin_esp.py --output_folder binFiles\ --output_name "SolarTracerBlynk_%VERSION_NUMBER%_%CURRENT_ENV%_FULL.bin" --bin_path "binFiles\%CURRENT_ENV%\bootloader.bin" "binFiles\%CURRENT_ENV%\partitions.bin" "binFiles\%CURRENT_ENV%\boot_app0.bin" "binFiles\%CURRENT_ENV%\firmware.bin" --bin_address 0x1000 0x8000 0xe000 0x10000 | ||
echo F| xcopy "binFiles\%CURRENT_ENV%\firmware.bin" "binFiles\SolarTracerBlynk_%VERSION_NUMBER%_%CURRENT_ENV%.bin" /v /f /y | ||
|
||
set CURRENT_ENV=esp8266 | ||
pio run -e %CURRENT_ENV% | ||
rem 0x0 .pio\build\esp8266\firmware.bin | ||
echo F| xcopy ".pio\build\%CURRENT_ENV%\firmware.bin" "binFiles\SolarTracerBlynk_%VERSION_NUMBER%_%CURRENT_ENV%.bin" /v /f /y | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Tony Martinet | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import os | ||
import argparse | ||
|
||
class bin(): | ||
def __init__(self, file_path, addr): | ||
self.file_path = file_path | ||
self.file_name = os.path.basename(file_path) | ||
self.addr = addr | ||
self.size = self.get_size() | ||
|
||
def get_size(self): | ||
return int(os.path.getsize(self.file_path)) | ||
|
||
class multiple_bin(): | ||
def __init__(self, name, output_folder): | ||
self.name = name | ||
self.output_folder = output_folder | ||
try: | ||
os.makedirs(os.path.realpath(self.output_folder)) | ||
except: | ||
pass | ||
self.output_path = os.path.realpath(os.path.join(self.output_folder,self.name)) | ||
self.bin_array = [] | ||
|
||
def add_bin(self, file_path, addr): | ||
self.bin_array.append(bin(file_path, addr)) | ||
|
||
def sort_bin(self): | ||
swapped = True | ||
while swapped: | ||
swapped = False | ||
for i in range(len(self.bin_array) - 1): | ||
if self.bin_array[i].addr > self.bin_array[i + 1].addr: | ||
self.bin_array[i], self.bin_array[i + 1] = self.bin_array[i + 1], self.bin_array[i] | ||
swapped = True | ||
|
||
def add_bin_to_other_bin(self, previous, binary): | ||
with open(self.output_path, "ab") as output_file: | ||
output_file.write( b'\xff' * (binary.addr-previous)) | ||
print ("Add %s from 0x%x to 0x%x (0x%x)"%(binary.file_name, binary.addr, binary.addr+binary.size, binary.size)) | ||
with open(self.output_path, "ab") as output_file, open(binary.file_path, "rb") as bin_file: | ||
output_file.write(bin_file.read()) | ||
return binary.addr+binary.size | ||
|
||
def create_bin(self): | ||
new_start = 0 | ||
open(self.output_path, "wb").close | ||
for b in self.bin_array: | ||
new_start = self.add_bin_to_other_bin(new_start, b) | ||
|
||
def check_if_possible(self): | ||
for i in range(1, len(self.bin_array)): | ||
if(self.bin_array[i].addr < (self.bin_array[i-1].addr+self.bin_array[i-1].size)): | ||
print (self.bin_array[i].addr, (self.bin_array[i-1].addr+self.bin_array[i-1].size)) | ||
raise Exception("Not possible to create this bin, overlapping between %s and %s"%(self.bin_array[i].file_name, self.bin_array[i-1].file_name)) | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='Script to merge *.bin file at different position') | ||
parser.add_argument( | ||
'--output_name', | ||
help = 'Output file name', default = "output.bin") | ||
parser.add_argument( | ||
'--output_folder', default = "output", | ||
help = 'Output folder path') | ||
parser.add_argument( | ||
'--input_folder', default = "", | ||
help = 'Input folder path') | ||
parser.add_argument( | ||
'--bin_path',nargs='+',required=True, | ||
help = 'List of bin path, same order as bin_address (space seperated)') | ||
parser.add_argument( | ||
'--bin_address',nargs='+',type=lambda x: int(x,0),required=True, | ||
help = 'List of addr, same order as bin_path (space seperated)') | ||
parser.add_argument | ||
args = parser.parse_args() | ||
mb = multiple_bin(args.output_name, args.output_folder) | ||
for path,address in zip(args.bin_path, args.bin_address): | ||
mb.add_bin(os.path.join(args.input_folder, path), address) | ||
mb.sort_bin() | ||
mb.check_if_possible() | ||
mb.create_bin() | ||
print ("%s generated with success ! (size %u)"%(args.output_name, int(os.path.getsize(mb.output_path)))) | ||
|
||
if __name__ == "__main__": | ||
exit(main()) |