Browse Source

🐛 Fix Lerdge build / encrypt (#24391)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Bob Kuhn 2 years ago
parent
commit
12a869e2ad

+ 5
- 5
buildroot/share/PlatformIO/scripts/lerdge.py View File

@@ -26,10 +26,10 @@ if pioutil.is_pio_build():
26 26
 			input_file[i] = encryptByte(input_file[i])
27 27
 		output_file.write(input_file)
28 28
 
29
-	# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt
29
+	# Encrypt ${PROGNAME}.bin and save it with the name given in build.crypt_lerdge
30 30
 	def encrypt(source, target, env):
31 31
 		fwpath = target[0].path
32
-		enname = board.get("build.encrypt")
32
+		enname = board.get("build.crypt_lerdge")
33 33
 		print("Encrypting %s to %s" % (fwpath, enname))
34 34
 		fwfile = open(fwpath, "rb")
35 35
 		enfile = open(target[0].dir.path + "/" + enname, "wb")
@@ -41,9 +41,9 @@ if pioutil.is_pio_build():
41 41
 		enfile.close()
42 42
 		os.remove(fwpath)
43 43
 
44
-	if 'encrypt' in board.get("build").keys():
45
-		if board.get("build.encrypt") != "":
44
+	if 'crypt_lerdge' in board.get("build").keys():
45
+		if board.get("build.crypt_lerdge") != "":
46 46
 			marlin.add_post_action(encrypt)
47 47
 	else:
48
-		print("LERDGE builds require output file via board_build.encrypt = 'filename' parameter")
48
+		print("LERDGE builds require output file via board_build.crypt_lerdge = 'filename' parameter")
49 49
 		exit(1)

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

@@ -41,8 +41,8 @@ def custom_ld_script(ldname):
41 41
 		elif flag == "-T":
42 42
 			env["LINKFLAGS"][i + 1] = apath
43 43
 
44
-# Encrypt ${PROGNAME}.bin and save it with a new name
45
-# Called by specific encrypt() functions, mostly for MKS boards
44
+# Encrypt ${PROGNAME}.bin and save it with a new name. This applies (mostly) to MKS boards
45
+# This PostAction is set up by offset_and_rename.py for envs with 'build.encrypt_mks'.
46 46
 def encrypt_mks(source, target, env, new_name):
47 47
 	import sys
48 48
 

+ 5
- 5
buildroot/share/PlatformIO/scripts/offset_and_rename.py View File

@@ -39,15 +39,15 @@ if pioutil.is_pio_build():
39 39
 				env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40)
40 40
 
41 41
 	#
42
-	# For build.encrypt rename and encode the firmware file.
42
+	# For build.encrypt_mks rename and encode the firmware file.
43 43
 	#
44
-	if 'encrypt' in board_keys:
44
+	if 'encrypt_mks' in board_keys:
45 45
 
46
-		# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt
46
+		# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt_mks
47 47
 		def encrypt(source, target, env):
48
-			marlin.encrypt_mks(source, target, env, board.get("build.encrypt"))
48
+			marlin.encrypt_mks(source, target, env, board.get("build.encrypt_mks"))
49 49
 
50
-		if board.get("build.encrypt") != "":
50
+		if board.get("build.encrypt_mks") != "":
51 51
 			marlin.add_post_action(encrypt)
52 52
 
53 53
 	#

+ 18
- 18
ini/stm32f1.ini View File

@@ -89,22 +89,22 @@ board_upload.offset_address = 0x08005000
89 89
 # Uses HAL STM32 to support Marlin UI for TFT screen with optional touch panel
90 90
 #
91 91
 [env:mks_robin]
92
-extends              = stm32_variant
93
-board                = genericSTM32F103ZE
94
-board_build.variant  = MARLIN_F103Zx
95
-board_build.encrypt  = Robin.bin
96
-board_build.offset   = 0x7000
97
-build_flags          = ${stm32_variant.build_flags}
98
-                       -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
99
-build_unflags        = ${stm32_variant.build_unflags}
100
-                       -DUSBCON -DUSBD_USE_CDC
92
+extends                 = stm32_variant
93
+board                   = genericSTM32F103ZE
94
+board_build.variant     = MARLIN_F103Zx
95
+board_build.encrypt_mks = Robin.bin
96
+board_build.offset      = 0x7000
97
+build_flags             = ${stm32_variant.build_flags}
98
+                          -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
99
+build_unflags           = ${stm32_variant.build_unflags}
100
+                          -DUSBCON -DUSBD_USE_CDC
101 101
 
102 102
 #
103 103
 # MKS Robin E3/E3D (STM32F103RCT6) with TMC2209
104 104
 #
105 105
 [env:mks_robin_e3]
106 106
 extends                     = common_STM32F103RC_variant
107
-board_build.encrypt         = Robin_e3.bin
107
+board_build.encrypt_mks     = Robin_e3.bin
108 108
 board_build.offset          = 0x5000
109 109
 board_upload.offset_address = 0x08005000
110 110
 build_flags                 = ${common_STM32F103RC_variant.build_flags}
@@ -206,7 +206,7 @@ build_unflags     = ${stm32_variant.build_unflags} -DUSBD_USE_CDC
206 206
 extends                     = stm32_variant
207 207
 board                       = genericSTM32F103VE
208 208
 board_build.variant         = MARLIN_F103Vx
209
-board_build.encrypt         = Robin_mini.bin
209
+board_build.encrypt_mks     = Robin_mini.bin
210 210
 board_build.offset          = 0x7000
211 211
 board_upload.offset_address = 0x08007000
212 212
 build_flags                 = ${stm32_variant.build_flags}
@@ -222,7 +222,7 @@ build_unflags               = ${stm32_variant.build_unflags}
222 222
 extends                     = stm32_variant
223 223
 board                       = genericSTM32F103VE
224 224
 board_build.variant         = MARLIN_F103Vx
225
-board_build.encrypt         = Robin_nano35.bin
225
+board_build.encrypt_mks     = Robin_nano35.bin
226 226
 board_build.offset          = 0x7000
227 227
 board_upload.offset_address = 0x08007000
228 228
 build_flags                 = ${stm32_variant.build_flags}
@@ -275,7 +275,7 @@ build_flags                 = ${stm32_variant.build_flags} -DSS_TIMER=4
275 275
 extends                     = stm32_variant
276 276
 board                       = genericSTM32F103VE
277 277
 board_build.variant         = MARLIN_F103Vx
278
-board_build.encrypt         = Robin_mini.bin
278
+board_build.encrypt_mks     = Robin_mini.bin
279 279
 board_build.offset          = 0x7000
280 280
 board_upload.offset_address = 0x08007000
281 281
 build_flags                 = ${stm32_variant.build_flags}
@@ -288,7 +288,7 @@ build_flags                 = ${stm32_variant.build_flags}
288 288
 extends                     = stm32_variant
289 289
 board                       = genericSTM32F103RC
290 290
 board_build.variant         = MARLIN_F103Rx
291
-board_build.encrypt         = mksLite.bin
291
+board_build.encrypt_mks     = mksLite.bin
292 292
 board_build.offset          = 0x5000
293 293
 board_upload.offset_address = 0x08005000
294 294
 
@@ -297,14 +297,14 @@ board_upload.offset_address = 0x08005000
297 297
 #
298 298
 [env:mks_robin_lite3]
299 299
 extends                     = env:mks_robin_lite
300
-board_build.encrypt         = mksLite3.bin
300
+board_build.encrypt_mks     = mksLite3.bin
301 301
 
302 302
 #
303 303
 # MKS Robin Pro (STM32F103ZET6)
304 304
 #
305 305
 [env:mks_robin_pro]
306
-extends             = env:mks_robin
307
-board_build.encrypt = Robin_pro.bin
306
+extends                 = env:mks_robin
307
+board_build.encrypt_mks = Robin_pro.bin
308 308
 
309 309
 #
310 310
 # MKS Robin E3p (STM32F103VET6)
@@ -314,7 +314,7 @@ board_build.encrypt = Robin_pro.bin
314 314
 extends                     = stm32_variant
315 315
 board                       = genericSTM32F103VE
316 316
 board_build.variant         = MARLIN_F103Vx
317
-board_build.encrypt         = Robin_e3p.bin
317
+board_build.encrypt_mks     = Robin_e3p.bin
318 318
 board_build.offset          = 0x7000
319 319
 board_upload.offset_address = 0x08007000
320 320
 build_flags                 = ${stm32_variant.build_flags}

+ 40
- 40
ini/stm32f4.ini View File

@@ -113,7 +113,7 @@ extra_scripts     = ${stm32_variant.extra_scripts}
113 113
 extends                     = stm32_variant
114 114
 board                       = marlin_STM32F407VGT6_CCM
115 115
 board_build.variant         = MARLIN_F4x7Vx
116
-board_build.encrypt         = firmware.srec
116
+board_build.encrypt_mks     = firmware.srec
117 117
 board_build.offset          = 0x10000
118 118
 board_upload.offset_address = 0x08010000
119 119
 build_flags                 = ${stm32_variant.build_flags}
@@ -302,24 +302,24 @@ build_flags       = ${stm_flash_drive.build_flags}
302 302
 # Lerdge base
303 303
 #
304 304
 [lerdge_common]
305
-extends             = stm32_variant
306
-board               = marlin_STM32F407ZGT6
307
-board_build.variant = MARLIN_LERDGE
308
-board_build.offset  = 0x10000
309
-build_flags         = ${stm32_variant.build_flags}
310
-                      -DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4
311
-                      -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DLERDGE_TFT35
312
-build_unflags       = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483
313
-extra_scripts       = ${common_stm32.extra_scripts}
314
-                      pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
315
-                      buildroot/share/PlatformIO/scripts/lerdge.py
305
+extends                  = stm32_variant
306
+board                    = marlin_STM32F407ZGT6
307
+board_build.variant      = MARLIN_LERDGE
308
+board_build.crypt_lerdge = firmware.bin
309
+board_build.offset       = 0x10000
310
+build_flags              = ${stm32_variant.build_flags}
311
+                           -DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4
312
+                           -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DLERDGE_TFT35
313
+build_unflags            = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483
314
+extra_scripts            = ${stm32_variant.extra_scripts}
315
+                           buildroot/share/PlatformIO/scripts/lerdge.py
316 316
 
317 317
 #
318 318
 # Lerdge X (STM32F407VE)
319 319
 #
320 320
 [env:LERDGEX]
321
-extends             = lerdge_common
322
-board_build.encrypt = Lerdge_X_firmware_force.bin
321
+extends                  = lerdge_common
322
+board_build.crypt_lerdge = Lerdge_X_firmware_force.bin
323 323
 
324 324
 #
325 325
 # Lerdge X with USB Flash Drive Support
@@ -333,8 +333,8 @@ build_flags       = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags}
333 333
 # Lerdge S (STM32F407ZG)
334 334
 #
335 335
 [env:LERDGES]
336
-extends             = lerdge_common
337
-board_build.encrypt = Lerdge_firmware_force.bin
336
+extends                  = lerdge_common
337
+board_build.crypt_lerdge = Lerdge_firmware_force.bin
338 338
 
339 339
 #
340 340
 # Lerdge S with USB Flash Drive Support
@@ -348,9 +348,9 @@ build_flags       = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags}
348 348
 # Lerdge K (STM32F407ZG)
349 349
 #
350 350
 [env:LERDGEK]
351
-extends             = lerdge_common
352
-board_build.encrypt = Lerdge_K_firmware_force.bin
353
-build_flags         = ${lerdge_common.build_flags} -DLERDGEK
351
+extends                  = lerdge_common
352
+board_build.crypt_lerdge = Lerdge_K_firmware_force.bin
353
+build_flags              = ${lerdge_common.build_flags} -DLERDGEK
354 354
 
355 355
 #
356 356
 # Lerdge K with USB Flash Drive Support
@@ -364,17 +364,17 @@ build_flags       = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags}
364 364
 # RUMBA32
365 365
 #
366 366
 [env:rumba32]
367
-extends              = stm32_variant
368
-board                = rumba32_f446ve
369
-board_build.variant  = MARLIN_F446VE
370
-board_build.offset   = 0x0000
371
-build_flags          = ${stm32_variant.build_flags}
372
-                       -Os -DHAL_PCD_MODULE_ENABLED
373
-                       -DDISABLE_GENERIC_SERIALUSB
374
-                       -DHAL_UART_MODULE_ENABLED
375
-                       -DTIMER_SERIAL=TIM9
376
-monitor_speed        = 500000
377
-upload_protocol      = dfu
367
+extends             = stm32_variant
368
+board               = rumba32_f446ve
369
+board_build.variant = MARLIN_F446VE
370
+board_build.offset  = 0x0000
371
+build_flags         = ${stm32_variant.build_flags}
372
+                      -Os -DHAL_PCD_MODULE_ENABLED
373
+                      -DDISABLE_GENERIC_SERIALUSB
374
+                      -DHAL_UART_MODULE_ENABLED
375
+                      -DTIMER_SERIAL=TIM9
376
+monitor_speed       = 500000
377
+upload_protocol     = dfu
378 378
 
379 379
 #
380 380
 # MKS Robin Pro V2
@@ -547,17 +547,17 @@ build_unflags     = -DUSBD_USE_CDC
547 547
 # TH3D EZBoard v2.0 (STM32F405RGT6 ARM Cortex-M4)
548 548
 #
549 549
 [env:TH3D_EZBoard_V2]
550
-extends             = stm32_variant
551
-board               = genericSTM32F405RG
552
-board_build.variant = MARLIN_TH3D_EZBOARD_V2
553
-board_build.encrypt = firmware.bin
554
-board_build.offset  = 0xC000
550
+extends                     = stm32_variant
551
+board                       = genericSTM32F405RG
552
+board_build.variant         = MARLIN_TH3D_EZBOARD_V2
553
+board_build.encrypt_mks     = firmware.bin
554
+board_build.offset          = 0xC000
555 555
 board_upload.offset_address = 0x0800C000
556
-build_flags         = ${stm32_variant.build_flags} -DHSE_VALUE=12000000U -O0
557
-debug_tool          = stlink
558
-upload_protocol     = stlink
559
-extra_scripts       = ${stm32_variant.extra_scripts}
560
-                      buildroot/share/PlatformIO/scripts/openblt.py
556
+build_flags                 = ${stm32_variant.build_flags} -DHSE_VALUE=12000000U -O0
557
+debug_tool                  = stlink
558
+upload_protocol             = stlink
559
+extra_scripts               = ${stm32_variant.extra_scripts}
560
+                              buildroot/share/PlatformIO/scripts/openblt.py
561 561
 
562 562
 #
563 563
 # BOARD_MKS_ROBIN_NANO_V1_3_F4

Loading…
Cancel
Save