Merge branch 'bugfix/archive_details_always_run_like_diff_v4.2' into 'release/v4.2'

tools: fix bug with idf_size argument archive_details (v4.2)

See merge request espressif/esp-idf!15776
This commit is contained in:
Roland Dobai
2021-11-11 12:34:14 +00:00
2 changed files with 572 additions and 600 deletions

View File

@@ -1079,7 +1079,7 @@ class StructureForArchiveSymbols(object):
def get_archive_symbols(sections, archive, as_json=False, sections_diff=None): # type: (Dict, str, bool, Dict) -> str def get_archive_symbols(sections, archive, as_json=False, sections_diff=None): # type: (Dict, str, bool, Dict) -> str
diff_en = sections_diff is not None diff_en = bool(sections_diff)
current = StructureForArchiveSymbols.get(archive, sections) current = StructureForArchiveSymbols.get(archive, sections)
reference = StructureForArchiveSymbols.get(archive, sections_diff) if sections_diff else {} reference = StructureForArchiveSymbols.get(archive, sections_diff) if sections_diff else {}
@@ -1103,19 +1103,28 @@ def get_archive_symbols(sections, archive, as_json=False, sections_diff=None):
def _get_item_pairs(name, section): # type: (str, collections.OrderedDict) -> collections.OrderedDict def _get_item_pairs(name, section): # type: (str, collections.OrderedDict) -> collections.OrderedDict
return collections.OrderedDict([(key.replace(name + '.', ''), val) for key, val in iteritems(section)]) return collections.OrderedDict([(key.replace(name + '.', ''), val) for key, val in iteritems(section)])
def _get_max_len(symbols_dict): # type: (Dict) -> Tuple[int, int]
names_max_len = 0
numbers_max_len = 0
for t, s in iteritems(symbols_dict):
numbers_max_len = max([numbers_max_len] + [len(str(x)) for _, x in iteritems(s)])
names_max_len = max([names_max_len] + [len(x) for x in _get_item_pairs(t, s)])
return names_max_len, numbers_max_len
def _get_output(section_symbols): # type: (Dict) -> str def _get_output(section_symbols): # type: (Dict) -> str
output = '' output = ''
names_max_len, numbers_max_len = _get_max_len(section_symbols)
for t, s in iteritems(section_symbols): for t, s in iteritems(section_symbols):
output += '{}Symbols from section: {}{}'.format(os.linesep, t, os.linesep) output += '{}Symbols from section: {}{}'.format(os.linesep, t, os.linesep)
item_pairs = _get_item_pairs(t, s) item_pairs = _get_item_pairs(t, s)
output += ' '.join(['{}({})'.format(key, val) for key, val in iteritems(item_pairs)]) for key, val in iteritems(item_pairs):
output += ' '.join([('\t{:<%d} : {:>%d}\n' % (names_max_len,numbers_max_len)).format(key, val)])
section_total = sum([val for _, val in iteritems(item_pairs)]) section_total = sum([val for _, val in iteritems(item_pairs)])
output += '{}Section total: {}{}'.format(os.linesep if section_total > 0 else '', output += 'Section total: {}{}'.format(section_total, os.linesep)
section_total,
os.linesep)
return output return output
output = 'Symbols within the archive: {} (Not all symbols may be reported){}'.format(archive, os.linesep) output = '{}Symbols within the archive: {} (Not all symbols may be reported){}'.format(os.linesep, archive, os.linesep)
if diff_en: if diff_en:
def _generate_line_tuple(curr, ref, name): def _generate_line_tuple(curr, ref, name):

View File

@@ -413,65 +413,66 @@ Used Flash size : 186524 bytes
.text : 146944 bytes .text : 146944 bytes
.rodata : 39580 bytes .rodata : 39580 bytes
Total image size: 283036 bytes (.bin may be padded larger) Total image size: 283036 bytes (.bin may be padded larger)
Symbols within the archive: libdriver.a (Not all symbols may be reported) Symbols within the archive: libdriver.a (Not all symbols may be reported)
.dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .dram0.bss
p_uart_obj 12 0 +12 p_uart_obj : 12
s_rtc_isr_handle 4 0 +4 s_rtc_isr_handle : 4
s_rtc_isr_handler_list 4 0 +4 s_rtc_isr_handler_list : 4
Section total: 20 0 +20 Section total: 20
.dram0.data <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .dram0.data
periph_spinlock 8 0 +8 timer_spinlock : 16
s_rtc_isr_handler_list_lock 8 0 +8 periph_spinlock : 8
timer_spinlock 16 0 +16 s_rtc_isr_handler_list_lock : 8
uart_selectlock 8 0 +8 uart_selectlock : 8
Section total: 40 0 +40 Section total: 40
.flash.rodata <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .flash.rodata
TG 8 0 +8 str1.4 : 249
__FUNCTION__$5441 24 0 +24 get_clk_en_mask : 128
get_clk_en_mask 128 0 +128 get_rst_en_mask : 128
get_rst_en_mask 128 0 +128 __FUNCTION__$5441 : 24
str1.4 249 0 +249 TG : 8
Section total: 537 0 +537 Section total: 537
.flash.text <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .flash.text
get_clk_en_mask 211 0 +211 get_clk_en_mask : 211
get_clk_en_reg 21 0 +21 get_rst_en_mask : 157
get_rst_en_mask 157 0 +157 timer_group_intr_enable : 112
get_rst_en_reg 25 0 +25 rtc_isr : 86
is_wifi_clk_peripheral 28 0 +28 periph_module_enable : 78
periph_module_enable 78 0 +78 rtc_isr_ensure_installed : 75
rtc_gpio_force_hold_dis_all 65 0 +65 rtc_gpio_force_hold_dis_all : 65
rtc_isr 86 0 +86 rtc_isr_register : 65
rtc_isr_ensure_installed 75 0 +75 is_wifi_clk_peripheral : 28
rtc_isr_register 65 0 +65 uart_set_select_notif_callback : 26
timer_group_intr_enable 112 0 +112 get_rst_en_reg : 25
uart_get_selectlock 12 0 +12 get_clk_en_reg : 21
uart_set_select_notif_callback 26 0 +26 uart_get_selectlock : 12
Section total: 961 0 +961 Section total: 961
.iram0.text <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .iram0.text
Section total: 0 0 Section total: 0
.iram0.vectors <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .iram0.vectors
Section total: 0 0 Section total: 0
.noinit <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .noinit
Section total: 0 0 Section total: 0
.rtc.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .rtc.bss
Section total: 0 0 Section total: 0
.rtc.data <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .rtc.data
Section total: 0 0 Section total: 0
.rtc.text <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .rtc.text
Section total: 0 0 Section total: 0
.rtc_noinit <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .rtc_noinit
Section total: 0 0 Section total: 0
*** ***
Running idf_size.py diff with bootloader... Running idf_size.py diff with bootloader...
@@ -2520,6 +2521,7 @@ Used Flash size : 186524 bytes 0
.text : 146944 bytes 0 +146944 .text : 146944 bytes 0 +146944
.rodata : 39580 bytes 0 +39580 .rodata : 39580 bytes 0 +39580
Total image size: 283036 bytes (.bin may be padded larger) 51920 +231116 Total image size: 283036 bytes (.bin may be padded larger) 51920 +231116
Symbols within the archive: libdriver.a (Not all symbols may be reported) Symbols within the archive: libdriver.a (Not all symbols may be reported)
.dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> .dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE>
@@ -2612,6 +2614,7 @@ Used Flash size : 186524 bytes 0
.text : 146944 bytes 0 +146944 .text : 146944 bytes 0 +146944
.rodata : 39580 bytes 0 +39580 .rodata : 39580 bytes 0 +39580
Total image size: 283036 bytes (.bin may be padded larger) 51920 +231116 Total image size: 283036 bytes (.bin may be padded larger) 51920 +231116
Symbols within the archive: libc.a (Not all symbols may be reported) Symbols within the archive: libc.a (Not all symbols may be reported)
.dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> .dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE>
@@ -2681,6 +2684,7 @@ Used Flash size : 186524 bytes 186524
.text : 146944 bytes 146944 .text : 146944 bytes 146944
.rodata : 39580 bytes 39580 .rodata : 39580 bytes 39580
Total image size: 283036 bytes (.bin may be padded larger) 283036 Total image size: 283036 bytes (.bin may be padded larger) 283036
Symbols within the archive: libdriver.a (Not all symbols may be reported) Symbols within the archive: libdriver.a (Not all symbols may be reported)
.dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> .dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE>
@@ -2762,6 +2766,7 @@ Used Flash size : 186524 bytes 99551
.text : 146944 bytes 77191 +69753 .text : 146944 bytes 77191 +69753
.rodata : 39580 bytes 22360 +17220 .rodata : 39580 bytes 22360 +17220
Total image size: 283036 bytes (.bin may be padded larger) 194629 +88407 Total image size: 283036 bytes (.bin may be padded larger) 194629 +88407
Symbols within the archive: libdriver.a (Not all symbols may be reported) Symbols within the archive: libdriver.a (Not all symbols may be reported)
.dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> .dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE>
@@ -2911,6 +2916,7 @@ Used Flash size : 99551 bytes 186524
.text : 77191 bytes 146944 -69753 .text : 77191 bytes 146944 -69753
.rodata : 22360 bytes 39580 -17220 .rodata : 22360 bytes 39580 -17220
Total image size: 194629 bytes (.bin may be padded larger) 283036 -88407 Total image size: 194629 bytes (.bin may be padded larger) 283036 -88407
Symbols within the archive: libdriver.a (Not all symbols may be reported) Symbols within the archive: libdriver.a (Not all symbols may be reported)
.dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> .dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE>
@@ -3060,6 +3066,7 @@ Used Flash size : 186524 bytes 99551
.text : 146944 bytes 77191 +69753 .text : 146944 bytes 77191 +69753
.rodata : 39580 bytes 22360 +17220 .rodata : 39580 bytes 22360 +17220
Total image size: 283036 bytes (.bin may be padded larger) 194629 +88407 Total image size: 283036 bytes (.bin may be padded larger) 194629 +88407
Symbols within the archive: libfreertos.a (Not all symbols may be reported) Symbols within the archive: libfreertos.a (Not all symbols may be reported)
.dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> .dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE>
@@ -3673,105 +3680,106 @@ Used Flash size : 93019 bytes
.text : 74439 bytes .text : 74439 bytes
.rodata : 18580 bytes .rodata : 18580 bytes
Total image size: 134106 bytes (.bin may be padded larger) Total image size: 134106 bytes (.bin may be padded larger)
Symbols within the archive: libdriver.a (Not all symbols may be reported) Symbols within the archive: libdriver.a (Not all symbols may be reported)
.dram0.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .dram0.bss
p_timer_obj 16 0 +16 p_timer_obj : 16
p_uart_obj 8 0 +8 p_uart_obj : 8
s_rtc_isr_handle 4 0 +4 s_rtc_isr_handle : 4
s_rtc_isr_handler_list 4 0 +4 s_rtc_isr_handler_list : 4
Section total: 32 0 +32 Section total: 32
.dram0.data <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .dram0.data
periph_spinlock 8 0 +8 uart_context : 32
rtc_spinlock 8 0 +8 timer_spinlock : 16
s_rtc_isr_handler_list_lock 8 0 +8 periph_spinlock : 8
timer_spinlock 16 0 +16 rtc_spinlock : 8
uart_context 32 0 +32 s_rtc_isr_handler_list_lock : 8
uart_selectlock 8 0 +8 uart_selectlock : 8
Section total: 80 0 +80 Section total: 80
.flash.rodata <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .flash.rodata
__FUNCTION__$5699 24 0 +24 timer_get_counter_value.str1.4 : 146
__FUNCTION__$6896 21 0 +21 get_clk_en_mask : 136
__FUNCTION__$6901 21 0 +21 get_rst_en_mask : 136
__FUNCTION__$6906 19 0 +19 uart_pattern_enqueue.str1.4 : 88
__FUNCTION__$6911 19 0 +19 uart_flush_input.str1.4 : 45
__FUNCTION__$6916 16 0 +16 uart_set_word_length.str1.4 : 31
__FUNCTION__$6921 16 0 +16 __FUNCTION__$7196 : 27
__FUNCTION__$6926 18 0 +18 __FUNCTION__$5699 : 24
__FUNCTION__$6932 18 0 +18 __FUNCTION__$6971 : 23
__FUNCTION__$6966 22 0 +22 __FUNCTION__$6966 : 22
__FUNCTION__$6971 23 0 +23 __FUNCTION__$6896 : 21
__FUNCTION__$7131 18 0 +18 __FUNCTION__$6901 : 21
__FUNCTION__$7196 27 0 +27 __FUNCTION__$6906 : 19
__FUNCTION__$7202 17 0 +17 __FUNCTION__$6911 : 19
get_clk_en_mask 136 0 +136 __FUNCTION__$6926 : 18
get_rst_en_mask 136 0 +136 __FUNCTION__$6932 : 18
timer_get_counter_value.str1.4 146 0 +146 __FUNCTION__$7131 : 18
uart_flush_input.str1.4 45 0 +45 uart_pattern_pop_pos.str1.4 : 18
uart_pattern_enqueue.str1.4 88 0 +88 __FUNCTION__$7202 : 17
uart_pattern_pop_pos.str1.4 18 0 +18 __FUNCTION__$6916 : 16
uart_set_stop_bits.str1.4 15 0 +15 __FUNCTION__$6921 : 16
uart_set_word_length.str1.4 31 0 +31 uart_set_stop_bits.str1.4 : 15
Section total: 894 0 +894 Section total: 894
.flash.text <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .flash.text
get_clk_en_mask 267 0 +267 uart_flush_input : 453
get_clk_en_reg 21 0 +21 uart_wait_tx_done : 417
get_rst_en_mask 198 0 +198 get_clk_en_mask : 267
get_rst_en_reg 25 0 +25 get_rst_en_mask : 198
is_wifi_clk_peripheral 38 0 +38 timer_group_intr_enable : 184
periph_module_enable 112 0 +112 uart_set_word_length : 144
rtc_gpio_force_hold_dis_all 53 0 +53 uart_set_stop_bits : 128
rtc_isr 90 0 +90 periph_module_enable : 112
rtc_isr_ensure_installed 79 0 +79 uart_get_bufferedlen : 109
rtc_isr_register 62 0 +62 uart_enable_intr_mask : 98
timer_group_intr_enable 184 0 +184 uart_disable_intr_mask : 96
uart_disable_intr_mask 96 0 +96 uart_set_baudrate : 96
uart_disable_rx_intr 18 0 +18 rtc_isr : 90
uart_enable_intr_mask 98 0 +98 uart_get_baudrate : 82
uart_enable_rx_intr 18 0 +18 uart_set_parity : 82
uart_flush_input 453 0 +453 rtc_isr_ensure_installed : 79
uart_get_baudrate 82 0 +82 uart_pattern_queue_update : 74
uart_get_bufferedlen 109 0 +109 uart_get_parity : 69
uart_get_parity 69 0 +69 uart_get_stop_bits : 69
uart_get_selectlock 12 0 +12 uart_get_word_length : 69
uart_get_stop_bits 69 0 +69 rtc_isr_register : 62
uart_get_word_length 69 0 +69 rtc_gpio_force_hold_dis_all : 53
uart_is_driver_installed 30 0 +30 is_wifi_clk_peripheral : 38
uart_pattern_queue_update 74 0 +74 uart_is_driver_installed : 30
uart_set_baudrate 96 0 +96 get_rst_en_reg : 25
uart_set_parity 82 0 +82 uart_set_select_notif_callback : 23
uart_set_select_notif_callback 23 0 +23 get_clk_en_reg : 21
uart_set_stop_bits 128 0 +128 uart_disable_rx_intr : 18
uart_set_word_length 144 0 +144 uart_enable_rx_intr : 18
uart_wait_tx_done 417 0 +417 uart_get_selectlock : 12
Section total: 3216 0 +3216 Section total: 3216
.iram0.text <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .iram0.text
Section total: 0 0 Section total: 0
.iram0.text_end <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .iram0.text_end
Section total: 0 0 Section total: 0
.iram0.vectors <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .iram0.vectors
Section total: 0 0 Section total: 0
.noinit <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .noinit
Section total: 0 0 Section total: 0
.rtc.bss <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .rtc.bss
Section total: 0 0 Section total: 0
.rtc.data <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .rtc.data
Section total: 0 0 Section total: 0
.rtc.text <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .rtc.text
Section total: 0 0 Section total: 0
.rtc_noinit <CURRENT> <REFERENCE> <CURRENT> - <REFERENCE> Symbols from section: .rtc_noinit
Section total: 0 0 Section total: 0
*** ***
Running idf_size.py diff with another app (different target)... Running idf_size.py diff with another app (different target)...
@@ -5532,91 +5540,46 @@ Producing JSON output...
} }
} }
{ {
"current": { ".dram0.bss": {
".dram0.bss": { "p_uart_obj": 12,
"p_uart_obj": 12, "s_rtc_isr_handle": 4,
"s_rtc_isr_handle": 4, "s_rtc_isr_handler_list": 4
"s_rtc_isr_handler_list": 4
},
".dram0.data": {
"timer_spinlock": 16,
"periph_spinlock": 8,
"s_rtc_isr_handler_list_lock": 8,
"uart_selectlock": 8
},
".flash.rodata": {
"str1.4": 249,
"get_clk_en_mask": 128,
"get_rst_en_mask": 128,
"__FUNCTION__$5441": 24,
"TG": 8
},
".flash.text": {
"get_clk_en_mask": 211,
"get_rst_en_mask": 157,
"timer_group_intr_enable": 112,
"rtc_isr": 86,
"periph_module_enable": 78,
"rtc_isr_ensure_installed": 75,
"rtc_gpio_force_hold_dis_all": 65,
"rtc_isr_register": 65,
"is_wifi_clk_peripheral": 28,
"uart_set_select_notif_callback": 26,
"get_rst_en_reg": 25,
"get_clk_en_reg": 21,
"uart_get_selectlock": 12
},
".iram0.text": {},
".iram0.vectors": {},
".noinit": {},
".rtc.bss": {},
".rtc.data": {},
".rtc.text": {},
".rtc_noinit": {}
}, },
"reference": {}, ".dram0.data": {
"diff": { "timer_spinlock": 16,
".dram0.bss": { "periph_spinlock": 8,
"p_uart_obj": 12, "s_rtc_isr_handler_list_lock": 8,
"s_rtc_isr_handle": 4, "uart_selectlock": 8
"s_rtc_isr_handler_list": 4 },
}, ".flash.rodata": {
".dram0.data": { "str1.4": 249,
"periph_spinlock": 8, "get_clk_en_mask": 128,
"s_rtc_isr_handler_list_lock": 8, "get_rst_en_mask": 128,
"timer_spinlock": 16, "__FUNCTION__$5441": 24,
"uart_selectlock": 8 "TG": 8
}, },
".flash.rodata": { ".flash.text": {
"TG": 8, "get_clk_en_mask": 211,
"__FUNCTION__$5441": 24, "get_rst_en_mask": 157,
"get_clk_en_mask": 128, "timer_group_intr_enable": 112,
"get_rst_en_mask": 128, "rtc_isr": 86,
"str1.4": 249 "periph_module_enable": 78,
}, "rtc_isr_ensure_installed": 75,
".flash.text": { "rtc_gpio_force_hold_dis_all": 65,
"get_clk_en_mask": 211, "rtc_isr_register": 65,
"get_clk_en_reg": 21, "is_wifi_clk_peripheral": 28,
"get_rst_en_mask": 157, "uart_set_select_notif_callback": 26,
"get_rst_en_reg": 25, "get_rst_en_reg": 25,
"is_wifi_clk_peripheral": 28, "get_clk_en_reg": 21,
"periph_module_enable": 78, "uart_get_selectlock": 12
"rtc_gpio_force_hold_dis_all": 65, },
"rtc_isr": 86, ".iram0.text": {},
"rtc_isr_ensure_installed": 75, ".iram0.vectors": {},
"rtc_isr_register": 65, ".noinit": {},
"timer_group_intr_enable": 112, ".rtc.bss": {},
"uart_get_selectlock": 12, ".rtc.data": {},
"uart_set_select_notif_callback": 26 ".rtc.text": {},
}, ".rtc_noinit": {}
".iram0.text": {},
".iram0.vectors": {},
".noinit": {},
".rtc.bss": {},
".rtc.data": {},
".rtc.text": {},
".rtc_noinit": {}
}
} }
{ {
"current": { "current": {