🔨 Fix a PlatformIO debug issue (#24569)
This commit is contained in:
parent
419a145fa3
commit
857dc73be5
@ -2,6 +2,7 @@
|
|||||||
# common-cxxflags.py
|
# common-cxxflags.py
|
||||||
# Convenience script to apply customizations to CPP flags
|
# Convenience script to apply customizations to CPP flags
|
||||||
#
|
#
|
||||||
|
|
||||||
import pioutil
|
import pioutil
|
||||||
if pioutil.is_pio_build():
|
if pioutil.is_pio_build():
|
||||||
Import("env")
|
Import("env")
|
||||||
@ -12,7 +13,7 @@ if pioutil.is_pio_build():
|
|||||||
# "-Wno-maybe-uninitialized",
|
# "-Wno-maybe-uninitialized",
|
||||||
# "-Wno-sign-compare"
|
# "-Wno-sign-compare"
|
||||||
]
|
]
|
||||||
if "teensy" not in env['PIOENV']:
|
if "teensy" not in env["PIOENV"]:
|
||||||
cxxflags += ["-Wno-register"]
|
cxxflags += ["-Wno-register"]
|
||||||
env.Append(CXXFLAGS=cxxflags)
|
env.Append(CXXFLAGS=cxxflags)
|
||||||
|
|
||||||
@ -20,8 +21,8 @@ if pioutil.is_pio_build():
|
|||||||
# Add CPU frequency as a compile time constant instead of a runtime variable
|
# Add CPU frequency as a compile time constant instead of a runtime variable
|
||||||
#
|
#
|
||||||
def add_cpu_freq():
|
def add_cpu_freq():
|
||||||
if 'BOARD_F_CPU' in env:
|
if "BOARD_F_CPU" in env:
|
||||||
env['BUILD_FLAGS'].append('-DBOARD_F_CPU=' + env['BOARD_F_CPU'])
|
env["BUILD_FLAGS"].append("-DBOARD_F_CPU=" + env["BOARD_F_CPU"])
|
||||||
|
|
||||||
# Useful for JTAG debugging
|
# Useful for JTAG debugging
|
||||||
#
|
#
|
||||||
@ -29,8 +30,14 @@ if pioutil.is_pio_build():
|
|||||||
# It useful to keep two live versions: a debug version for debugging and another for
|
# It useful to keep two live versions: a debug version for debugging and another for
|
||||||
# release, for flashing when upload is not done automatically by jlink/stlink.
|
# release, for flashing when upload is not done automatically by jlink/stlink.
|
||||||
# Without this, PIO needs to recompile everything twice for any small change.
|
# Without this, PIO needs to recompile everything twice for any small change.
|
||||||
if env.GetBuildType() == "debug" and env.get('UPLOAD_PROTOCOL') not in ['jlink', 'stlink', 'custom']:
|
if env.GetBuildType() == "debug" and env.get("UPLOAD_PROTOCOL") not in ["jlink", "stlink", "custom"]:
|
||||||
env['BUILD_DIR'] = '$PROJECT_BUILD_DIR/$PIOENV/debug'
|
env["BUILD_DIR"] = "$PROJECT_BUILD_DIR/$PIOENV/debug"
|
||||||
|
|
||||||
|
def on_program_ready(source, target, env):
|
||||||
|
import shutil
|
||||||
|
shutil.copy(target[0].get_abspath(), env.subst("$PROJECT_BUILD_DIR/$PIOENV"))
|
||||||
|
|
||||||
|
env.AddPostAction("$PROGPATH", on_program_ready)
|
||||||
|
|
||||||
# On some platform, F_CPU is a runtime variable. Since it's used to convert from ns
|
# On some platform, F_CPU is a runtime variable. Since it's used to convert from ns
|
||||||
# to CPU cycles, this adds overhead preventing small delay (in the order of less than
|
# to CPU cycles, this adds overhead preventing small delay (in the order of less than
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# simulator.py
|
# simulator.py
|
||||||
# PlatformIO pre: script for simulator builds
|
# PlatformIO pre: script for simulator builds
|
||||||
#
|
#
|
||||||
|
|
||||||
import pioutil
|
import pioutil
|
||||||
if pioutil.is_pio_build():
|
if pioutil.is_pio_build():
|
||||||
# Get the environment thus far for the build
|
# Get the environment thus far for the build
|
||||||
|
Loading…
Reference in New Issue
Block a user