Browse Source

Allow use of Fysetc SoftwareSerialM (#14893)

Tanguy Pruvot 5 years ago
parent
commit
5d2519ed50

+ 1
- 1
Marlin/src/HAL/HAL_STM32F1/SoftwareSerial.cpp View File

@@ -16,7 +16,7 @@
16 16
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 17
  *
18 18
  */
19
-#ifdef __STM32F1__
19
+#if defined(__STM32F1__) && !defined(HAVE_SW_SERIAL)
20 20
 
21 21
 /**
22 22
  * Empty class for Software Serial implementation (Custom RX/TX pins)

+ 12
- 12
buildroot/share/PlatformIO/scripts/fysetc_STM32F1.py View File

@@ -1,8 +1,7 @@
1 1
 from os.path import join
2
+from os.path import expandvars
2 3
 Import("env", "projenv")
3 4
 
4
-platform = env.PioPlatform()
5
-
6 5
 # Relocate firmware from 0x08000000 to 0x08002000
7 6
 #env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
8 7
 #env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
@@ -10,14 +9,11 @@ platform = env.PioPlatform()
10 9
 
11 10
 # Custom HEX from ELF
12 11
 env.AddPostAction(
13
-	"$BUILD_DIR/${PROGNAME}.elf",
12
+	join("$BUILD_DIR","${PROGNAME}.elf"),
14 13
 	env.VerboseAction(" ".join([
15
-				"$OBJCOPY",
16
-				"-O",
17
-				"ihex",
18
-				'"$BUILD_DIR/${PROGNAME}.elf"',
19
-				'"$BUILD_DIR/${PROGNAME}.hex"'
20
-			]), "Building $TARGET"))
14
+		"$OBJCOPY", "-O ihex", "$TARGET", # TARGET=.pio/build/fysetc_STM32F1/firmware.elf
15
+		"'" + join("$BUILD_DIR","${PROGNAME}.hex") + "'", # Note: $BUILD_DIR is a full path
16
+	]), "Building $TARGET"))
21 17
 
22 18
 # please keep $SOURCE variable, it will be replaced with a path to firmware
23 19
 
@@ -28,12 +24,16 @@ env.AddPostAction(
28 24
 #)
29 25
 
30 26
 # In-line command with arguments
27
+UPLOAD_TOOL="stm32flash"
28
+platform = env.PioPlatform()
29
+if platform.get_package_dir("tool-stm32duino") != None:
30
+	UPLOAD_TOOL=expandvars("'" + join(platform.get_package_dir("tool-stm32duino"),"stm32flash","stm32flash") + "'")
31
+
31 32
 env.Replace(
32
-	UPLOADER=platform.get_package_dir("tool-stm32duino") + '/stm32flash/stm32flash',
33
-	UPLOADCMD='"${UPLOADER}" -v -i rts,-dtr,dtr,-rts -R -b 115200 -g 0x8000000 -w "${BUILD_DIR}/${PROGNAME}.hex" ${UPLOAD_PORT}'
33
+	UPLOADER=UPLOAD_TOOL,
34
+	UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr $UPLOAD_PORT -R -w '" + join("$BUILD_DIR","${PROGNAME}.hex") + "'")
34 35
 )
35 36
 
36
-
37 37
 # Python callback
38 38
 #def on_upload(source, target, env):
39 39
 #    print source, target

+ 1
- 2
platformio.ini View File

@@ -280,11 +280,10 @@ monitor_speed = 250000
280 280
 platform      = ststm32
281 281
 framework     = arduino
282 282
 board         = genericSTM32F103RC
283
-#board_build.core = maple
284 283
 extra_scripts = buildroot/share/PlatformIO/scripts/fysetc_STM32F1.py
285 284
 build_flags   = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py
286 285
   ${common.build_flags} -std=gnu++14
287
-  -DDEBUG_LEVEL=0
286
+  -DDEBUG_LEVEL=0 -DHAVE_SW_SERIAL
288 287
 build_unflags = -std=gnu++11
289 288
 lib_deps      = ${common.lib_deps}
290 289
   SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip

Loading…
Cancel
Save