mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Print platform information while processing environment
This commit is contained in:
2
docs
2
docs
Submodule docs updated: 0523223955...b32cd4a5f8
@ -98,29 +98,34 @@ def LoadPioPlatform(env, variables):
|
||||
env.Replace(LDSCRIPT_PATH=board_config.get("build.ldscript"))
|
||||
|
||||
|
||||
def PrintSystemInfo(env):
|
||||
data = []
|
||||
debug_tools = None
|
||||
def PrintConfiguration(env): # pylint: disable=too-many-branches
|
||||
platform_data = ["Platform: %s ::" % env.PioPlatform().title]
|
||||
system_data = ["System:"]
|
||||
mcu = env.subst("$BOARD_MCU")
|
||||
f_cpu = env.subst("$BOARD_F_CPU")
|
||||
if mcu:
|
||||
data.append(mcu.upper())
|
||||
system_data.append(mcu.upper())
|
||||
if f_cpu:
|
||||
f_cpu = int("".join([c for c in str(f_cpu) if c.isdigit()]))
|
||||
data.append("%dMHz" % (f_cpu / 1000000))
|
||||
system_data.append("%dMHz" % (f_cpu / 1000000))
|
||||
|
||||
debug_tools = None
|
||||
if "BOARD" in env:
|
||||
board_config = env.BoardConfig()
|
||||
platform_data.append(board_config.get("name"))
|
||||
|
||||
debug_tools = board_config.get("debug", {}).get("tools")
|
||||
ram = board_config.get("upload", {}).get("maximum_ram_size")
|
||||
flash = board_config.get("upload", {}).get("maximum_size")
|
||||
for (key, value) in (("RAM", ram), ("Flash", flash)):
|
||||
if not value:
|
||||
continue
|
||||
data.append("%s/%s" % (key, util.format_filesize(value)))
|
||||
system_data.append("%s/%s" % (key, util.format_filesize(value)))
|
||||
|
||||
if data:
|
||||
print "System: %s" % " ".join(data)
|
||||
if platform_data:
|
||||
print " ".join(platform_data)
|
||||
if system_data:
|
||||
print " ".join(system_data)
|
||||
|
||||
# Debugging
|
||||
if not debug_tools:
|
||||
@ -151,5 +156,5 @@ def generate(env):
|
||||
env.AddMethod(BoardConfig)
|
||||
env.AddMethod(GetFrameworkScript)
|
||||
env.AddMethod(LoadPioPlatform)
|
||||
env.AddMethod(PrintSystemInfo)
|
||||
env.AddMethod(PrintConfiguration)
|
||||
return env
|
||||
|
@ -42,7 +42,7 @@ def BuildProgram(env):
|
||||
|
||||
_append_pio_macros()
|
||||
|
||||
env.PrintSystemInfo()
|
||||
env.PrintConfiguration()
|
||||
|
||||
# fix ASM handling under non case-sensitive OS
|
||||
if not case_sensitive_suffixes(".s", ".S"):
|
||||
|
@ -755,9 +755,9 @@ def format_filesize(filesize):
|
||||
if filesize >= unit:
|
||||
continue
|
||||
if filesize % (base**(i + 1)):
|
||||
return "%.2f%s" % ((base * filesize / unit), suffix)
|
||||
return "%.2f%sB" % ((base * filesize / unit), suffix)
|
||||
break
|
||||
return "%d%s" % ((base * filesize / unit), suffix)
|
||||
return "%d%sB" % ((base * filesize / unit), suffix)
|
||||
|
||||
|
||||
def rmtree_(path):
|
||||
|
@ -55,7 +55,7 @@ def generate_boards(boards, extend_debug=False, skip_columns=None):
|
||||
("Platform", ":ref:`{platform_title} <platform_{platform}>`"),
|
||||
("Debug", "{debug}"),
|
||||
("MCU", "{mcu}"),
|
||||
("Frequency", "{f_cpu:d} MHz"),
|
||||
("Frequency", "{f_cpu:d}MHz"),
|
||||
("Flash", "{rom}"),
|
||||
("RAM", "{ram}"),
|
||||
]
|
||||
|
Reference in New Issue
Block a user