Sync Aceinna and GD32V dev/platforms.

This commit is contained in:
Ivan Kravets
2019-09-13 16:01:42 +03:00
parent e08dc5f0d7
commit 43ae62afd8
3 changed files with 72 additions and 60 deletions

2
docs

Submodule docs updated: ae6b855904...5a1fd4781f

View File

@ -13,16 +13,22 @@
# limitations under the License. # limitations under the License.
import os import os
import urlparse
from os.path import dirname, isdir, isfile, join, realpath from os.path import dirname, isdir, isfile, join, realpath
from sys import exit as sys_exit from sys import exit as sys_exit
from sys import path from sys import path
path.append("..") path.append("..")
import click
from platformio import fs, util from platformio import fs, util
from platformio.managers.platform import PlatformFactory, PlatformManager from platformio.managers.platform import PlatformFactory, PlatformManager
try:
from urlparse import ParseResult, urlparse, urlunparse
except ImportError:
from urllib.parse import ParseResult, urlparse, urlunparse
RST_COPYRIGHT = """.. Copyright (c) 2014-present PlatformIO <contact@platformio.org> RST_COPYRIGHT = """.. Copyright (c) 2014-present PlatformIO <contact@platformio.org>
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -48,14 +54,14 @@ def is_compat_platform_and_framework(platform, framework):
def campaign_url(url, source="platformio", medium="docs"): def campaign_url(url, source="platformio", medium="docs"):
data = urlparse.urlparse(url) data = urlparse(url)
query = data.query query = data.query
if query: if query:
query += "&" query += "&"
query += "utm_source=%s&utm_medium=%s" % (source, medium) query += "utm_source=%s&utm_medium=%s" % (source, medium)
return urlparse.urlunparse( return urlunparse(
urlparse.ParseResult(data.scheme, data.netloc, data.path, data.params, ParseResult(data.scheme, data.netloc, data.path, data.params, query,
query, data.fragment)) data.fragment))
def generate_boards_table(boards, skip_columns=None): def generate_boards_table(boards, skip_columns=None):
@ -64,7 +70,7 @@ def generate_boards_table(boards, skip_columns=None):
("Platform", ":ref:`platform_{platform}`"), ("Platform", ":ref:`platform_{platform}`"),
("Debug", "{debug}"), ("Debug", "{debug}"),
("MCU", "{mcu}"), ("MCU", "{mcu}"),
("Frequency", "{f_cpu:d}MHz"), ("Frequency", "{f_cpu}MHz"),
("Flash", "{rom}"), ("Flash", "{rom}"),
("RAM", "{ram}"), ("RAM", "{ram}"),
] ]
@ -90,15 +96,14 @@ def generate_boards_table(boards, skip_columns=None):
elif data['debug']: elif data['debug']:
debug = "External" debug = "External"
variables = dict( variables = dict(id=data['id'],
id=data['id'], name=data['name'],
name=data['name'], platform=data['platform'],
platform=data['platform'], debug=debug,
debug=debug, mcu=data['mcu'].upper(),
mcu=data['mcu'].upper(), f_cpu=int(data['fcpu'] / 1000000.0),
f_cpu=int(data['fcpu']) / 1000000, ram=fs.format_filesize(data['ram']),
ram=fs.format_filesize(data['ram']), rom=fs.format_filesize(data['rom']))
rom=fs.format_filesize(data['rom']))
for (name, template) in columns: for (name, template) in columns:
if skip_columns and name in skip_columns: if skip_columns and name in skip_columns:
@ -132,8 +137,9 @@ Frameworks
lines.append(""" lines.append("""
* - :ref:`framework_{name}` * - :ref:`framework_{name}`
- {description}""".format(**framework)) - {description}""".format(**framework))
assert known >= set(frameworks), "Unknown frameworks %s " % ( if set(frameworks) - known:
set(frameworks) - known) click.secho("Unknown frameworks %s " % (
set(frameworks) - known), fg="red")
return lines return lines
@ -208,8 +214,8 @@ Boards listed below have on-board debug probe and **ARE READY** for debugging!
You do not need to use/buy external debug probe. You do not need to use/buy external debug probe.
""") """)
lines.extend( lines.extend(
generate_boards_table( generate_boards_table(onboard_debug,
onboard_debug, skip_columns=skip_board_columns)) skip_columns=skip_board_columns))
if external_debug: if external_debug:
lines.append(""" lines.append("""
External Debug Tools External Debug Tools
@ -220,8 +226,8 @@ external debug probe. They **ARE NOT READY** for debugging.
Please click on board name for the further details. Please click on board name for the further details.
""") """)
lines.extend( lines.extend(
generate_boards_table( generate_boards_table(external_debug,
external_debug, skip_columns=skip_board_columns)) skip_columns=skip_board_columns))
return lines return lines
@ -239,13 +245,18 @@ Packages
* - Name * - Name
- Description""") - Description""")
for name in sorted(packagenames): for name in sorted(packagenames):
assert name in API_PACKAGES, name if name not in API_PACKAGES:
lines.append(""" click.secho("Unknown package `%s`" % name, fg="red")
lines.append("""
* - {name}
-
""".format(name=name))
else:
lines.append("""
* - `{name} <{url}>`__ * - `{name} <{url}>`__
- {description}""".format( - {description}""".format(name=name,
name=name, url=campaign_url(API_PACKAGES[name]['url']),
url=campaign_url(API_PACKAGES[name]['url']), description=API_PACKAGES[name]['description']))
description=API_PACKAGES[name]['description']))
if is_embedded: if is_embedded:
lines.append(""" lines.append("""
@ -344,8 +355,9 @@ Examples are listed from `%s development platform repository <%s>`_:
generate_debug_contents( generate_debug_contents(
compatible_boards, compatible_boards,
skip_board_columns=["Platform"], skip_board_columns=["Platform"],
extra_rst="%s_debug.rst" % name if isfile( extra_rst="%s_debug.rst" %
join(rst_dir, "%s_debug.rst" % name)) else None)) name if isfile(join(rst_dir, "%s_debug.rst" %
name)) else None))
# #
# Development version of dev/platform # Development version of dev/platform
@ -483,8 +495,9 @@ For more detailed information please visit `vendor site <%s>`_.
lines.extend( lines.extend(
generate_debug_contents( generate_debug_contents(
compatible_boards, compatible_boards,
extra_rst="%s_debug.rst" % type_ if isfile( extra_rst="%s_debug.rst" %
join(rst_dir, "%s_debug.rst" % type_)) else None)) type_ if isfile(join(rst_dir, "%s_debug.rst" %
type_)) else None))
if compatible_platforms: if compatible_platforms:
# examples # examples
@ -494,11 +507,10 @@ Examples
""") """)
for manifest in compatible_platforms: for manifest in compatible_platforms:
p = PlatformFactory.newPlatform(manifest['name']) p = PlatformFactory.newPlatform(manifest['name'])
lines.append( lines.append("* `%s for %s <%s>`_" %
"* `%s for %s <%s>`_" % (data['title'], manifest['title'],
(data['title'], manifest['title'], campaign_url("%s/tree/master/examples" %
campaign_url( p.repository_url[:-4])))
"%s/tree/master/examples" % p.repository_url[:-4])))
# Platforms # Platforms
lines.extend( lines.extend(
@ -568,7 +580,7 @@ popular embedded boards and IDE.
else: else:
platforms[platform] = [data] platforms[platform] = [data]
for platform, boards in sorted(platforms.iteritems()): for platform, boards in sorted(platforms.items()):
p = PlatformFactory.newPlatform(platform) p = PlatformFactory.newPlatform(platform)
lines.append(p.title) lines.append(p.title)
lines.append("-" * len(p.title)) lines.append("-" * len(p.title))
@ -605,21 +617,20 @@ def update_embedded_board(rst_path, board):
board_manifest_url = board_manifest_url[:-4] board_manifest_url = board_manifest_url[:-4]
board_manifest_url += "/blob/master/boards/%s.json" % board['id'] board_manifest_url += "/blob/master/boards/%s.json" % board['id']
variables = dict( variables = dict(id=board['id'],
id=board['id'], name=board['name'],
name=board['name'], platform=board['platform'],
platform=board['platform'], platform_description=platform.description,
platform_description=platform.description, url=campaign_url(board['url']),
url=campaign_url(board['url']), mcu=board_config.get("build", {}).get("mcu", ""),
mcu=board_config.get("build", {}).get("mcu", ""), mcu_upper=board['mcu'].upper(),
mcu_upper=board['mcu'].upper(), f_cpu=board['fcpu'],
f_cpu=board['fcpu'], f_cpu_mhz=int(int(board['fcpu']) / 1000000),
f_cpu_mhz=int(board['fcpu']) / 1000000, ram=fs.format_filesize(board['ram']),
ram=fs.format_filesize(board['ram']), rom=fs.format_filesize(board['rom']),
rom=fs.format_filesize(board['rom']), vendor=board['vendor'],
vendor=board['vendor'], board_manifest_url=board_manifest_url,
board_manifest_url=board_manifest_url, upload_protocol=board_config.get("upload.protocol", ""))
upload_protocol=board_config.get("upload.protocol", ""))
lines = [RST_COPYRIGHT] lines = [RST_COPYRIGHT]
lines.append(".. _board_{platform}_{id}:".format(**variables)) lines.append(".. _board_{platform}_{id}:".format(**variables))
@ -639,7 +650,7 @@ Platform :ref:`platform_{platform}`: {platform_description}
* - **Microcontroller** * - **Microcontroller**
- {mcu_upper} - {mcu_upper}
* - **Frequency** * - **Frequency**
- {f_cpu_mhz}MHz - {f_cpu_mhz:d}MHz
* - **Flash** * - **Flash**
- {rom} - {rom}
* - **RAM** * - **RAM**
@ -805,15 +816,14 @@ Boards
.. note:: .. note::
For more detailed ``board`` information please scroll tables below by horizontal. For more detailed ``board`` information please scroll tables below by horizontal.
""") """)
for vendor, boards in sorted(vendors.iteritems()): for vendor, boards in sorted(vendors.items()):
lines.append(str(vendor)) lines.append(str(vendor))
lines.append("~" * len(vendor)) lines.append("~" * len(vendor))
lines.extend(generate_boards_table(boards)) lines.extend(generate_boards_table(boards))
# save # save
with open( with open(join(fs.get_source_dir(), "..", "docs", "plus", "debugging.rst"),
join(fs.get_source_dir(), "..", "docs", "plus", "debugging.rst"), "r+") as fp:
"r+") as fp:
content = fp.read() content = fp.read()
fp.seek(0) fp.seek(0)
fp.truncate() fp.truncate()
@ -823,7 +833,9 @@ Boards
# Debug tools # Debug tools
for tool, platforms in tool_to_platforms.items(): for tool, platforms in tool_to_platforms.items():
tool_path = join(DOCS_ROOT_DIR, "plus", "debug-tools", "%s.rst" % tool) tool_path = join(DOCS_ROOT_DIR, "plus", "debug-tools", "%s.rst" % tool)
assert isfile(tool_path), tool if not isfile(tool_path):
click.secho("Unknown debug tool `%s`" % tool, fg="red")
continue
platforms = sorted(set(platforms)) platforms = sorted(set(platforms))
lines = [".. begin_platforms"] lines = [".. begin_platforms"]