Commit Graph

46 Commits

Author SHA1 Message Date
Frantisek Hrbata
6f41dee0cd feat: add diff option support to idf.py size commands
This adds a possibility to specify --diff option to idf.py size,
size-components and size-files commands. This can be map file directly,
project directory or build directory.

Usage example:
idf.py size-components --diff ../hello_world2/build/hello_world.map
idf.py size-components --diff ../hello_world2/build
idf.py size-components --diff ../hello_world2

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2024-05-24 15:19:37 +08:00
Frantisek Hrbata
18334588bc feat(tools): esp_idf_size.ng integration
This integrates esp_idf_size.ng, refactored esp-idf-size version, into
esp-idf and enables it by default. The esp_idf_size.ng may be enabled
by using the --ng option, but also via ESP_IDF_SIZE_NG env. variable,
which is used in this integration.

New -l/--legacy option is added, which enforces usage of the old version.
This option can be also set via "ESP_IDF_SIZE_LEGACY" env. variable.
This should allow to easily switch back to old version if there is any
problem.

The new version is used by default for all formats, except for the "json".

Examples:
$ idf.py size                           # uses refactored version
$ idf.py size --legacy                  # uses legacy version
$ idf.py size --l                       # uses legacy version
$ idf.py size --format json             # uses legacy version
$ idf.py size --format json2            # uses refactored version
$ export ESP_IDF_SIZE_LEGACY="1"        # use legacy version only from now on

ESP_IDF_SIZE_FORCE_TERMINAL, which forces terminal control codes(colors), is also set
when running from idf.py, so the colors are propagated even if stdout
for esp_idf_size.ng is not attached to tty.

The same changes are applied also to the idf_size.py wrapper.

There is an import check if esp_idf_size.ng is available. If not,
we switch into the legacy mode. This should cover situation when the
esp-idf has support for refactored version, but it's not installed.
This should also allow users to bind to a legacy version(<1.0.0) and the
idf.py size and idf_size.py should still work. This also allow us to
restring the version in constraints file if we need to switch back to
legacy version globally.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-11-30 09:26:51 +01:00
Marius Vikhammer
d36b72ef23 fix(idf.py): fixed save-defconfig failing due to wrong argument name 2023-10-21 12:23:07 +08:00
Peter Dragun
bdcae08458 feat(tools/kconfig): add menu labels for min config
Closes https://github.com/espressif/esp-idf/issues/10358
2023-10-18 15:01:46 +02:00
Marek Fiala
206c46325a fix(tools): Tool curses import check
Verify that curses tool can be successfully imported on unix systems

When detected:
- installing esp-idf -> reinstall python environment
- using idf.py menuconfig -> raise error with hint message

Closes https://github.com/espressif/esp-idf/issues/11643
2023-07-12 13:23:06 +00:00
Frantisek Hrbata
a558ad506e tools: fix custom sdkconfig renaming in set-target
Currently the set-target has sdkconfig file name hardcoded to the
default one and doesn't honor custom config paths or names.
IMHO the only place where we can really now the config file name
is in cmake. But also the config should be really renamed only if
the set-target action is running.

This moves the config file renaming into cmake and it's performed only
when _IDF_PY_SET_TARGET_ACTION env. var. is set to 'ON'. This should
hopefully guarantee that it's really renamed only while set-target is
running.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-03-08 16:45:55 +01:00
Djordje Nedic
17d1e9ae36 bugfix: Fix windows path case sensitivity
This commit fixes an issue where paths on Windows are case insensitive, for instance when setting the build folder its name would be converted to lowercase.

The culprit is our realpath() function, that was calling os.path.normcase() internally, since we are removing that call it makes sense to just remove the function entirely and call os.path.realpath() wherever necessary.

Closes https://github.com/espressif/esp-idf/issues/10282
2023-01-17 20:51:46 +01:00
Djordje Nedic
09e61e8a23 tools: Add --output-file argument to idf.py size commands
This commit ads the corresponding --output-file option from idf_size.py to idf.py.

This is needed because piping the idf.py size output to a file would result in CMake output being present in the file as well.
2022-09-27 15:41:36 +02:00
Ivan Grokhotkov
bfc17ce35a
tools: default to text output format in 'idf.py size' 2022-09-15 16:44:21 +02:00
simon.chupin
92ef2a4c83 Tools: Add unit tests for idf.py hints 2022-09-01 17:09:46 +02:00
Djordje Nedic
5ee663d592 tools: Add CSV support to idf_size.py
This adds CSV support to idf_size.py and idf.py size actions and using the --format argument which accepts 'text', 'json' or 'csv' as input.

idf_size.py --json argument is deprecated but left to avoid a breaking change.

For idf.py size actions OUTPUT_JSON environment variable set at configuration time is overriden at target build time if --format is used.

Additionally, this commit refactors big parts of code, unified usage of json_dict and manually generated dictionaries for textual output and improves code quality in many parts.
2022-08-26 15:34:21 +02:00
Roland Dobai
152ce8884b Tools: Fix idf.py hints to be enabled all the time and being able to disable them 2022-08-15 13:01:39 +02:00
Marek Fiala
9c0969b512 Tools: Export selected target actions
Added option --json to action help, for export selected target actions
2022-07-19 20:02:55 +02:00
simon.chupin
43c69f0910 idf.py: Add automated hints on how to resolve errors 2022-07-04 08:15:23 +00:00
Roland Dobai
8dddb8b596 Revert "Merge branch 'feature/clippy' into 'master'"
This reverts merge request !16998
2022-06-29 16:46:47 +08:00
simon.chupin
c6a6eaeb60 idf.py: Add automated hints on how to resolve errors 2022-06-23 14:09:34 +02:00
simon.chupin
44f3c19fa9 tools: Add python types hints 2022-06-15 14:33:29 +02:00
simon.chupin
1c5e596633 idf.py: Change copyright in tools dir 2022-05-24 14:01:50 +02:00
Marek Fiala
b5c374ae3e tools: Deprecated commands removed from idf.py
Remove deprecated commands from idf.py, but they are still kept working as cmake deprecated targets.
2022-03-25 09:08:53 +01:00
Marek Fiala
3f6add5964 tools: set baudrate and port with otatool.
Bugfix: Allow setting options port -p and baudrate -b, with idf.py otatool commands.

Closes https://github.com/espressif/esp-idf/issues/8317
2022-03-11 12:27:58 +01:00
Roland Dobai
5118dd7cf3 Tools: Add "idf.py save-defconfig" command to generate sdkconfig.defaults 2021-12-15 17:15:31 +01:00
Fu Hanxi
47fc761299 feat(idf.py): add idf.py clang-check and idf.py clang-html-report 2021-11-16 14:08:59 +08:00
Marek Fiala
ff18a96f7d tools: replace _ with - in idf.py
Closes https://github.com/espressif/esp-idf/issues/5126
2021-10-13 17:30:38 +08:00
simon.chupin
844dd5075f Tools: make idf_size work with overflow
Closes https://github.com/espressif/esp-idf/issues/6914
closes https://github.com/espressif/esp-idf/issues/4234
2021-09-16 14:12:46 +02:00
Simon
0b9afa509f tools: Add docs subcommand docs which opens browser with documentation for current version of idf and model of your target
Add docs subcommand with options:
--no-browser - Prints url for current documentation instead of opens browser with documentation
--language - Select documentation language
--starting-page - Choice section of documentation to open
--version - Choice version of esp-idf
--target - Choice model of your target
2021-07-12 10:56:37 +02:00
Fu Hanxi
0146f258d7 style: format python files with isort and double-quote-string-fixer 2021-01-26 10:49:01 +08:00
martin.gano
b599f127b5 add new command to idf 2020-09-21 23:38:52 +02:00
Angus Gratton
ad295037a8 idf.py: Disable CMake --warn-uninitialized option by default
Can still be enabled by passing --cmake-warn-uninitialized on the command line

Prevents CMake warnings printed by default if IDF_PATH is underneath the CMake
project directory.

The reason for this is that CMake --warn-uninitialized only enables checks
inside the project directory (ie top-level CMakeLists.txt directory and
subdirectories), it doesn't enable for files included from other directories.

(The only way to enable warnings in other directories is to pass
--check-system-dirs and this looks like it's only useful for CMake's own
developers as it prints a lot of warnings from inside CMake otherwise - see
https://gitlab.kitware.com/cmake/cmake/-/issues/19645 )

Plan to follow up with a later commit to clean up most of the warnings (which
aren't problems for CMake execution), but we'll also disable this option by
default to avoid this unexpected triggering of IDF warnings.
2020-08-26 09:53:56 +10:00
Ivan Grokhotkov
7f977094bd Merge branch 'feature/idfpy_add_help_subcommand' into 'master'
idf.py: Add help and build-system-targets subcommands

Closes IDF-1884

See merge request espressif/esp-idf!9615
2020-07-21 22:06:14 +08:00
Sergei Silnov
140c5800dd idf.py: Add command to list build system targets 2020-07-15 16:43:17 +02:00
Sergei Silnov
85de9d4f16 idf.py: Add help for options with envvar defaults 2020-06-30 12:04:35 +02:00
Ivan Grokhotkov
5aae08e6b4 Merge branch 'feature/pyc_clean' into 'master'
tools/idf.py: Clean Python bytecode files

Closes IDFGH-3368

See merge request espressif/esp-idf!8907
2020-06-22 15:53:41 +08:00
morris
067b1b91c2 global: add new target name: esp32-s3
add target name, chip ID, toochain descriptions for ESP32-S3
2020-06-11 21:40:08 +08:00
Roland Dobai
9930060ea8 tools/idf.py: Clean Python bytecode files 2020-06-03 12:29:25 +02:00
Scott Shawcroft
8c4dc88d27 tool: Fix spelling in core_ext.py
Closes: https://github.com/espressif/esp-idf/pull/5145
2020-05-13 14:50:43 +08:00
Ivan Grokhotkov
7b79b52062 tools: allow alternative spellings of target name (ESP32-S2, ESP32S2)
by ignoring character case and hyphens in target name.
2020-04-29 23:42:18 +02:00
Renz Christian Bagaporo
7ddd39ec7d idf.py: use underlying flash targets 2020-01-15 03:36:47 +00:00
Sergei Silnov
97f7b918c1 idf.py: add --list-targets option to list support targets 2019-12-18 16:50:49 +01:00
Roland Dobai
7ab43bffde tools: Fix menuconfig for Python 3 2019-12-11 14:29:07 +01:00
michael
3e55baea90 menuconfig: fix the MENUCONFIG_STYLE encoding issue and CLI env issue
1. Call cli with explicit argv

When using debugging tools like `pydbg.py --some_arg idf.py -G Ninga
build`, those tools usually call the python script with sys.argv
modified to correct value. But if the cli is called with argv blank, the
cli will get the argv again, and finally get the original command line,
which is incorrect for debugging.

2. Encode the style unicode string back to ascii in menuconfig cmd

On Windows MSYS python2.7, the unicode string set in os.environ will
cause the subprocess creating to fail. All os.environ values should be
strings.
2019-12-05 01:39:46 +08:00
Ivan Grokhotkov
562a3980b2 idf.py: fix fallback to build system target 2019-12-04 07:13:31 +00:00
Roland Dobai
bd2fc9f832 Make menuconfig colors configurable
Closes https://github.com/espressif/esp-idf/issues/4387
2019-11-26 10:40:34 +01:00
Sergei Silnov
dc4a5d06e3 idf.py: Fix error message for unknown target 2019-11-25 15:41:34 +01:00
Sergei Silnov
262ed0e72b idf.py: Fix regression ignorance of --verbose flag 2019-11-25 11:47:55 +01:00
Sergei Silnov
18c594e250 idf.py: run build system target for unknown commands 2019-11-19 13:28:00 +01:00
Sergei Silnov
5e6aae3e04 Fix typo and naming format for extensions 2019-10-30 10:34:17 +01:00