Browse Source

🔨 Clean up build scripts (#22264)

* Add 10K to marlin_blackSTM32F407VET6 (typo?)
* Document custom build scripts.
* Add a Robin common build script.
* Extraneous .ldscript specifiers
Scott Lahteine 3 years ago
parent
commit
b90de62197
No account linked to committer's email address

+ 1
- 1
buildroot/share/PlatformIO/boards/marlin_blackSTM32F407VET6.json View File

48
   "upload": {
48
   "upload": {
49
     "disable_flushing": false,
49
     "disable_flushing": false,
50
     "maximum_ram_size": 131072,
50
     "maximum_ram_size": 131072,
51
-    "maximum_size": 514288,
51
+    "maximum_size": 524288,
52
     "protocol": "stlink",
52
     "protocol": "stlink",
53
     "protocols": [
53
     "protocols": [
54
       "stlink",
54
       "stlink",

+ 3
- 0
buildroot/share/PlatformIO/scripts/custom_board.py View File

1
 #
1
 #
2
 # buildroot/share/PlatformIO/scripts/custom_board.py
2
 # buildroot/share/PlatformIO/scripts/custom_board.py
3
 #
3
 #
4
+# - For build.address replace VECT_TAB_ADDR to relocate the firmware
5
+# - For build.ldscript use one of the linker scripts in buildroot/share/PlatformIO/ldscripts
6
+#
4
 import marlin
7
 import marlin
5
 board = marlin.env.BoardConfig()
8
 board = marlin.env.BoardConfig()
6
 
9
 

+ 0
- 8
buildroot/share/PlatformIO/scripts/marlin.py View File

67
 
67
 
68
 def add_post_action(action):
68
 def add_post_action(action):
69
 	env.AddPostAction(join("$BUILD_DIR", "${PROGNAME}.bin"), action);
69
 	env.AddPostAction(join("$BUILD_DIR", "${PROGNAME}.bin"), action);
70
-
71
-# Apply customizations for a MKS Robin
72
-def prepare_robin(address, ldname, fwname):
73
-	def encrypt(source, target, env):
74
-		encrypt_mks(source, target, env, fwname)
75
-	relocate_firmware(address)
76
-	custom_ld_script(ldname)
77
-	add_post_action(encrypt);

+ 2
- 2
buildroot/share/PlatformIO/scripts/mks_robin.py View File

1
 #
1
 #
2
 # buildroot/share/PlatformIO/scripts/mks_robin.py
2
 # buildroot/share/PlatformIO/scripts/mks_robin.py
3
 #
3
 #
4
-import marlin
5
-marlin.prepare_robin("0x08007000", "mks_robin.ld", "Robin.bin")
4
+import robin
5
+robin.prepare("0x08007000", "mks_robin.ld", "Robin.bin")

+ 2
- 2
buildroot/share/PlatformIO/scripts/mks_robin_e3.py View File

1
 #
1
 #
2
 # buildroot/share/PlatformIO/scripts/mks_robin_e3.py
2
 # buildroot/share/PlatformIO/scripts/mks_robin_e3.py
3
 #
3
 #
4
-import marlin
5
-marlin.prepare_robin("0x08005000", "mks_robin_e3.ld", "Robin_e3.bin")
4
+import robin
5
+robin.prepare("0x08005000", "mks_robin_e3.ld", "Robin_e3.bin")

+ 2
- 2
buildroot/share/PlatformIO/scripts/mks_robin_e3p.py View File

1
 #
1
 #
2
 # buildroot/share/PlatformIO/scripts/mks_robin_e3p.py
2
 # buildroot/share/PlatformIO/scripts/mks_robin_e3p.py
3
 #
3
 #
4
-import marlin
5
-marlin.prepare_robin("0x08007000", "mks_robin_e3p.ld", "Robin_e3p.bin")
4
+import robin
5
+robin.prepare("0x08007000", "mks_robin_e3p.ld", "Robin_e3p.bin")

+ 2
- 2
buildroot/share/PlatformIO/scripts/mks_robin_lite.py View File

1
 #
1
 #
2
 # buildroot/share/PlatformIO/scripts/mks_robin_lite.py
2
 # buildroot/share/PlatformIO/scripts/mks_robin_lite.py
3
 #
3
 #
4
-import marlin
5
-marlin.prepare_robin("0x08005000", "mks_robin_lite.ld", "mksLite.bin")
4
+import robin
5
+robin.prepare("0x08005000", "mks_robin_lite.ld", "mksLite.bin")

+ 2
- 2
buildroot/share/PlatformIO/scripts/mks_robin_lite3.py View File

1
 #
1
 #
2
 # buildroot/share/PlatformIO/scripts/mks_robin_lite3.py
2
 # buildroot/share/PlatformIO/scripts/mks_robin_lite3.py
3
 #
3
 #
4
-import marlin
5
-marlin.prepare_robin("0x08005000", "mks_robin_lite.ld", "mksLite3.bin")
4
+import robin
5
+robin.prepare("0x08005000", "mks_robin_lite.ld", "mksLite3.bin")

+ 2
- 2
buildroot/share/PlatformIO/scripts/mks_robin_mini.py View File

1
 #
1
 #
2
 # buildroot/share/PlatformIO/scripts/mks_robin_mini.py
2
 # buildroot/share/PlatformIO/scripts/mks_robin_mini.py
3
 #
3
 #
4
-import marlin
5
-marlin.prepare_robin("0x08007000", "mks_robin_mini.ld", "Robin_mini.bin")
4
+import robin
5
+robin.prepare("0x08007000", "mks_robin_mini.ld", "Robin_mini.bin")

+ 2
- 2
buildroot/share/PlatformIO/scripts/mks_robin_nano.py View File

1
 #
1
 #
2
 # buildroot/share/PlatformIO/scripts/mks_robin_nano.py
2
 # buildroot/share/PlatformIO/scripts/mks_robin_nano.py
3
 #
3
 #
4
-import marlin
5
-marlin.prepare_robin("0x08007000", "mks_robin_nano.ld", "Robin_nano.bin")
4
+import robin
5
+robin.prepare("0x08007000", "mks_robin_nano.ld", "Robin_nano.bin")

+ 2
- 2
buildroot/share/PlatformIO/scripts/mks_robin_nano35.py View File

1
 #
1
 #
2
 # buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
2
 # buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
3
 #
3
 #
4
-import marlin
5
-marlin.prepare_robin("0x08007000", "mks_robin_nano.ld", "Robin_nano35.bin")
4
+import robin
5
+robin.prepare("0x08007000", "mks_robin_nano.ld", "Robin_nano35.bin")

+ 2
- 2
buildroot/share/PlatformIO/scripts/mks_robin_pro.py View File

1
 #
1
 #
2
 # buildroot/share/PlatformIO/scripts/mks_robin_pro.py
2
 # buildroot/share/PlatformIO/scripts/mks_robin_pro.py
3
 #
3
 #
4
-import marlin
5
-marlin.prepare_robin("0x08007000", "mks_robin_pro.ld", "Robin_pro.bin")
4
+import robin
5
+robin.prepare("0x08007000", "mks_robin_pro.ld", "Robin_pro.bin")

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

1
+#
2
+# buildroot/share/PlatformIO/scripts/robin.py
3
+#
4
+import marlin
5
+
6
+# Apply customizations for a MKS Robin
7
+def prepare(address, ldname, fwname):
8
+	def encrypt(source, target, env):
9
+		marlin.encrypt_mks(source, target, env, fwname)
10
+	marlin.relocate_firmware(address)
11
+	marlin.custom_ld_script(ldname)
12
+	marlin.add_post_action(encrypt);

+ 7
- 0
buildroot/share/PlatformIO/scripts/stm32_bootloader.py View File

1
 #
1
 #
2
 # stm32_bootloader.py
2
 # stm32_bootloader.py
3
 #
3
 #
4
+# - If 'build.offset' is provided, either by JSON or by the environment...
5
+# 	- Set linker flag LD_FLASH_OFFSET and relocate the VTAB based on 'build.offset'.
6
+# 	- Set linker flag LD_MAX_DATA_SIZE based on 'build.maximum_ram_size'.
7
+# 	- Define STM32_FLASH_SIZE from 'upload.maximum_size' for use by Flash-based EEPROM emulation.
8
+#
9
+# - For 'board_build.rename' add a post-action to rename the firmware file.
10
+#
4
 import os,sys,marlin
11
 import os,sys,marlin
5
 Import("env")
12
 Import("env")
6
 
13
 

+ 0
- 7
ini/stm32f1.ini View File

41
 monitor_speed        = 115200
41
 monitor_speed        = 115200
42
 board_build.core     = stm32
42
 board_build.core     = stm32
43
 board_build.variant  = MARLIN_F103Rx
43
 board_build.variant  = MARLIN_F103Rx
44
-board_build.ldscript = ldscript.ld
45
 extra_scripts        = ${common_stm32.extra_scripts}
44
 extra_scripts        = ${common_stm32.extra_scripts}
46
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
45
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
47
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
46
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
108
 board                = genericSTM32F103ZE
107
 board                = genericSTM32F103ZE
109
 board_build.core     = stm32
108
 board_build.core     = stm32
110
 board_build.variant  = MARLIN_F103Zx
109
 board_build.variant  = MARLIN_F103Zx
111
-board_build.ldscript = ldscript.ld
112
 board_build.offset   = 0x7000
110
 board_build.offset   = 0x7000
113
 board_build.encrypt  = Robin.bin
111
 board_build.encrypt  = Robin.bin
114
 build_flags          = ${common_stm32.build_flags}
112
 build_flags          = ${common_stm32.build_flags}
150
 board_build.core     = stm32
148
 board_build.core     = stm32
151
 board_build.variant  = MARLIN_F103Rx
149
 board_build.variant  = MARLIN_F103Rx
152
 board_build.offset   = 0x7000
150
 board_build.offset   = 0x7000
153
-board_build.ldscript = ldscript.ld
154
 board_upload.offset_address = 0x08007000
151
 board_upload.offset_address = 0x08007000
155
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
152
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
156
 extra_scripts        = ${common.extra_scripts}
153
 extra_scripts        = ${common.extra_scripts}
175
 board_build.core     = stm32
172
 board_build.core     = stm32
176
 board_build.variant  = MARLIN_F103Rx
173
 board_build.variant  = MARLIN_F103Rx
177
 board_build.offset   = 0x7000
174
 board_build.offset   = 0x7000
178
-board_build.ldscript = ldscript.ld
179
 board_upload.offset_address = 0x08007000
175
 board_upload.offset_address = 0x08007000
180
 build_unflags        = ${common_stm32.build_unflags}
176
 build_unflags        = ${common_stm32.build_unflags}
181
 extra_scripts        = ${common.extra_scripts}
177
 extra_scripts        = ${common.extra_scripts}
207
 board                = genericSTM32F103VE
203
 board                = genericSTM32F103VE
208
 board_build.core     = stm32
204
 board_build.core     = stm32
209
 board_build.variant  = MARLIN_F103Vx
205
 board_build.variant  = MARLIN_F103Vx
210
-board_build.ldscript = ldscript.ld
211
 board_build.offset   = 0x7000
206
 board_build.offset   = 0x7000
212
 board_build.encrypt  = Robin_mini.bin
207
 board_build.encrypt  = Robin_mini.bin
213
 board_upload.offset_address = 0x08007000
208
 board_upload.offset_address = 0x08007000
227
 board                = genericSTM32F103VE
222
 board                = genericSTM32F103VE
228
 board_build.core     = stm32
223
 board_build.core     = stm32
229
 board_build.variant  = MARLIN_F103Vx
224
 board_build.variant  = MARLIN_F103Vx
230
-board_build.ldscript = ldscript.ld
231
 board_build.offset   = 0x7000
225
 board_build.offset   = 0x7000
232
 board_build.encrypt  = Robin_nano35.bin
226
 board_build.encrypt  = Robin_nano35.bin
233
 board_upload.offset_address = 0x08007000
227
 board_upload.offset_address = 0x08007000
248
 board                = genericSTM32F103ZE
242
 board                = genericSTM32F103ZE
249
 board_build.core     = stm32
243
 board_build.core     = stm32
250
 board_build.variant  = MARLIN_F103Zx
244
 board_build.variant  = MARLIN_F103Zx
251
-board_build.ldscript = ldscript.ld
252
 board_build.offset   = 0x10000
245
 board_build.offset   = 0x10000
253
 build_flags          = ${common_stm32.build_flags} -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
246
 build_flags          = ${common_stm32.build_flags} -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
254
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
247
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC

+ 0
- 5
ini/stm32f4.ini View File

112
 board                = marlin_STM32F407VGT6_CCM
112
 board                = marlin_STM32F407VGT6_CCM
113
 board_build.core     = stm32
113
 board_build.core     = stm32
114
 board_build.variant  = MARLIN_F4x7Vx
114
 board_build.variant  = MARLIN_F4x7Vx
115
-board_build.ldscript = ldscript.ld
116
 board_build.encrypt  = firmware.srec
115
 board_build.encrypt  = firmware.srec
117
 # Just openblt.py (not stm32_bootloader.py) generates the file
116
 # Just openblt.py (not stm32_bootloader.py) generates the file
118
 board_build.offset   = 0x10000
117
 board_build.offset   = 0x10000
222
 board                = marlin_STM32F407VGT6_CCM
221
 board                = marlin_STM32F407VGT6_CCM
223
 board_build.core     = stm32
222
 board_build.core     = stm32
224
 board_build.variant  = MARLIN_F4x7Vx
223
 board_build.variant  = MARLIN_F4x7Vx
225
-board_build.ldscript = ldscript.ld
226
 board_build.offset   = 0x8000
224
 board_build.offset   = 0x8000
227
 board_upload.offset_address = 0x08008000
225
 board_upload.offset_address = 0x08008000
228
 extra_scripts     = ${common.extra_scripts}
226
 extra_scripts     = ${common.extra_scripts}
344
 monitor_speed        = 500000
342
 monitor_speed        = 500000
345
 board_build.core     = stm32
343
 board_build.core     = stm32
346
 board_build.variant  = MARLIN_F446VE
344
 board_build.variant  = MARLIN_F446VE
347
-board_build.ldscript = ldscript.ld
348
 board_build.offset   = 0x0000
345
 board_build.offset   = 0x0000
349
 extra_scripts        = ${common.extra_scripts}
346
 extra_scripts        = ${common.extra_scripts}
350
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
347
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
361
 board                = genericSTM32F407VET6
358
 board                = genericSTM32F407VET6
362
 board_build.core     = stm32
359
 board_build.core     = stm32
363
 board_build.variant  = MARLIN_F4x7Vx
360
 board_build.variant  = MARLIN_F4x7Vx
364
-board_build.ldscript = ldscript.ld
365
 board_build.offset   = 0x0000
361
 board_build.offset   = 0x0000
366
 board_upload.offset_address = 0x08000000
362
 board_upload.offset_address = 0x08000000
367
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
363
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
387
 board                = marlin_STM32F407VGT6_CCM
383
 board                = marlin_STM32F407VGT6_CCM
388
 board_build.core     = stm32
384
 board_build.core     = stm32
389
 board_build.variant  = MARLIN_F4x7Vx
385
 board_build.variant  = MARLIN_F4x7Vx
390
-board_build.ldscript = ldscript.ld
391
 board_build.rename   = Robin_nano_v3.bin
386
 board_build.rename   = Robin_nano_v3.bin
392
 board_build.offset   = 0xC000
387
 board_build.offset   = 0xC000
393
 board_upload.offset_address = 0x0800C000
388
 board_upload.offset_address = 0x0800C000

Loading…
Cancel
Save