-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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,52 @@ | ||
#!/bin/bash | ||
|
||
NVS_PARTITION_GENERATOR="nvs_partition_gen.py" | ||
#NVS_PARTITION_GENERATOR="nvs_partition_gen.py" | ||
SIZE_PARTITION="0x3000" | ||
|
||
cd "$(dirname $0)" | ||
echo "Jump into $PWD directory" | ||
|
||
build_binary () { | ||
if [ ! -f "$1" ]; then | ||
echo -e "\e[31m$1 file not found\e[m" | ||
return | ||
fi | ||
|
||
fname="${1%.*}" | ||
echo -e "\nBoard \e[33m$fname\e[m" | ||
comment="$(grep L_COMMENT $1 | sed -E 's/^.*,string,//; s/\s*\.\s*$//')" | ||
echo -e "\e[34m${comment}\e[m" | ||
python $NVS_PARTITION_GENERATOR\ | ||
--version v1\ | ||
--input "$1"\ | ||
--output "./build/$fname.bin"\ | ||
--size $SIZE_PARTITION | ||
} | ||
|
||
if [ "$#" -eq 0 ]; then | ||
# clean up !! | ||
rm -f build/*.bin | ||
|
||
for filename in $(ls *.csv); do | ||
build_binary "$filename" | ||
done | ||
else | ||
MY_BOARD="MY-BOARD" | ||
if [ "$#" -eq 1 ]; then | ||
MY_BOARD="${1%.*}" | ||
fi | ||
while [ ! -z "$1" ]; do | ||
build_binary "$1" | ||
shift | ||
done | ||
fi | ||
|
||
cat << EOT | ||
Minimum NVS Partition Size needed is 0x3000 bytes. Look at this link : | ||
https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/storage/nvs_partition_gen.html#running-the-utility | ||
For flashing, type : | ||
esptool --chip esp32 write_flash 0x3a2000 build/${MY_BOARD}.bin | ||
EOT |