Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 42 additions & 14 deletions tools/platformio-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,51 @@ def scons_patched_match_splitext(path, suffixes=None):


env.Append(
ASFLAGS=["-x", "assembler-with-cpp"],

CFLAGS=[
"-std=gnu99",
"-Wpointer-arith",
"-Wno-implicit-function-declaration",
"-Wl,-EL",
"-fno-inline-functions",
"-nostdlib"
],

CCFLAGS=[
"-Os", # optimize for size
"-mlongcalls",
"-mtext-section-literals",
"-falign-functions=4",
"-U__STRICT_ANSI__",
"-ffunction-sections",
"-fdata-sections",
"-Wall"
],

CXXFLAGS=[
"-fno-rtti",
"-fno-exceptions",
"-std=c++11"
],

LINKFLAGS=[
"-Os",
"-nostdlib",
"-Wl,--no-check-sections",
"-Wl,-static",
"-Wl,--gc-sections",
"-Wl,-wrap,system_restart_local",
"-Wl,-wrap,spi_flash_read",
"-u", "app_entry",
"-u", "_printf_float",
"-u", "_scanf_float"
],

CPPDEFINES=[
("F_CPU", "$BOARD_F_CPU"),
"__ets__",
"ICACHE_FLASH",
("ARDUINO", 10805),
("ARDUINO_BOARD", '\\"PLATFORMIO_%s\\"'
% env.BoardConfig().id.upper()),
Expand Down Expand Up @@ -84,23 +124,11 @@ def scons_patched_match_splitext(path, suffixes=None):

LIBSOURCE_DIRS=[
join(FRAMEWORK_DIR, "libraries")
],

LINKFLAGS=[
"-Wl,-wrap,system_restart_local",
"-Wl,-wrap,spi_flash_read",
"-u", "app_entry"
]
)

# remove LINKFLAGS defined in main.py and keep user custom flags
try:
index = env['LINKFLAGS'].index("call_user_start")
if index > 0 and env['LINKFLAGS'][index - 1] == "-u":
del env['LINKFLAGS'][index - 1]
env['LINKFLAGS'].remove("call_user_start")
except IndexError:
pass
# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])

flatten_cppdefines = env.Flatten(env['CPPDEFINES'])

Expand Down