-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
10 changed files
with
3,223 additions
and
507 deletions.
There are no files selected for viewing
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
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
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
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,33 @@ | ||
# A CMake script to run size tool commands supporting OUTPUT_FORMAT and | ||
# OUTPUT_JSON environment variables from within ninja or make or another | ||
# cmake-based build runner. | ||
# | ||
# It is recommended to NOT USE this CMake script if you have the option of | ||
# running the tool directly. This script exists only for use inside CMake builds. | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
# Main purpose of this script: we can't expand these environment variables in the main IDF CMake build, | ||
# because we want to expand them at CMake target build time not at CMake configuration time | ||
# (so they can change without needing a CMake re-run) | ||
|
||
set(IDF_SIZE_CMD ${IDF_SIZE_TOOL}) | ||
|
||
if(DEFINED ENV{SIZE_OUTPUT_FORMAT}) | ||
list(APPEND IDF_SIZE_CMD "--format=$ENV{SIZE_OUTPUT_FORMAT}") | ||
elseif(DEFINED OUTPUT_JSON AND OUTPUT_JSON) | ||
list(APPEND IDF_SIZE_CMD "--format=json") | ||
endif() | ||
|
||
if(DEFINED IDF_SIZE_MODE) | ||
list(APPEND IDF_SIZE_CMD ${IDF_SIZE_MODE}) | ||
endif() | ||
|
||
list(APPEND IDF_SIZE_CMD ${MAP_FILE}) | ||
|
||
execute_process(COMMAND ${IDF_SIZE_CMD} | ||
RESULT_VARIABLE result | ||
) | ||
|
||
if(${result}) | ||
message(FATAL_ERROR "${IDF_SIZE_TOOL} failed") | ||
endif() |
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
Oops, something went wrong.