Teensy development platform for PlatformIO compatible with GCC10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_bare_arm.py 2.2KB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # Copyright 2014-present PlatformIO <contact@platformio.org>
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. #
  15. # Default flags for bare-metal programming (without any framework layers)
  16. #
  17. from SCons.Script import DefaultEnvironment
  18. env = DefaultEnvironment()
  19. env.Append(
  20. ASFLAGS=["-x", "assembler-with-cpp"],
  21. CCFLAGS=[
  22. "-Os", # optimize for size
  23. "-Wall", # show warnings
  24. "-ffunction-sections", # place each function in its own section
  25. "-fdata-sections",
  26. "-mthumb",
  27. "-nostdlib",
  28. "-fsingle-precision-constant"
  29. ],
  30. CXXFLAGS=[
  31. "-fno-exceptions",
  32. "-felide-constructors",
  33. "-fno-rtti",
  34. "-std=gnu++14"
  35. ],
  36. CPPDEFINES=[
  37. ("F_CPU", "$BOARD_F_CPU"),
  38. "LAYOUT_US_ENGLISH"
  39. ],
  40. RANLIBFLAGS=["-s"],
  41. LINKFLAGS=[
  42. "-Os",
  43. "-Wl,--gc-sections,--relax",
  44. "-mthumb",
  45. "-Wl,--defsym=__rtc_localtime=$UNIX_TIME",
  46. "-fsingle-precision-constant"
  47. ],
  48. LIBS=["m", "stdc++"]
  49. )
  50. if env.BoardConfig().id_ in ("teensy35", "teensy36"):
  51. env.Append(
  52. CCFLAGS=[
  53. "-mfloat-abi=hard",
  54. "-mfpu=fpv4-sp-d16"
  55. ],
  56. LINKFLAGS=[
  57. "-mfloat-abi=hard",
  58. "-mfpu=fpv4-sp-d16"
  59. ]
  60. )
  61. if "BOARD" in env:
  62. env.Append(
  63. CCFLAGS=[
  64. "-mcpu=%s" % env.BoardConfig().get("build.cpu")
  65. ],
  66. LINKFLAGS=[
  67. "-mcpu=%s" % env.BoardConfig().get("build.cpu")
  68. ]
  69. )
  70. # copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
  71. env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])