2019-08-28 01:28:42 +00:00
|
|
|
#
|
|
|
|
# common-cxxflags.py
|
|
|
|
# Convenience script to apply customizations to CPP flags
|
|
|
|
#
|
|
|
|
Import("env")
|
|
|
|
env.Append(CXXFLAGS=[
|
|
|
|
"-Wno-register"
|
|
|
|
#"-Wno-incompatible-pointer-types",
|
|
|
|
#"-Wno-unused-const-variable",
|
|
|
|
#"-Wno-maybe-uninitialized",
|
|
|
|
#"-Wno-sign-compare"
|
|
|
|
])
|
2020-10-31 22:14:10 +00:00
|
|
|
|
2021-02-26 23:59:28 +00:00
|
|
|
#
|
|
|
|
# Add CPU frequency as a compile time constant instead of a runtime variable
|
|
|
|
#
|
|
|
|
def add_cpu_freq():
|
|
|
|
if 'BOARD_F_CPU' in env:
|
|
|
|
env['BUILD_FLAGS'].append('-DBOARD_F_CPU=' + env['BOARD_F_CPU'])
|
|
|
|
|
2020-10-31 22:14:10 +00:00
|
|
|
# Useful for JTAG debugging
|
|
|
|
#
|
2020-11-05 23:16:27 +00:00
|
|
|
# It will separe release and debug build folders.
|
|
|
|
# It useful when we need keep two live versions: one debug, for debugging,
|
2020-10-31 22:14:10 +00:00
|
|
|
# other release, for flashing.
|
|
|
|
# Without this, PIO will recompile everything twice for any small change.
|
2020-11-05 23:16:27 +00:00
|
|
|
#
|
2020-10-31 22:14:10 +00:00
|
|
|
if env.GetBuildType() == "debug":
|
|
|
|
env['BUILD_DIR'] = '$PROJECT_BUILD_DIR/$PIOENV/debug'
|
2021-02-26 23:59:28 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
# 30 cycles) to be generated correctly. By using a compile time constant instead
|
|
|
|
# the compiler will perform the computation and this overhead will be avoided
|
|
|
|
add_cpu_freq()
|