mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 04:43:33 +00:00
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.
This commit is contained in:
@@ -16,6 +16,9 @@ To optimize both firmware binary size and memory usage it's necessary to measure
|
||||
|
||||
Using the :ref:`idf.py` sub-commands ``size``, ``size-components`` and ``size-files`` provides a summary of memory used by the project:
|
||||
|
||||
.. note::
|
||||
It is possible to add ``-DOUTPUT_FORMAT=csv`` or ``-DOUTPUT_FORMAT=json`` to get the output in CSV or JSON format.
|
||||
|
||||
Size Summary (idf.py size)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -188,9 +191,9 @@ Comparing Two Binaries
|
||||
|
||||
If making some changes that affect binary size, it's possible to use an ESP-IDF tool to break down the exact differences in size.
|
||||
|
||||
This operation isn't part of ``idf.py``, it's necessary to run the ``idf-size.py`` Python tool directly.
|
||||
This operation isn't part of ``idf.py``, it's necessary to run the ``idf_size.py`` Python tool directly.
|
||||
|
||||
To do so, first locate the linker map file in the build directory. It will have the name ``PROJECTNAME.map``. The ``idf-size.py`` tool performs its analysis based on the output of the linker map file.
|
||||
To do so, first locate the linker map file in the build directory. It will have the name ``PROJECTNAME.map``. The ``idf_size.py`` tool performs its analysis based on the output of the linker map file.
|
||||
|
||||
To compare with another binary, you will also need its corresponding ``.map`` file saved from the build directory.
|
||||
|
||||
@@ -215,6 +218,9 @@ We can see from the "Difference" column that changing this one setting caused th
|
||||
|
||||
It's also possible to use the "diff" mode to output a table of component-level (static library archive) differences:
|
||||
|
||||
.. note::
|
||||
To get the output in JSON or CSV format using ``idf_size.py`` it is possible to use the ``--format`` option.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$IDF_PATH/tools/idf_size.py --archives --diff build_Og/https_request.map build_Oshttps_request.map
|
||||
|
@@ -201,7 +201,7 @@ Similarly, this will print the same information for each component used in the p
|
||||
|
||||
Will print size information per source file in the project.
|
||||
|
||||
If you define variable ``-DOUTPUT_JSON=1`` when running CMake (or ``idf.py``), the output will be formatted as JSON not as human readable text. See ``idf.py-size`` for more information.
|
||||
If you define the ``OUTPUT_FORMAT`` variable as ``csv`` or ``json`` when running CMake (or ``idf.py``), the output will be formatted in the specified format and not as human readable text. See ``idf.py-size`` for more information.
|
||||
|
||||
Reconfigure the project: reconfigure
|
||||
------------------------------------
|
||||
|
Reference in New Issue
Block a user