Skip to content

Commit

Permalink
Update platformio-build.py
Browse files Browse the repository at this point in the history
  • Loading branch information
martinloren committed Nov 26, 2021
1 parent 5e71787 commit e4ef643
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@

env.Append(
ASFLAGS=["-x", "assembler-with-cpp"],
CFLAGS=["-std=gnu11"],
CFLAGS=[
"-std=gnu11",
],
CCFLAGS=[
"-Os", # optimize for speed
"-mcpu=%s" % board_config.get("build.cpu"),
Expand All @@ -50,6 +52,11 @@
"-nostdlib",
"--param",
"max-inline-insns-single=500",
#"-print-multi-lib", #to check library versions
],
CXXFLAGS=[
"-fno-rtti",
"-fno-exceptions",
],
CPPPATH=[
],
Expand All @@ -62,6 +69,16 @@
LIBPATH=[join(CMSIS_DIR, "DSP", "Lib", "GCC")],
)

#Floating point unit: hard (hardware) | softfp (software)
if (
any(cpu in board_config.get("build.cpu") for cpu in ("cortex-m4"))
):
env.Append(
CFLAGS=["-mfpu=fpv4-sp-d16", "-mfloat-abi=hard"],
CCFLAGS=["-mfpu=fpv4-sp-d16", "-mfloat-abi=hard"],
LINKFLAGS=["-mcpu=%s" % board_config.get("build.cpu"), "-mfpu=fpv4-sp-d16", "-mfloat-abi=hard"],
)

# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])

Expand All @@ -70,6 +87,7 @@
#

libs = []

libs.append(
env.BuildLibrary(
join("$BUILD_DIR", "AT32F4xx_StdPeriph"), join(FRAMEWORK_DIR, "libraries", "AT32F4xx_StdPeriph_Driver")
Expand Down

0 comments on commit e4ef643

Please sign in to comment.