Browse Source

Add platformio support for stm32 (#8246)

[2.0] Add platformio support for stm32
pull/1/head
Alexey Shvetsov 7 years ago
committed by Scott Lahteine
parent
commit
83555933aa
  1. 2
      Marlin/src/HAL/HAL.h
  2. 14
      Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h
  3. 55
      Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py
  4. 9
      platformio.ini

2
Marlin/src/HAL/HAL.h

@ -45,7 +45,7 @@
#define CPU_32_BIT #define CPU_32_BIT
#include "math_32bit.h" #include "math_32bit.h"
#include "HAL_LPC1768/HAL.h" #include "HAL_LPC1768/HAL.h"
#elif defined(__STM32F1__) #elif defined(__STM32F1__) || defined(TARGET_STM32F1)
#define CPU_32_BIT #define CPU_32_BIT
#include "math_32bit.h" #include "math_32bit.h"
#include "HAL_STM32F1/HAL_Stm32f1.h" #include "HAL_STM32F1/HAL_Stm32f1.h"

14
Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h

@ -42,11 +42,25 @@
#include "Arduino.h" #include "Arduino.h"
// --------------------------------------------------------------------------
// Undefine DEBUG_ settings
// --------------------------------------------------------------------------
#undef DEBUG_NONE
#undef DEBUG_FAULT
#undef DEBUG_ALL
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "fastio_Stm32f1.h" #include "fastio_Stm32f1.h"
#include "watchdog_Stm32f1.h" #include "watchdog_Stm32f1.h"
#include "HAL_timers_Stm32f1.h" #include "HAL_timers_Stm32f1.h"
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Defines // Defines
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

55
Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py

@ -0,0 +1,55 @@
from __future__ import print_function
import sys
#dynamic build flags for generic compile options
if __name__ == "__main__":
args = " ".join([ "-std=gnu11",
"-std=gnu++11",
"-Os",
"-mcpu=cortex-m3",
"-mthumb",
"-ffreestanding",
"-fsigned-char",
"-fno-move-loop-invariants",
"-fno-strict-aliasing",
"--specs=nano.specs",
"--specs=nosys.specs",
"-IMarlin/src/HAL",
"-MMD",
"-MP",
"-DTARGET_STM32F1"
])
for i in range(1, len(sys.argv)):
args += " " + sys.argv[i]
print(args)
# extra script for linker options
else:
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
env.Append(
ARFLAGS=["rcs"],
ASFLAGS=["-x", "assembler-with-cpp"],
CXXFLAGS=[
"-fabi-version=0",
"-fno-use-cxa-atexit",
"-fno-threadsafe-statics"
],
LINKFLAGS=[
"-Os",
"-mcpu=cortex-m3",
"-ffreestanding",
"-mthumb",
"--specs=nano.specs",
"--specs=nosys.specs",
"-u_printf_float",
],
)

9
platformio.ini

@ -182,3 +182,12 @@ debug_server =
-speed -speed
auto auto
-noir -noir
[env:STM32F1]
platform = ststm32
framework = arduino
board = genericSTM32F103RE
build_flags = !python Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py
lib_deps = ${common.lib_deps}
src_filter = ${common.default_src_filter}

Loading…
Cancel
Save