STM32F1_build_flags.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env python
  2. #
  3. # STM32F1_build_flags.py
  4. # Add build_flags for the base STM32F1_maple environment (stm32f1-maple.ini)
  5. #
  6. from __future__ import print_function
  7. import sys
  8. # Dynamic build flags for generic compile options
  9. if __name__ == "__main__":
  10. # Print these plus the given args when running directly on the command-line
  11. args = [
  12. "-std=gnu++14",
  13. "-Os",
  14. "-mcpu=cortex-m3",
  15. "-mthumb",
  16. "-fsigned-char",
  17. "-fno-move-loop-invariants",
  18. "-fno-strict-aliasing",
  19. "-fsingle-precision-constant",
  20. "--specs=nano.specs",
  21. "--specs=nosys.specs",
  22. "-MMD", "-MP",
  23. "-IMarlin/src/HAL/STM32F1",
  24. "-DTARGET_STM32F1",
  25. "-DARDUINO_ARCH_STM32",
  26. "-DPLATFORM_M997_SUPPORT"
  27. ] + sys.argv[1:]
  28. print(" ".join(args))
  29. else:
  30. # Extra script for stm32f1-maple.ini build_flags
  31. import pioutil
  32. if pioutil.is_pio_build():
  33. pioutil.env.Append(
  34. ARFLAGS=["rcs"],
  35. ASFLAGS=["-x", "assembler-with-cpp"],
  36. CXXFLAGS=[
  37. "-fabi-version=0",
  38. "-fno-use-cxa-atexit",
  39. "-fno-threadsafe-statics"
  40. ],
  41. LINKFLAGS=[
  42. "-Os",
  43. "-mcpu=cortex-m3",
  44. "-ffreestanding",
  45. "-mthumb",
  46. "--specs=nano.specs",
  47. "--specs=nosys.specs",
  48. "-u_printf_float",
  49. ],
  50. )