Skip to content

Commit

Permalink
Merge branch 'release/v0.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Jul 9, 2023
2 parents 72f5aa3 + d98349c commit d3b1912
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 47 deletions.
2 changes: 1 addition & 1 deletion boards/uno_r4_minima.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"ldscript": "fsp.ld"
},
"extra_flags": [
"-DARDUINO_MINIMA",
"-DARDUINO_UNOR4_MINIMA",
"-DLWIP_DNS=1",
"-DCFG_TUSB_MCU=OPT_MCU_RAXXX"
],
"core": "arduino",
Expand Down
1 change: 1 addition & 0 deletions boards/uno_r4_wifi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"ldscript": "fsp.ld"
},
"extra_flags": [
"-DARDUINO_UNOWIFIR4",
"-DARDUINO_UNOR4_WIFI",
"-DNO_USB",
"-DBACKTRACE_SUPPORT",
Expand Down
46 changes: 32 additions & 14 deletions builder/frameworks/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

from SCons.Script import DefaultEnvironment

from platformio import fs

env = DefaultEnvironment()
platform = env.PioPlatform()
board = env.BoardConfig()
Expand Down Expand Up @@ -56,7 +58,7 @@ def load_flags(filename):
ccflags = cflags.intersection(cxxflags)

env.Append(
ASFLAGS=[f for f in ccflags if isinstance(f, str) and f.startswith("-m")],
ASFLAGS=[f for f in sorted(ccflags) if isinstance(f, str) and f.startswith("-m")],

ASPPFLAGS=["-x", "assembler-with-cpp"],

Expand All @@ -77,7 +79,10 @@ def load_flags(filename):
"-mcpu=%s" % board.get("build.cpu"),
"-mthumb",
"-Wl,--gc-sections",
"--specs=nosys.specs"
"--specs=nano.specs",
"--specs=nosys.specs",
"-nostdlib",
'-Wl,-Map="%s"' % os.path.join("${BUILD_DIR}", "${PROGNAME}.map")
],

LIBSOURCE_DIRS=[os.path.join(FRAMEWORK_DIR, "libraries")],
Expand All @@ -86,12 +91,26 @@ def load_flags(filename):
)

env.Append(
ASFLAGS=[
"-Os",
"-fsigned-char",
"-ffunction-sections",
"-fdata-sections"
],

CFLAGS=[
"-std=gnu11"
],

# Due to long path names "-iprefix" hook is required to avoid toolchain crashes
CCFLAGS=[
"-iprefix" + FRAMEWORK_DIR,
"@%s" % os.path.join(FRAMEWORK_DIR, "variants", board.get(
"build.variant"), "includes.txt"),
"-w"
"-Os",
# Remove the 'to_unix_path' call when PIO Core v6.1.10 is released
"-iprefix" + fs.to_unix_path(FRAMEWORK_DIR),
"@%s" % fs.to_unix_path(os.path.join(FRAMEWORK_DIR, "variants", board.get(
"build.variant"), "includes.txt")),
"-w",
"-fno-builtin"
],

CPPDEFINES=[
Expand All @@ -102,6 +121,13 @@ def load_flags(filename):
("F_CPU", "$BOARD_F_CPU")
],

CXXFLAGS=[
"-std=gnu++17",
"-fno-rtti",
"-fno-exceptions",
"-fno-use-cxa-atexit"
],

CPPPATH=[
os.path.join(FRAMEWORK_DIR, "cores", board.get("build.core"), "tinyusb"),
os.path.join(FRAMEWORK_DIR, "cores", board.get("build.core")),
Expand All @@ -121,14 +147,6 @@ def load_flags(filename):
fpv_version = "5"

env.Append(
ASFLAGS=[
"-mfloat-abi=hard",
"-mfpu=fpv%s-d16" % fpv_version
],
CCFLAGS=[
"-mfloat-abi=hard",
"-mfpu=fpv%s-d16" % fpv_version
],
LINKFLAGS=[
"-mfloat-abi=hard",
"-mfpu=fpv%s-d16" % fpv_version
Expand Down
33 changes: 4 additions & 29 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import sys
from platform import system
from os import makedirs
from os.path import isdir, join
from os.path import basename, isdir, join

from platformio.public import list_serial_ports

Expand Down Expand Up @@ -147,44 +147,19 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621

# default tool for all boards with embedded DFU bootloader over USB
_upload_tool = '"%s"' % join(
platform.get_package_dir("tool-dfuutil") or "", "bin", "dfu-util"
platform.get_package_dir("tool-dfuutil-arduino") or "", "dfu-util"
)
_upload_flags = [
"-d",
",".join(["%s:%s" % (hwid[0], hwid[1]) for hwid in hwids]),
"-a",
"0",
"-s",
"%s:leave" % board.get("upload.offset_address", "0x08000000"),
"-D",
"-Q",
"-D"
]

upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]

if "dfu-util" in _upload_tool:
# Add special DFU header to the binary image
env.AddPostAction(
join("$BUILD_DIR", "${PROGNAME}.bin"),
env.VerboseAction(
" ".join(
[
'"%s"'
% join(
platform.get_package_dir("tool-dfuutil") or "",
"bin",
"dfu-suffix",
),
"-v %s" % vid,
"-p %s" % pid,
"-d 0xffff",
"-a",
"$TARGET",
]
),
"Adding dfu suffix to ${PROGNAME}.bin",
),
)

env.Replace(
UPLOADER=_upload_tool,
UPLOADERFLAGS=_upload_flags,
Expand Down
4 changes: 2 additions & 2 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"type": "git",
"url": "https://github.com/platformio/platform-renesas-ra.git"
},
"version": "0.0.1",
"version": "0.0.2",
"frameworks": {
"arduino": {
"package": "framework-arduinorenesas-uno",
Expand All @@ -46,7 +46,7 @@
"owner": "platformio",
"version": "~1.0.1"
},
"tool-dfuutil": {
"tool-dfuutil-arduino": {
"type": "uploader",
"optional": true,
"owner": "platformio",
Expand Down
2 changes: 1 addition & 1 deletion platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _configure_uploader_packages(package_name, interface_name):
for package, interface in (
("tool-jlink", "jlink"),
("tool-openocd", "cmsis-dap"),
("tool-dfuutil", "dfu"),
("tool-dfuutil-arduino", "dfu"),
("tool-bossac", "sam-ba"),
):
_configure_uploader_packages(package, interface)
Expand Down

0 comments on commit d3b1912

Please sign in to comment.