Skip to content

Commit e9fcdc4

Browse files
Muh print statements!!11!1
1 parent 68c8c3a commit e9fcdc4

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

tools/python/mbed_tools/build/_internal/memory_banks.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def _print_mem_bank_summary(banks_by_type: BanksByType, configured_banks_by_type
130130
:param banks_by_type: Physical memory bank information
131131
:param configured_banks_by_type: Configured memory bank information
132132
"""
133+
print("Summary of available memory banks:")
133134
for bank_type in BANK_TYPES:
134135
banks = banks_by_type[bank_type]
135136

@@ -142,18 +143,30 @@ def _print_mem_bank_summary(banks_by_type: BanksByType, configured_banks_by_type
142143
)
143144
continue
144145

145-
for _bank_index, (bank_name, bank_data) in enumerate(banks.items()):
146+
print(f"Target {bank_type} banks: -----------------------------------------------------------")
147+
148+
for bank_index, (bank_name, bank_data) in enumerate(banks.items()):
146149
bank_size = bank_data["size"]
147150
bank_start = bank_data["start"]
148151

149152
configured_size = configured_banks_by_type[bank_type][bank_name]["size"]
150153
configured_start_addr = configured_banks_by_type[bank_type][bank_name]["start"]
151154

152155
# If the configured sizes are different, add info to the summary
156+
configured_size_str = ""
157+
configured_start_addr_str = ""
153158
if configured_size != bank_size:
154-
f" (configured to {humanize.naturalsize(configured_size, binary=True)})"
159+
configured_size_str = f" (configured to {humanize.naturalsize(configured_size, binary=True)})"
155160
if configured_start_addr != bank_start:
156-
pass
161+
configured_start_addr_str = f" (configured to 0x{configured_start_addr:08x})"
162+
163+
print(
164+
f"{bank_index}. {bank_name}, "
165+
f"start addr 0x{bank_start:08x}{configured_start_addr_str}, "
166+
f"size {humanize.naturalsize(bank_size, binary=True)}{configured_size_str}"
167+
)
168+
169+
print()
157170

158171

159172
def _generate_macros_for_memory_banks(banks_by_type: BanksByType, configured_banks_by_type: BanksByType) -> set[str]:

tools/python/mbed_tools/cli/cmsis_mcu_descr.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from __future__ import annotations
1919

2020
import datetime
21+
import json
2122
import logging
2223
import os
2324
import pathlib
@@ -162,8 +163,12 @@ def find_unused() -> None:
162163
removable_mcus = sorted(available_mcu_names - used_mcu_names)
163164

164165
if len(removable_mcus) == 0:
166+
print("No MCU descriptions can be pruned, all are used.")
165167
return
166168

169+
print("The following MCU descriptions are not used and should be pruned from cmsis_mcu_descriptions.json5")
170+
print("\n".join(removable_mcus))
171+
167172
sys.exit(1)
168173

169174

@@ -181,8 +186,13 @@ def check_missing() -> None:
181186
# Are there any missing?
182187
missing_mcu_names = used_mcu_names - available_mcu_names
183188
if len(missing_mcu_names) == 0:
189+
print("No missing MCUs, no work to do.")
184190
return
185191

192+
print(
193+
"The following MCU descriptions are used by targets.json5 and need to be added to cmsis_mcu_descriptions.json5:"
194+
)
195+
print("\n".join(missing_mcu_names))
186196
sys.exit(1)
187197

188198

@@ -232,4 +242,6 @@ def fetch_missing() -> None:
232242
"just the 'memories' section as 'memory_banks' section from content below.\n"
233243
f"Otherwise add the whole following entries to {CMSIS_MCU_DESCRIPTIONS_JSON_PATH}:"
234244
)
245+
print(json.dumps(missing_mcus_dict, indent=4, sort_keys=True))
246+
235247
sys.exit(1)

0 commit comments

Comments
 (0)