Add platformio support for stm32 (#8246)
[2.0] Add platformio support for stm32
This commit is contained in:
parent
6718579ccf
commit
83555933aa
4 changed files with 79 additions and 1 deletions
|
@ -45,7 +45,7 @@
|
|||
#define CPU_32_BIT
|
||||
#include "math_32bit.h"
|
||||
#include "HAL_LPC1768/HAL.h"
|
||||
#elif defined(__STM32F1__)
|
||||
#elif defined(__STM32F1__) || defined(TARGET_STM32F1)
|
||||
#define CPU_32_BIT
|
||||
#include "math_32bit.h"
|
||||
#include "HAL_STM32F1/HAL_Stm32f1.h"
|
||||
|
|
|
@ -42,11 +42,25 @@
|
|||
|
||||
#include "Arduino.h"
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Undefine DEBUG_ settings
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
||||
#undef DEBUG_NONE
|
||||
#undef DEBUG_FAULT
|
||||
#undef DEBUG_ALL
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Includes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include "fastio_Stm32f1.h"
|
||||
#include "watchdog_Stm32f1.h"
|
||||
|
||||
#include "HAL_timers_Stm32f1.h"
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Defines
|
||||
// --------------------------------------------------------------------------
|
||||
|
|
55
Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py
Normal file
55
Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py
Normal file
|
@ -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",
|
||||
],
|
||||
)
|
|
@ -182,3 +182,12 @@ debug_server =
|
|||
-speed
|
||||
auto
|
||||
-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}
|
||||
|
||||
|
|
Reference in a new issue