The default partition table has a 1M partition for the app and there is an option for a 1.5M. If the app binary ends up being larger, the build will fail.
Now rg_tool.py will create a dummy partition table with a 3M partition which should allow all builds to succeed.
esp-idf 4.4 does some fancy powershell stuff instead of adding commands to the PATH:
````
function idf.py { &python "$IDF_PATH\tools\idf.py" $args }
function espefuse.py { &python "$IDF_PATH\components\esptool_py\esptool\espefuse.py" $args }
function espsecure.py { &python "$IDF_PATH\components\esptool_py\esptool\espsecure.py" $args }
function otatool.py { &python "$IDF_PATH\components\app_update\otatool.py" $args }
function parttool.py { &python "$IDF_PATH\components\partition_table\parttool.py" $args }
````
`subprocess.run`'s subshell can't see or run those.
All the tools we execute are now defined at the start of the script and can be overridden if needed.
It also defines the absolute path to gen_esp32part.py which seems to be missing in some environments.
The profiling hasn't worked in a while and the serial causes issues on some setup.
Let's let esp-idf handle all of that through idf_monitor.py.
Deliberately not using `idf.py monitor` because it has some very slow preamble stuff going on.
* rg_tool.py: add optional --fatsize argument
This optional argument adds a FAT storage partition of the provided
size (500K, 5M,...) to the built image, with the label 'vfs'.
Initially I thought displays would be used on many devices, but clearly every device has a different one.
So it's better to keep the sequence in the target/config.h in order to avoid modifying rg_display.c all the time.
The slightly faster boot times were nice but it's not very safe to go against esp-idf, especially that we support several chips with slightly different behaviors...
Image format is decided based on IDF_TARGET.
The environment variable IMG_FORMAT is also available to override this (which will be useful if we add multiple formats for a single target, eg esp32s3_uf2).
It's now possible to run a python script to override or set some elements handled by rg_tool, such as .fw format, idf_target, etc.
This is not the definitive version. I think injecting python in rg_tool isn't "correct", it should export a structure or something...
For simplicity I reverted to using a python file to define partitions. The csv would've been nice, allowing `idf.py partitiob-table` to work, but it's pointless if we ignore it and generate the table ourselves anyway (due to configurable apps list)...