My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

common-cxxflags.py 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #
  2. # common-cxxflags.py
  3. # Convenience script to apply customizations to CPP flags
  4. #
  5. import pioutil
  6. if pioutil.is_pio_build():
  7. Import("env")
  8. cxxflags = [
  9. # "-Wno-incompatible-pointer-types",
  10. # "-Wno-unused-const-variable",
  11. # "-Wno-maybe-uninitialized",
  12. # "-Wno-sign-compare"
  13. ]
  14. if "teensy" not in env["PIOENV"]:
  15. cxxflags += ["-Wno-register"]
  16. env.Append(CXXFLAGS=cxxflags)
  17. #
  18. # Add CPU frequency as a compile time constant instead of a runtime variable
  19. #
  20. def add_cpu_freq():
  21. if "BOARD_F_CPU" in env:
  22. env["BUILD_FLAGS"].append("-DBOARD_F_CPU=" + env["BOARD_F_CPU"])
  23. # Useful for JTAG debugging
  24. #
  25. # It will separate release and debug build folders.
  26. # It useful to keep two live versions: a debug version for debugging and another for
  27. # release, for flashing when upload is not done automatically by jlink/stlink.
  28. # Without this, PIO needs to recompile everything twice for any small change.
  29. if env.GetBuildType() == "debug" and env.get("UPLOAD_PROTOCOL") not in ["jlink", "stlink", "custom"]:
  30. env["BUILD_DIR"] = "$PROJECT_BUILD_DIR/$PIOENV/debug"
  31. def on_program_ready(source, target, env):
  32. import shutil
  33. shutil.copy(target[0].get_abspath(), env.subst("$PROJECT_BUILD_DIR/$PIOENV"))
  34. env.AddPostAction("$PROGPATH", on_program_ready)
  35. # On some platform, F_CPU is a runtime variable. Since it's used to convert from ns
  36. # to CPU cycles, this adds overhead preventing small delay (in the order of less than
  37. # 30 cycles) to be generated correctly. By using a compile time constant instead
  38. # the compiler will perform the computation and this overhead will be avoided
  39. add_cpu_freq()