mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
tools: add json schema for idf_size
This commit is contained in:
parent
ccef7c1712
commit
3c69e6c990
@ -576,7 +576,6 @@ class StructureForSummary(object):
|
||||
r = StructureForSummary()
|
||||
|
||||
diram_filter = filter(in_diram, segments)
|
||||
# TODO: We assume all DIRAM region are covered by both I/D segments. If not, the total size cannot be calculated accurately. Add check for this.
|
||||
r.diram_total = int(get_size(diram_filter) / 2)
|
||||
|
||||
dram_filter = filter(in_dram, segments)
|
||||
|
File diff suppressed because it is too large
Load Diff
22
tools/test_idf_size/json_validate_test.py
Normal file
22
tools/test_idf_size/json_validate_test.py
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
import json
|
||||
import os
|
||||
from sys import stdin
|
||||
|
||||
try:
|
||||
import jsonschema
|
||||
except ImportError:
|
||||
raise RuntimeError('You need to install jsonschema package to use validate command')
|
||||
|
||||
input_json = ''
|
||||
for line in stdin:
|
||||
input_json += line
|
||||
size_json = json.loads(input_json)
|
||||
with open(os.path.join(os.path.dirname(__file__), 'size_schema.json'), 'r') as schema_file:
|
||||
schema_json = json.load(schema_file)
|
||||
jsonschema.validate(size_json, schema_json)
|
||||
print(input_json.strip('\n'))
|
167
tools/test_idf_size/size_schema.json
Normal file
167
tools/test_idf_size/size_schema.json
Normal file
@ -0,0 +1,167 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://github.com/espressif/esp-idf/blob/master/tools/size-schema.json",
|
||||
"type": "object",
|
||||
"oneOf": [
|
||||
{
|
||||
"patternProperties": {
|
||||
"^dram_(data|bss|rodata|other|remain|total)$": {
|
||||
"type": "integer"
|
||||
},
|
||||
"^used_(dram|iram|diram|flash_non_ram)$": {
|
||||
"type": "integer"
|
||||
},
|
||||
"^used_(dram|iram|diram)_ratio$": {
|
||||
"type": "number"
|
||||
},
|
||||
"^iram_(vectors|text|other|remain|total)$": {
|
||||
"type": "integer"
|
||||
},
|
||||
"^diram_(data|bss|rodata|vectors|text|other|remain|total)$": {
|
||||
"type": "integer"
|
||||
},
|
||||
"^flash_(code|rodata|other)$": {
|
||||
"type": "integer"
|
||||
},
|
||||
"^total_size$": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"dram_data",
|
||||
"dram_bss",
|
||||
"dram_rodata",
|
||||
"dram_other",
|
||||
"used_dram",
|
||||
"dram_total",
|
||||
"used_dram_ratio",
|
||||
"dram_remain",
|
||||
"iram_vectors",
|
||||
"iram_text",
|
||||
"iram_other",
|
||||
"used_iram",
|
||||
"iram_total",
|
||||
"used_iram_ratio",
|
||||
"iram_remain",
|
||||
"diram_data",
|
||||
"diram_bss",
|
||||
"diram_text",
|
||||
"diram_vectors",
|
||||
"diram_rodata",
|
||||
"diram_other",
|
||||
"diram_total",
|
||||
"used_diram",
|
||||
"used_diram_ratio",
|
||||
"diram_remain",
|
||||
"flash_code",
|
||||
"flash_rodata",
|
||||
"flash_other",
|
||||
"used_flash_non_ram",
|
||||
"total_size"
|
||||
]
|
||||
},
|
||||
{
|
||||
"patternProperties": {
|
||||
"(\\.a$|\\.o$|\\.obj$|exe)": {
|
||||
"$ref": "#/$defs/memory_components"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"patternProperties": {
|
||||
"(^\\.dram0\\.(bss|data)$)": {
|
||||
"$ref": "#/$defs/archive_details"
|
||||
},
|
||||
"(^\\.flash\\.(rodata|text|appdesc|rodata_noload)$)": {
|
||||
"$ref": "#/$defs/archive_details"
|
||||
},
|
||||
"(^\\.flash_rodata_dummy$)": {
|
||||
"$ref": "#/$defs/archive_details"
|
||||
},
|
||||
"(^\\.iram0\\.(text|vectors|text_end|bss|data)$)": {
|
||||
"$ref": "#/$defs/archive_details"
|
||||
},
|
||||
"(^\\.rtc\\.(bss|data|text)$)": {
|
||||
"$ref": "#/$defs/archive_details"
|
||||
},
|
||||
"(^\\.noinit$)": {
|
||||
"$ref": "#/$defs/archive_details"
|
||||
},
|
||||
"(^\\.rtc_noinit$)": {
|
||||
"$ref": "#/$defs/archive_details"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
".dram0.bss",
|
||||
".dram0.data",
|
||||
".flash.rodata",
|
||||
".flash.text",
|
||||
".iram0.text",
|
||||
".noinit",
|
||||
".rtc.bss",
|
||||
".rtc.data",
|
||||
".rtc.text",
|
||||
".rtc_noinit"
|
||||
]
|
||||
},
|
||||
{
|
||||
"patternProperties": {
|
||||
"(^diff$|^reference$|^current$)": {
|
||||
"$ref": "#"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
],
|
||||
"$defs": {
|
||||
"memory_components": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
".dram0.bss": {
|
||||
"type": "integer"
|
||||
},
|
||||
".dram0.data": {
|
||||
"type": "integer"
|
||||
},
|
||||
".flash.rodata": {
|
||||
"type": "integer"
|
||||
},
|
||||
".flash.text": {
|
||||
"type": "integer"
|
||||
},
|
||||
".flash.appdesc": {
|
||||
"type": "integer"
|
||||
},
|
||||
".iram0.text": {
|
||||
"type": "integer"
|
||||
},
|
||||
".iram0.vectors": {
|
||||
"type": "integer"
|
||||
},
|
||||
".rtc.data": {
|
||||
"type": "integer"
|
||||
},
|
||||
"flash_total": {
|
||||
"type": "integer"
|
||||
},
|
||||
"ram_st_total": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"flash_total",
|
||||
"ram_st_total"
|
||||
]
|
||||
},
|
||||
"archive_details": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -65,14 +65,19 @@
|
||||
&& echo -e "\n***\nRunning idf_size.py diff with another app (different target)..." &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py app.map --diff app_esp32s2.map &>> output \
|
||||
&& echo -e "\n***\nProducing JSON output..." &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json app.map &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json --archives app.map &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json --files app.map &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json --archive_details libdriver.a app.map &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json app.map --diff app2.map &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json --archives app.map --diff app2.map &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json --files app.map --diff app2.map &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json --archive_details libdriver.a app.map --diff app2.map &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json app.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json --archives app.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json --files app.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json --archive_details libdriver.a app.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json app.map --diff app2.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json --archives app.map --diff app2.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json --files app.map --diff app2.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json --archive_details libdriver.a app.map --diff app2.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& echo -e "\n***\nProducing JSON output for esp32s2..." &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json app_esp32s2.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json --archives app_esp32s2.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json --files app_esp32s2.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& python -m coverage run -a $IDF_PATH/tools/idf_size.py --json --archive_details libdriver.a app_esp32s2.map | python $IDF_PATH/tools/test_idf_size/json_validate_test.py &>> output \
|
||||
&& echo -e "\n***\nProducing JSON file output..." &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json --output-file output.json app.map &>> output \
|
||||
&& echo -e "\n***\nProducing text file output..." &>> output \
|
||||
|
Loading…
Reference in New Issue
Block a user