Browse Source

Allow use of Fysetc SoftwareSerialM (#14893)

Tanguy Pruvot 6 years ago
parent
commit
5d2519ed50

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

16
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
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
  * Empty class for Software Serial implementation (Custom RX/TX pins)
22
  * Empty class for Software Serial implementation (Custom RX/TX pins)

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

1
 from os.path import join
1
 from os.path import join
2
+from os.path import expandvars
2
 Import("env", "projenv")
3
 Import("env", "projenv")
3
 
4
 
4
-platform = env.PioPlatform()
5
-
6
 # Relocate firmware from 0x08000000 to 0x08002000
5
 # Relocate firmware from 0x08000000 to 0x08002000
7
 #env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
6
 #env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
8
 #env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
7
 #env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
10
 
9
 
11
 # Custom HEX from ELF
10
 # Custom HEX from ELF
12
 env.AddPostAction(
11
 env.AddPostAction(
13
-	"$BUILD_DIR/${PROGNAME}.elf",
12
+	join("$BUILD_DIR","${PROGNAME}.elf"),
14
 	env.VerboseAction(" ".join([
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
 # please keep $SOURCE variable, it will be replaced with a path to firmware
18
 # please keep $SOURCE variable, it will be replaced with a path to firmware
23
 
19
 
28
 #)
24
 #)
29
 
25
 
30
 # In-line command with arguments
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
 env.Replace(
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
 # Python callback
37
 # Python callback
38
 #def on_upload(source, target, env):
38
 #def on_upload(source, target, env):
39
 #    print source, target
39
 #    print source, target

+ 1
- 2
platformio.ini View File

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

Loading…
Cancel
Save