Visual Micro
https://www.visualmicro.com/forums/YaBB.pl
Other >> Ideas, Suggestions and Related Tools >> SPIFFS data .bin file creation when compiling ?
https://www.visualmicro.com/forums/YaBB.pl?num=1596129354

Message started by WoeperBe on Jul 30th, 2020 at 6:15pm

Title: SPIFFS data .bin file creation when compiling ?
Post by WoeperBe on Jul 30th, 2020 at 6:15pm
Hello everybody,
Is there a way to have the SPIFFS.bin file to be recreated and put in the release directory automaticaly when hitting the compile button ?

i'm using Visual Studio 2017 community Version

Title: Re: SPIFFS data .bin file creation when compiling ?
Post by Visual Micro on Jul 30th, 2020 at 6:26pm
Hi

Trying to get some context here so few questions:-

Which IDE?
Do you know about "vMicro>Publish Server Data Files (spiffs)"?

Thanks

Title: Re: SPIFFS data .bin file creation when compiling ?
Post by WoeperBe on Jul 30th, 2020 at 6:46pm
Yes i do
I use Microsoft Visual Studio 2017 with Visual Micro
I 'm looking a way to have when i click the compile button the data subfolder is compiled also to the spiffs.bin file and put together with the sketch bin file to the release directory
Then i use a homemade program to copy these files to a webserver for httpupdate calles from my nodemcu modules

Title: Re: SPIFFS data .bin file creation when compiling ?
Post by Visual Micro on Jul 30th, 2020 at 8:16pm
We need to come up with something more flexible but you can call the spiffs system from a post build event. Passing an invalid port just creates the .bin withouth upload. It will show an error that releates to the invalid port but the .bin should have created OK.

Unfortunetly it will always create the bin in a sub folder below the specified folder but the sub folder name shouldn't change if your spiffs options don't change.

The default output uses the temp build folder which you can see in the verbose output or when "vMicro>Compiler>Show build folder" is enabled.

There are two esp8266 examples below. One using the build folder variables and one with hard coded output folder.

There is also an ESP32 variation in the example below (in case other readers need it).

Add the following into a board.txt in the project folder, save it then click build.

[code]# ESP8266 post build spiffs creation
#

# Use build folder -build.path="{build.path}"
# recipe.hooks.postbuild.1.pattern="{vm.platform.root.path}/../../ESP8266FSUpload.exe" -serial.port=NO_PORT -build.path="{build.path}" -target_platform="{target_platform}" -runtime.tools.mkspiffs.path="{runtime.tools.mkspiffs.path}" -board.name="{name}" -upload.verbose={upload.verbose} -upload.resetmethod={upload.resetmethod} -upload.speed={upload.speed}  -platform.path="{runtime.platform.path}" -project.name="{build.project_name}" -project.path="{build.project_path}" -tools.esptool.cmd="{tools.esptool.cmd}" -runtime.tools.esptool.path="{runtime.tools.esptool.path}" -compiler.path="{compiler.path}" -build.spiffs_start="{build.spiffs_start}" -build.spiffs_end="{build.spiffs_end}" -build.spiffs_pagesize="{build.spiffs_pagesize}" -build.spiffs_blocksize="{build.spiffs_blocksize}"

#Use specific path
recipe.hooks.postbuild.1.pattern="{vm.platform.root.path}/../../ESP8266FSUpload.exe" -serial.port=NO_PORT -build.path="C:\myrepos\Sketch17\Sketch17\Release" -target_platform="{target_platform}" -runtime.tools.mkspiffs.path="{runtime.tools.mkspiffs.path}" -board.name="{name}" -upload.verbose={upload.verbose} -upload.resetmethod={upload.resetmethod} -upload.speed={upload.speed}  -platform.path="{runtime.platform.path}" -project.name="{build.project_name}" -project.path="{build.project_path}" -tools.esptool.cmd="{tools.esptool.cmd}" -runtime.tools.esptool.path="{runtime.tools.esptool.path}" -compiler.path="{compiler.path}" -build.spiffs_start="{build.spiffs_start}" -build.spiffs_end="{build.spiffs_end}" -build.spiffs_pagesize="{build.spiffs_pagesize}" -build.spiffs_blocksize="{build.spiffs_blocksize}"



# ESP32 post build spiffs creation
#
# recipe.hooks.postbuild.1.pattern="{vm.platform.root.path}/../../ESP32FSUpload.exe" -serial.port=NO_PORT -build.path="{build.path}" -target_platform="esp32" -runtime.tools.mkspiffs.path="{runtime.tools.mkspiffs.path}" -board.name="{name}" -upload.speed={upload.speed}  -platform.path="{runtime.platform.path}" -project.name="{build.project_name}" -project.path="{build.project_path}" -compiler.path="{compiler.path}" -build.partitions="{build.partitions}" -upload.tool={upload.tool} -tools.esptool_py.cmd="{tools.esptool_py.cmd}"  -runtime.tools.esptool_py.path="{runtime.tools.esptool_py.path}" -build.flash_mode={build.flash_mode} -build.flash_freq={build.flash_freq}
[/code]

Title: Re: SPIFFS data .bin file creation when compiling ?
Post by WoeperBe on Aug 1st, 2020 at 10:37am
Hello,

You made my day  :)
Thanks a lot

Marc

Title: Re: SPIFFS data .bin file creation when compiling ?
Post by WoeperBe on Aug 1st, 2020 at 3:13pm
Hello,
Is there something similar that i could add to board.txt that after uploading the sketch allows me to also upload the spiffs file ?

Title: Re: SPIFFS data .bin file creation when compiling ?
Post by Visual Micro on Aug 1st, 2020 at 3:29pm
Is this what you need?

"After build do same as clicking "vMicro>Publish Server Data Files" using the current COM port or IP address (OTA) from the uploader settings"


Title: Re: SPIFFS data .bin file creation when compiling ?
Post by WoeperBe on Aug 1st, 2020 at 3:33pm
Will this work when i click on the Upload button ?
Annotation_2020-08-01_163222_PNG.jpg (10 KB | 1 )

Title: Re: SPIFFS data .bin file creation when compiling ?
Post by WoeperBe on Aug 1st, 2020 at 3:43pm
To be more clear:
With the compile button i have now the both .bin files created where i want them.
Now i would like when i click on the upload button the sketch is uploaded as it does but i would like to add there the SPIFFS .bin file upload ...

Title: Re: SPIFFS data .bin file creation when compiling ?
Post by Visual Micro on Aug 1st, 2020 at 3:59pm
1)
Can you explain why you needed the bin created prior to upload? The standard "vMicro>Upload Server Data Files" creates the bin and then does the upload at the same time. It would help to understand why you need the task split into two parts.

2) General Info

You can add any pre or post build and upload events that you want. If you switch on vMicro>Compiler>Verbose, vMicro>Compiler>Show build properties and vMicro>Uploader>Verbose you will see all the available build/upload properties when you perform the various tasks. All the properties that show for each task (build or upload) can be used to make up event hooks.

recipe.hooks.prebuild
recipe.hooks.postbuild
recipe.hooks.preupload
recipe.hooks.postupload

nb:

Events support multiple hooks. That is why my previous postbuild example is suffixed with ".1.pattern". This means you could add ".2.pattern" if needed but you might only need .1

A top tip is to look at the build properties and verbose output to see if your selected toolchain already uses any of the events. I think teensy is the only one that currently uses the postbuild. I don't recall another tool chain that uses any of the "post" events. If a tool chain does use an event yours will probably need to be ".2"







Title: Re: SPIFFS data .bin file creation when compiling ?
Post by WoeperBe on Aug 1st, 2020 at 7:50pm
Hello,
Answer to 1.
I compile both the sketch and spiffs .bin files
Then i have a homemade program to upload this files to a webserver for httpupdate usage
Afterwards i can if i like upload locally to one or more modules by selecting the IP address and clicking the upload button.
Here i needed that the spiffs .bin is every time uploaded at the same time .

Answer to 2.
This answer gives me all what i need to make my preferences possible :-)

Title: Re: SPIFFS data .bin file creation when compiling ?
Post by Visual Micro on Aug 1st, 2020 at 8:06pm
That sounds like an amazing OTA mode :) Interesting thanks

Title: Re: SPIFFS data .bin file creation when compiling ?
Post by WoeperBe on Aug 2nd, 2020 at 8:56am
Hello,
I have one more question : I now need to put the ipaddress i selected into the  command i put behind recipe.hooks.postupload to upload the spiffs file
Annotation_2020-08-02_095606.jpg (164 KB | 1 )

Title: Re: SPIFFS data .bin file creation when compiling ?
Post by Visual Micro on Aug 2nd, 2020 at 10:24am
If you click the Upload server data files menu item it will show the params

Visual Micro » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2021. All Rights Reserved.