Kaynağa Gözat

Rename, clean up boards/variants (#21655)

* Consolidate variant scripts
* Rename Marlin-local boards
* Simplify variants where possible
* Rename variants
* CHITU_F103 and MEEB_3DP: Maple platform `platformio-build-stm32f1.py` uses the 'board' name, not 'board_build.variant' so folder names match 'board' and not `board_build.variant`.
Scott Lahteine 3 yıl önce
ebeveyn
işleme
ee016e605c
No account linked to committer's email address
100 değiştirilmiş dosya ile 268 ekleme ve 800 silme
  1. 1
    0
      .github/workflows/test-builds.yml
  2. 0
    65
      buildroot/share/PlatformIO/boards/LERDGE.json
  3. 0
    34
      buildroot/share/PlatformIO/boards/fysetc_f6.json
  4. 1
    1
      buildroot/share/PlatformIO/boards/marlin_BTT_SKR_SE_BX.json
  5. 1
    1
      buildroot/share/PlatformIO/boards/marlin_BigTree_BTT002.json
  6. 1
    1
      buildroot/share/PlatformIO/boards/marlin_BigTree_GTR_v1.json
  7. 1
    1
      buildroot/share/PlatformIO/boards/marlin_BigTree_SKR_Pro.json
  8. 1
    2
      buildroot/share/PlatformIO/boards/marlin_CHITU_F103.json
  9. 1
    1
      buildroot/share/PlatformIO/boards/marlin_FYSETC_CHEETAH_V20.json
  10. 1
    1
      buildroot/share/PlatformIO/boards/marlin_MEEB_3DP.json
  11. 1
    2
      buildroot/share/PlatformIO/boards/marlin_STEVAL_STM32F401VE.json
  12. 0
    0
      buildroot/share/PlatformIO/boards/marlin_STM32F407VGT6_CCM.json
  13. 2
    3
      buildroot/share/PlatformIO/boards/marlin_STM32F407ZGT6.json
  14. 1
    1
      buildroot/share/PlatformIO/boards/marlin_archim.json
  15. 0
    0
      buildroot/share/PlatformIO/boards/marlin_at90usb1286.json
  16. 0
    0
      buildroot/share/PlatformIO/boards/marlin_blackSTM32F407VET6.json
  17. 0
    0
      buildroot/share/PlatformIO/boards/marlin_malyanM200.json
  18. 0
    0
      buildroot/share/PlatformIO/boards/marlin_malyanM200v2.json
  19. 3
    7
      buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py
  20. 0
    23
      buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py
  21. 1
    14
      buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py
  22. 0
    20
      buildroot/share/PlatformIO/scripts/STM32F103RET6_creality.py
  23. 0
    19
      buildroot/share/PlatformIO/scripts/STM32F103RE_SKR_E3_DIP.py
  24. 6
    20
      buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py
  25. 2
    11
      buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py
  26. 0
    13
      buildroot/share/PlatformIO/scripts/STM32F401VE_STEVAL.py
  27. 6
    18
      buildroot/share/PlatformIO/scripts/chitu_crypt.py
  28. 0
    49
      buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py
  29. 13
    0
      buildroot/share/PlatformIO/scripts/custom_board.py
  30. 2
    1
      buildroot/share/PlatformIO/scripts/download_mks_assets.py
  31. 0
    20
      buildroot/share/PlatformIO/scripts/fly_mini.py
  32. 0
    13
      buildroot/share/PlatformIO/scripts/fysetc_cheetah_v20.py
  33. 38
    14
      buildroot/share/PlatformIO/scripts/generic_create_variant.py
  34. 21
    30
      buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py
  35. 10
    14
      buildroot/share/PlatformIO/scripts/lerdge.py
  36. 75
    0
      buildroot/share/PlatformIO/scripts/marlin.py
  37. 20
    24
      buildroot/share/PlatformIO/scripts/mks_encrypt.py
  38. 5
    39
      buildroot/share/PlatformIO/scripts/mks_robin.py
  39. 5
    40
      buildroot/share/PlatformIO/scripts/mks_robin_e3.py
  40. 5
    40
      buildroot/share/PlatformIO/scripts/mks_robin_e3p.py
  41. 5
    40
      buildroot/share/PlatformIO/scripts/mks_robin_lite.py
  42. 5
    40
      buildroot/share/PlatformIO/scripts/mks_robin_lite3.py
  43. 5
    40
      buildroot/share/PlatformIO/scripts/mks_robin_mini.py
  44. 5
    40
      buildroot/share/PlatformIO/scripts/mks_robin_nano.py
  45. 5
    40
      buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
  46. 5
    39
      buildroot/share/PlatformIO/scripts/mks_robin_pro.py
  47. 14
    19
      buildroot/share/PlatformIO/scripts/stm32_bootloader.py
  48. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/.gitignore
  49. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/build_gcc/Makefile
  50. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/build_gcc/debug.mk
  51. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/build_gcc/gcc.mk
  52. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/build_gcc/libvariant_arduino_due_x.mk
  53. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/build_gcc/release.mk
  54. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/debug_scripts/gcc/arduino_due_x_flash.gdb
  55. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/debug_scripts/gcc/arduino_due_x_sram.gdb
  56. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/debug_scripts/iar/arduino_due_flash.mac
  57. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/debug_scripts/iar/arduino_due_sram.mac
  58. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/libsam_sam3x8e_gcc_rel.a
  59. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/libsam_sam3x8e_gcc_rel.a.txt
  60. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/linker_scripts/gcc/flash.ld
  61. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/linker_scripts/gcc/sram.ld
  62. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/linker_scripts/iar/flash.icf
  63. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/linker_scripts/iar/sram.icf
  64. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/pins_arduino.h
  65. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.cpp
  66. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.h
  67. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/PeripheralPins.c
  68. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/PinNamesVar.h
  69. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/hal_conf_extra.h
  70. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/ldscript.ld
  71. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/variant.cpp
  72. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/variant.h
  73. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/PeripheralPins.c
  74. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/PinNamesVar.h
  75. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/hal_conf_extra.h
  76. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/ldscript.ld
  77. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/variant.cpp
  78. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/variant.h
  79. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/PeripheralPins.c
  80. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/PinNamesVar.h
  81. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/hal_conf_extra.h
  82. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/ldscript.ld
  83. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/variant.cpp
  84. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/variant.h
  85. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/PeripheralPins.c
  86. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/PinNamesVar.h
  87. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/hal_conf_extra.h
  88. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/ldscript.ld
  89. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/variant.cpp
  90. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/variant.h
  91. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/PeripheralPins.c
  92. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/PinNamesVar.h
  93. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/hal_conf_extra.h
  94. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/ldscript.ld
  95. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/variant.cpp
  96. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/variant.h
  97. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_FLY_F407ZG/PeripheralPins.c
  98. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_FLY_F407ZG/PinNamesVar.h
  99. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_FLY_F407ZG/ldscript.ld
  100. 0
    0
      buildroot/share/PlatformIO/variants/MARLIN_FLY_F407ZG/variant.cpp

+ 1
- 0
.github/workflows/test-builds.yml Dosyayı Görüntüle

@@ -90,6 +90,7 @@ jobs:
90 90
         - NUCLEO_F767ZI
91 91
         - REMRAM_V1
92 92
         - BTT_SKR_SE_BX
93
+        - chitu_f103
93 94
 
94 95
         # Put lengthy tests last
95 96
 

+ 0
- 65
buildroot/share/PlatformIO/boards/LERDGE.json Dosyayı Görüntüle

@@ -1,65 +0,0 @@
1
-{
2
-  "build": {
3
-    "core": "stm32",
4
-    "cpu": "cortex-m4",
5
-    "extra_flags": "-DSTM32F407xx",
6
-    "f_cpu": "168000000L",
7
-    "hwids": [
8
-      [
9
-        "0x1EAF",
10
-        "0x0003"
11
-      ],
12
-      [
13
-        "0x0483",
14
-        "0x3748"
15
-      ]
16
-    ],
17
-    "mcu": "stm32f407zgt6",
18
-    "variant": "LERDGE",
19
-    "ldscript": "LERDGE.ld"
20
-  },
21
-  "debug": {
22
-    "jlink_device": "STM32F407ZG",
23
-    "openocd_target": "stm32f4x",
24
-    "svd_path": "STM32F40x.svd",
25
-    "tools": {
26
-      "stlink": {
27
-        "server": {
28
-          "arguments": [
29
-            "-f",
30
-            "scripts/interface/stlink.cfg",
31
-            "-c",
32
-            "transport select hla_swd",
33
-            "-f",
34
-            "scripts/target/stm32f4x.cfg",
35
-            "-c",
36
-            "reset_config none"
37
-          ],
38
-          "executable": "bin/openocd",
39
-          "package": "tool-openocd"
40
-        }
41
-      }
42
-    }
43
-  },
44
-  "frameworks": [
45
-    "arduino",
46
-    "stm32cube"
47
-  ],
48
-  "name": "STM32F407ZGT6(192k RAM. 1024k Flash)",
49
-  "upload": {
50
-    "disable_flushing": false,
51
-    "maximum_ram_size": 196608,
52
-    "maximum_size": 1048576,
53
-    "protocol": "stlink",
54
-    "protocols": [
55
-      "stlink",
56
-      "dfu",
57
-      "jlink"
58
-    ],
59
-    "require_upload_port": true,
60
-    "use_1200bps_touch": false,
61
-    "wait_for_upload_port": false
62
-  },
63
-  "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407ZG.html",
64
-  "vendor": "Generic"
65
-}

+ 0
- 34
buildroot/share/PlatformIO/boards/fysetc_f6.json Dosyayı Görüntüle

@@ -1,34 +0,0 @@
1
-{
2
-  "build": {
3
-    "core": "arduino",
4
-    "extra_flags": "-DARDUINO_AVR_MEGA2560",
5
-    "f_cpu": "16000000L",
6
-    "hwids": [
7
-      [
8
-        "0x27b2",
9
-        "0x0002"
10
-      ]
11
-    ],
12
-    "mcu": "atmega2560",
13
-    "variant": "fysetcf6"
14
-  },
15
-  "debug": {
16
-    "simavr_target": "atmega2560",
17
-    "avr-stub": {
18
-      "speed": 115200
19
-    }
20
-  },
21
-  "frameworks": [
22
-    "arduino"
23
-  ],
24
-  "name": "FYSETC F6",
25
-  "upload": {
26
-    "maximum_ram_size": 8192,
27
-    "maximum_size": 258048,
28
-    "protocol": "wiring",
29
-    "require_upload_port": true,
30
-    "speed": 115200
31
-  },
32
-  "url": "https://www.fysetc.com/",
33
-  "vendor": "FYSETC"
34
-}

buildroot/share/PlatformIO/boards/BTT_SKR_SE_BX.json → buildroot/share/PlatformIO/boards/marlin_BTT_SKR_SE_BX.json Dosyayı Görüntüle

@@ -5,7 +5,7 @@
5 5
     "extra_flags": "-DSTM32H743xx",
6 6
     "f_cpu": "400000000L",
7 7
     "mcu": "stm32h743iit6",
8
-    "variant": "BTT_SKR_SE_BX"
8
+    "variant": "MARLIN_BTT_SKR_SE_BX"
9 9
   },
10 10
   "debug": {
11 11
     "jlink_device": "STM32H743II",

buildroot/share/PlatformIO/boards/BigTree_Btt002.json → buildroot/share/PlatformIO/boards/marlin_BigTree_BTT002.json Dosyayı Görüntüle

@@ -15,7 +15,7 @@
15 15
       ]
16 16
     ],
17 17
     "mcu": "stm32f407vgt6",
18
-    "variant": "BIGTREE_BTT002"
18
+    "variant": "MARLIN_BIGTREE_BTT002"
19 19
   },
20 20
   "debug": {
21 21
     "jlink_device": "STM32F407VG",

buildroot/share/PlatformIO/boards/BigTree_GTR_v1.json → buildroot/share/PlatformIO/boards/marlin_BigTree_GTR_v1.json Dosyayı Görüntüle

@@ -15,7 +15,7 @@
15 15
       ]
16 16
     ],
17 17
     "mcu": "stm32f407zgt6",
18
-    "variant": "BIGTREE_GTR_V1"
18
+    "variant": "MARLIN_BIGTREE_GTR_V1"
19 19
   },
20 20
   "debug": {
21 21
     "jlink_device": "STM32F407ZG",

buildroot/share/PlatformIO/boards/BigTree_SKR_Pro.json → buildroot/share/PlatformIO/boards/marlin_BigTree_SKR_Pro.json Dosyayı Görüntüle

@@ -15,7 +15,7 @@
15 15
       ]
16 16
     ],
17 17
     "mcu": "stm32f407zgt6",
18
-    "variant": "BIGTREE_SKR_PRO_1v1"
18
+    "variant": "MARLIN_BIGTREE_SKR_PRO_11"
19 19
   },
20 20
   "debug": {
21 21
     "jlink_device": "STM32F407ZG",

buildroot/share/PlatformIO/boards/CHITU_F103.json → buildroot/share/PlatformIO/boards/marlin_CHITU_F103.json Dosyayı Görüntüle

@@ -15,8 +15,7 @@
15 15
       ]
16 16
     ],
17 17
     "mcu": "stm32f103zet6",
18
-    "variant": "CHITU_F103",
19
-    "ldscript": "chitu_f103.ld"
18
+    "variant": "marlin_CHITU_F103"
20 19
   },
21 20
   "debug": {
22 21
     "jlink_device": "STM32F103ZE",

buildroot/share/PlatformIO/boards/FYSETC_CHEETAH_V20.json → buildroot/share/PlatformIO/boards/marlin_FYSETC_CHEETAH_V20.json Dosyayı Görüntüle

@@ -16,7 +16,7 @@
16 16
     ],
17 17
     "ldscript": "stm32f401rc.ld",
18 18
     "mcu": "stm32f401rct6",
19
-    "variant": "FYSETC_CHEETAH_V20"
19
+    "variant": "MARLIN_FYSETC_CHEETAH_V20"
20 20
   },
21 21
   "debug": {
22 22
     "jlink_device": "STM32F401RC",

buildroot/share/PlatformIO/boards/MEEB_3DP.json → buildroot/share/PlatformIO/boards/marlin_MEEB_3DP.json Dosyayı Görüntüle

@@ -18,7 +18,7 @@
18 18
       "ldscript": "stm32f103xc.ld"
19 19
     },
20 20
     "mcu": "stm32f103rct6",
21
-    "variant": "MEEB_3DP"
21
+    "variant": "marlin_MEEB_3DP"
22 22
   },
23 23
   "debug": {
24 24
     "jlink_device": "STM32F103RC",

buildroot/share/PlatformIO/boards/STEVAL_STM32F401VE.json → buildroot/share/PlatformIO/boards/marlin_STEVAL_STM32F401VE.json Dosyayı Görüntüle

@@ -14,9 +14,8 @@
14 14
         "0x3748"
15 15
       ]
16 16
     ],
17
-    "ldscript": "stm32f401xe.ld",
18 17
     "mcu": "stm32f401vet6",
19
-    "variant": "STEVAL_F401VE"
18
+    "variant": "MARLIN_STEVAL_F401VE"
20 19
   },
21 20
   "debug": {
22 21
     "jlink_device": "STM32F401VE",

buildroot/share/PlatformIO/boards/genericSTM32F407VGT6.json → buildroot/share/PlatformIO/boards/marlin_STM32F407VGT6_CCM.json Dosyayı Görüntüle


buildroot/share/PlatformIO/boards/FLYF407ZG.json → buildroot/share/PlatformIO/boards/marlin_STM32F407ZGT6.json Dosyayı Görüntüle

@@ -14,8 +14,7 @@
14 14
         "0x3748"
15 15
       ]
16 16
     ],
17
-    "mcu": "stm32f407zgt6",
18
-    "variant": "FLY_F407ZG"
17
+    "mcu": "stm32f407zgt6"
19 18
   },
20 19
   "debug": {
21 20
     "jlink_device": "STM32F407ZG",
@@ -49,7 +48,7 @@
49 48
     "disable_flushing": false,
50 49
     "maximum_ram_size": 196608,
51 50
     "maximum_size": 1048576,
52
-    "protocol": "dfu",
51
+    "protocol": "stlink",
53 52
     "protocols": [
54 53
       "stlink",
55 54
       "dfu",

buildroot/share/PlatformIO/boards/archim.json → buildroot/share/PlatformIO/boards/marlin_archim.json Dosyayı Görüntüle

@@ -21,7 +21,7 @@
21 21
     "ldscript": "linker_scripts/gcc/flash.ld",
22 22
     "mcu": "at91sam3x8e",
23 23
     "usb_product": "Archim",
24
-    "variant": "archim"
24
+    "variant": "MARLIN_ARCHIM"
25 25
   },
26 26
   "connectivity": [
27 27
     "can"

buildroot/share/PlatformIO/boards/at90usb1286.json → buildroot/share/PlatformIO/boards/marlin_at90usb1286.json Dosyayı Görüntüle


buildroot/share/PlatformIO/boards/blackSTM32F407VET6.json → buildroot/share/PlatformIO/boards/marlin_blackSTM32F407VET6.json Dosyayı Görüntüle


buildroot/share/PlatformIO/boards/malyanM200.json → buildroot/share/PlatformIO/boards/marlin_malyanM200.json Dosyayı Görüntüle


buildroot/share/PlatformIO/boards/malyanM200v2.json → buildroot/share/PlatformIO/boards/marlin_malyanM200v2.json Dosyayı Görüntüle


+ 3
- 7
buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py Dosyayı Görüntüle

@@ -1,5 +1,5 @@
1 1
 #
2
-# STM32F103RC_MEEB_3DP.py
2
+# buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py
3 3
 #
4 4
 try:
5 5
     import configparser
@@ -54,9 +54,5 @@ for define in env['CPPDEFINES']:
54 54
 print('Use the {0:s} address as the marlin app entry point.'.format(vect_tab_addr))
55 55
 print('Use the {0:d}KB flash version of stm32f103rct6 chip.'.format(flash_size))
56 56
 
57
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103RC_MEEB_3DP.ld")
58
-for i, flag in enumerate(env["LINKFLAGS"]):
59
-    if "-Wl,-T" in flag:
60
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
61
-    elif flag == "-T":
62
-        env["LINKFLAGS"][i + 1] = custom_ld_script
57
+import marlin
58
+marlin.custom_ld_script("STM32F103RC_MEEB_3DP.ld")

+ 0
- 23
buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py Dosyayı Görüntüle

@@ -1,23 +0,0 @@
1
-#
2
-# STM32F103RC_SKR_MINI.py
3
-#
4
-import os
5
-Import("env")
6
-
7
-STM32_FLASH_SIZE = 256
8
-
9
-for define in env['CPPDEFINES']:
10
-    if define[0] == "VECT_TAB_ADDR":
11
-        env['CPPDEFINES'].remove(define)
12
-    if define[0] == "STM32_FLASH_SIZE":
13
-        STM32_FLASH_SIZE = define[1]
14
-
15
-# Relocate firmware from 0x08000000 to 0x08007000
16
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
17
-
18
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103RC_SKR_MINI_" + str(STM32_FLASH_SIZE) + "K.ld")
19
-for i, flag in enumerate(env["LINKFLAGS"]):
20
-    if "-Wl,-T" in flag:
21
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
22
-    elif flag == "-T":
23
-        env["LINKFLAGS"][i + 1] = custom_ld_script

+ 1
- 14
buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py Dosyayı Görüntüle

@@ -1,24 +1,11 @@
1 1
 #
2
-# STM32F103RC_fysetc.py
2
+# buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py
3 3
 #
4 4
 import os
5 5
 from os.path import join
6 6
 from os.path import expandvars
7 7
 Import("env")
8 8
 
9
-# Relocate firmware from 0x08000000 to 0x08008000
10
-#for define in env['CPPDEFINES']:
11
-#    if define[0] == "VECT_TAB_ADDR":
12
-#        env['CPPDEFINES'].remove(define)
13
-#env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08008000"))
14
-
15
-#custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/fysetc_stm32f103rc.ld")
16
-#for i, flag in enumerate(env["LINKFLAGS"]):
17
-#    if "-Wl,-T" in flag:
18
-#        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
19
-#    elif flag == "-T":
20
-#        env["LINKFLAGS"][i + 1] = custom_ld_script
21
-
22 9
 # Custom HEX from ELF
23 10
 env.AddPostAction(
24 11
 	join("$BUILD_DIR","${PROGNAME}.elf"),

+ 0
- 20
buildroot/share/PlatformIO/scripts/STM32F103RET6_creality.py Dosyayı Görüntüle

@@ -1,20 +0,0 @@
1
-#
2
-# STM32F103RET6_creality.py
3
-#
4
-import os
5
-Import("env")
6
-
7
-# Relocate firmware from 0x08000000 to 0x08007000
8
-for define in env['CPPDEFINES']:
9
-    if define[0] == "VECT_TAB_ADDR":
10
-        env['CPPDEFINES'].remove(define)
11
-
12
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
13
-
14
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/creality.ld")
15
-
16
-for i, flag in enumerate(env['LINKFLAGS']):
17
-    if "-Wl,-T" in flag:
18
-        env['LINKFLAGS'][i] = "-Wl,-T" + custom_ld_script
19
-    elif flag == "-T":
20
-        env['LINKFLAGS'][i + 1] = custom_ld_script

+ 0
- 19
buildroot/share/PlatformIO/scripts/STM32F103RE_SKR_E3_DIP.py Dosyayı Görüntüle

@@ -1,19 +0,0 @@
1
-#
2
-# STM32F103RE_SKR_E3_DIP.py
3
-#
4
-import os
5
-Import("env")
6
-
7
-for define in env['CPPDEFINES']:
8
-    if define[0] == "VECT_TAB_ADDR":
9
-        env['CPPDEFINES'].remove(define)
10
-
11
-# Relocate firmware from 0x08000000 to 0x08007000
12
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
13
-
14
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103RE_SKR_E3_DIP.ld")
15
-for i, flag in enumerate(env["LINKFLAGS"]):
16
-    if "-Wl,-T" in flag:
17
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
18
-    elif flag == "-T":
19
-        env["LINKFLAGS"][i + 1] = custom_ld_script

+ 6
- 20
buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py Dosyayı Görüntüle

@@ -1,36 +1,22 @@
1 1
 #
2
-# STM32F103VE_longer.py
2
+# buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py
3 3
 # Customizations for env:STM32F103VE_longer
4 4
 #
5
-import os
6
-Import("env")
7
-
8
-# Relocate firmware from 0x08000000 to 0x08010000
9
-for define in env['CPPDEFINES']:
10
-    if define[0] == "VECT_TAB_ADDR":
11
-        env['CPPDEFINES'].remove(define)
12
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
13
-
14
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103VE_longer.ld")
15
-for i, flag in enumerate(env["LINKFLAGS"]):
16
-    if "-Wl,-T" in flag:
17
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
18
-    elif flag == "-T":
19
-        env["LINKFLAGS"][i + 1] = custom_ld_script
5
+import os,marlin
20 6
 
21 7
 # Rename ${PROGNAME}.bin and save it as 'project.bin' (No encryption on the Longer3D)
22 8
 def encrypt(source, target, env):
23 9
     firmware = open(target[0].path, "rb")
24
-    marlin_alfa = open(target[0].dir.path +'/project.bin', "wb")
10
+    renamed = open(target[0].dir.path + '/project.bin', "wb")
25 11
     length = os.path.getsize(target[0].path)
26 12
     position = 0
27 13
     try:
28 14
         while position < length:
29 15
             byte = firmware.read(1)
30
-            marlin_alfa.write(byte)
16
+            renamed.write(byte)
31 17
             position += 1
32 18
     finally:
33 19
         firmware.close()
34
-        marlin_alfa.close()
20
+        renamed.close()
35 21
 
36
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
22
+marlin.add_post_action(encrypt);

+ 2
- 11
buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py Dosyayı Görüntüle

@@ -1,19 +1,10 @@
1 1
 #
2 2
 # STM32F1_create_variant.py
3 3
 #
4
-import os,shutil
4
+import os,shutil,marlin
5 5
 from SCons.Script import DefaultEnvironment
6 6
 from platformio import util
7 7
 
8
-def copytree(src, dst, symlinks=False, ignore=None):
9
-    for item in os.listdir(src):
10
-        s = os.path.join(src, item)
11
-        d = os.path.join(dst, item)
12
-        if os.path.isdir(s):
13
-            shutil.copytree(s, d, symlinks, ignore)
14
-        else:
15
-            shutil.copy2(s, d)
16
-
17 8
 env = DefaultEnvironment()
18 9
 platform = env.PioPlatform()
19 10
 board = env.BoardConfig()
@@ -36,4 +27,4 @@ if os.path.isdir(variant_dir):
36 27
 if not os.path.isdir(variant_dir):
37 28
     os.mkdir(variant_dir)
38 29
 
39
-copytree(source_dir, variant_dir)
30
+marlin.copytree(source_dir, variant_dir)

+ 0
- 13
buildroot/share/PlatformIO/scripts/STM32F401VE_STEVAL.py Dosyayı Görüntüle

@@ -1,13 +0,0 @@
1
-#
2
-# STM32F401VE_STEVAL.py
3
-# Customizations for env:STM32F401VE_STEVAL
4
-#
5
-import os
6
-Import("env")
7
-
8
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/variants/STEVAL_F401VE/ldscript.ld")
9
-for i, flag in enumerate(env["LINKFLAGS"]):
10
-    if "-Wl,-T" in flag:
11
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
12
-    elif flag == "-T":
13
-        env["LINKFLAGS"][i + 1] = custom_ld_script

+ 6
- 18
buildroot/share/PlatformIO/scripts/chitu_crypt.py Dosyayı Görüntüle

@@ -1,21 +1,11 @@
1 1
 #
2
-# chitu_crypt.py
2
+# buildroot/share/PlatformIO/scripts/chitu_crypt.py
3 3
 # Customizations for Chitu boards
4 4
 #
5
-Import("env")
6
-import os,random,struct,uuid
5
+import os,random,struct,uuid,marlin
7 6
 
8 7
 # Relocate firmware from 0x08000000 to 0x08008800
9
-env['CPPDEFINES'].remove(("VECT_TAB_ADDR", "0x8000000"))
10
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08008800"))
11
-
12
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/chitu_f103.ld")
13
-for i, flag in enumerate(env["LINKFLAGS"]):
14
-    if "-Wl,-T" in flag:
15
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
16
-    elif flag == "-T":
17
-        env["LINKFLAGS"][i + 1] = custom_ld_script
18
-
8
+marlin.relocate_firmware("0x08008800")
19 9
 
20 10
 def calculate_crc(contents, seed):
21 11
     accumulating_xor_value = seed;
@@ -43,7 +33,7 @@ def xor_block(r0, r1, block_number, block_size, file_key):
43 33
 
44 34
     for loop_counter in range(0, block_size):
45 35
         # meant to make sure different bits of the key are used.
46
-        xor_seed = int(loop_counter/key_length)
36
+        xor_seed = int(loop_counter / key_length)
47 37
 
48 38
         # IP is a scratch register / R12
49 39
         ip = loop_counter - (key_length * xor_seed)
@@ -69,7 +59,6 @@ def xor_block(r0, r1, block_number, block_size, file_key):
69 59
         #increment the loop_counter
70 60
         loop_counter = loop_counter + 1
71 61
 
72
-
73 62
 def encrypt_file(input, output_file, file_length):
74 63
     input_file = bytearray(input.read())
75 64
     block_size = 0x800
@@ -113,11 +102,10 @@ def encrypt_file(input, output_file, file_length):
113 102
     output_file.write(input_file)
114 103
     return
115 104
 
116
-
117 105
 # Encrypt ${PROGNAME}.bin and save it as 'update.cbd'
118 106
 def encrypt(source, target, env):
119 107
     firmware = open(target[0].path, "rb")
120
-    update = open(target[0].dir.path +'/update.cbd', "wb")
108
+    update = open(target[0].dir.path + '/update.cbd', "wb")
121 109
     length = os.path.getsize(target[0].path)
122 110
 
123 111
     encrypt_file(firmware, update, length)
@@ -125,4 +113,4 @@ def encrypt(source, target, env):
125 113
     firmware.close()
126 114
     update.close()
127 115
 
128
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
116
+marlin.add_post_action(encrypt);

+ 0
- 49
buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py Dosyayı Görüntüle

@@ -1,49 +0,0 @@
1
-#
2
-# copy_marlin_variant_to_framework.py
3
-#
4
-import os,shutil
5
-from SCons.Script import DefaultEnvironment
6
-from platformio import util
7
-from platformio.package.meta import PackageSpec
8
-
9
-def copytree(src, dst, symlinks=False, ignore=None):
10
-    for item in os.listdir(src):
11
-        s = os.path.join(src, item)
12
-        d = os.path.join(dst, item)
13
-        if os.path.isdir(s):
14
-            shutil.copytree(s, d, symlinks, ignore)
15
-        else:
16
-            shutil.copy2(s, d)
17
-
18
-env = DefaultEnvironment()
19
-platform = env.PioPlatform()
20
-board = env.BoardConfig()
21
-variant = board.get("build.variant")
22
-
23
-platform_packages = env.GetProjectOption('platform_packages')
24
-# if there's no framework defined, take it from the class name of platform
25
-framewords = {
26
-    "Ststm32Platform": "framework-arduinoststm32",
27
-    "AtmelavrPlatform": "framework-arduino-avr"
28
-}
29
-if len(platform_packages) == 0:
30
-    platform_name = framewords[platform.__class__.__name__]
31
-else:
32
-    platform_name = PackageSpec(platform_packages[0]).name
33
-
34
-FRAMEWORK_DIR = platform.get_package_dir(platform_name)
35
-assert os.path.isdir(FRAMEWORK_DIR)
36
-assert os.path.isdir("buildroot/share/PlatformIO/variants")
37
-
38
-variant_dir = os.path.join(FRAMEWORK_DIR, "variants", variant)
39
-
40
-source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant)
41
-assert os.path.isdir(source_dir)
42
-
43
-if os.path.isdir(variant_dir):
44
-    shutil.rmtree(variant_dir)
45
-
46
-if not os.path.isdir(variant_dir):
47
-    os.mkdir(variant_dir)
48
-
49
-copytree(source_dir, variant_dir)

+ 13
- 0
buildroot/share/PlatformIO/scripts/custom_board.py Dosyayı Görüntüle

@@ -0,0 +1,13 @@
1
+#
2
+# buildroot/share/PlatformIO/scripts/custom_board.py
3
+#
4
+import marlin
5
+board = marlin.env.BoardConfig()
6
+
7
+address = board.get("build.address", "")
8
+if address:
9
+	marlin.relocate_firmware(address)
10
+
11
+ldscript = board.get("build.ldscript", "")
12
+if ldscript:
13
+	marlin.custom_ld_script(ldscript)

+ 2
- 1
buildroot/share/PlatformIO/scripts/download_mks_assets.py Dosyayı Görüntüle

@@ -1,5 +1,6 @@
1 1
 #
2
-# download_mks_assets.py
2
+# buildroot/share/PlatformIO/scripts/download_mks_assets.py
3
+# Added by HAS_TFT_LVGL_UI to download assets from Makerbase repo
3 4
 #
4 5
 Import("env")
5 6
 import os,requests,zipfile,tempfile,shutil

+ 0
- 20
buildroot/share/PlatformIO/scripts/fly_mini.py Dosyayı Görüntüle

@@ -1,20 +0,0 @@
1
-#
2
-# fly_mini.py
3
-# Customizations for env:FLY_MINI
4
-#
5
-import os
6
-Import("env")
7
-
8
-# Relocate firmware from 0x08000000 to 0x08005000
9
-for define in env['CPPDEFINES']:
10
-    if define[0] == "VECT_TAB_ADDR":
11
-        env['CPPDEFINES'].remove(define)
12
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08005000"))
13
-
14
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/fly_mini.ld")
15
-for i, flag in enumerate(env["LINKFLAGS"]):
16
-    if "-Wl,-T" in flag:
17
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
18
-    elif flag == "-T":
19
-        env["LINKFLAGS"][i + 1] = custom_ld_script
20
-

+ 0
- 13
buildroot/share/PlatformIO/scripts/fysetc_cheetah_v20.py Dosyayı Görüntüle

@@ -1,13 +0,0 @@
1
-#
2
-# STM32F401VE_STEVAL.py
3
-# Customizations for env:STM32F401VE_STEVAL
4
-#
5
-import os
6
-Import("env")
7
-
8
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/variants/FYSETC_CHEETAH_V20/ldscript.ld")
9
-for i, flag in enumerate(env["LINKFLAGS"]):
10
-    if "-Wl,-T" in flag:
11
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
12
-    elif flag == "-T":
13
-        env["LINKFLAGS"][i + 1] = custom_ld_script

+ 38
- 14
buildroot/share/PlatformIO/scripts/generic_create_variant.py Dosyayı Görüntüle

@@ -1,30 +1,54 @@
1 1
 #
2
-# Generate a generic variant
2
+# generic_create_variant.py
3 3
 #
4
-import os,shutil
4
+# Copy one of the variants from buildroot/platformio/variants into
5
+# the appropriate framework variants folder, so that its contents
6
+# will be picked up by PlatformIO just like any other variant.
7
+#
8
+import os,shutil,marlin
5 9
 from SCons.Script import DefaultEnvironment
6 10
 from platformio import util
7 11
 
8 12
 env = DefaultEnvironment()
13
+
14
+#
15
+# Get the platform name from the 'platform_packages' option,
16
+# or look it up by the platform.class.name.
17
+#
9 18
 platform = env.PioPlatform()
10
-board = env.BoardConfig()
11 19
 
12
-FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32")
20
+from platformio.package.meta import PackageSpec
21
+platform_packages = env.GetProjectOption('platform_packages')
22
+if len(platform_packages) == 0:
23
+    framewords = {
24
+        "Ststm32Platform": "framework-arduinoststm32",
25
+        "AtmelavrPlatform": "framework-arduino-avr"
26
+    }
27
+    platform_name = framewords[platform.__class__.__name__]
28
+else:
29
+    platform_name = PackageSpec(platform_packages[0]).name
30
+
31
+if platform_name in [ "usb-host-msc", "usb-host-msc-cdc-msc", "tool-stm32duino" ]:
32
+    platform_name = "framework-arduinoststm32"
33
+
34
+FRAMEWORK_DIR = platform.get_package_dir(platform_name)
13 35
 assert os.path.isdir(FRAMEWORK_DIR)
14
-assert os.path.isdir("buildroot/share/PlatformIO/variants")
15 36
 
16
-mcu_type = board.get("build.mcu")[:-2]
37
+board = env.BoardConfig()
38
+
39
+#mcu_type = board.get("build.mcu")[:-2]
17 40
 variant = board.get("build.variant")
18
-series = mcu_type[:7].upper() + "xx"
41
+#series = mcu_type[:7].upper() + "xx"
42
+
43
+# Prepare a new empty folder at the destination
19 44
 variant_dir = os.path.join(FRAMEWORK_DIR, "variants", variant)
45
+if os.path.isdir(variant_dir):
46
+    shutil.rmtree(variant_dir)
47
+if not os.path.isdir(variant_dir):
48
+    os.mkdir(variant_dir)
20 49
 
50
+# Source dir is a local variant sub-folder
21 51
 source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant)
22 52
 assert os.path.isdir(source_dir)
23 53
 
24
-if not os.path.isdir(variant_dir):
25
-    os.mkdir(variant_dir)
26
-
27
-for file_name in os.listdir(source_dir):
28
-    full_file_name = os.path.join(source_dir, file_name)
29
-    if os.path.isfile(full_file_name):
30
-        shutil.copy(full_file_name, variant_dir)
54
+marlin.copytree(source_dir, variant_dir)

+ 21
- 30
buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py Dosyayı Görüntüle

@@ -1,30 +1,21 @@
1
-import os
2
-Import("env")
1
+#
2
+# buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py
3
+# Customizations for env:jgaurora_a5s_a1
4
+#
5
+import os,marlin
3 6
 
4
-# Relocate firmware from 0x08000000 to 0x0800A000
5
-env['CPPDEFINES'].remove(("VECT_TAB_ADDR", "0x8000000"))
6
-#alternatively, for STSTM <=5.1.0 use line below
7
-#env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
8
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x0800A000"))
9
-
10
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/jgaurora_a5s_a1.ld")
11
-for i, flag in enumerate(env["LINKFLAGS"]):
12
-    if "-Wl,-T" in flag:
13
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
14
-    elif flag == "-T":
15
-        env["LINKFLAGS"][i + 1] = custom_ld_script
16
-
17
-#append ${PROGNAME}.bin firmware after bootloader and save it as 'jgaurora_firmware.bin'
18
-def addboot(source,target,env):
7
+# Append ${PROGNAME}.bin firmware after bootloader and save it as 'jgaurora_firmware.bin'
8
+def addboot(source, target, env):
19 9
 	firmware = open(target[0].path, "rb")
20 10
 	lengthfirmware = os.path.getsize(target[0].path)
21
-	bootloader_dir = "buildroot/share/PlatformIO/scripts/jgaurora_bootloader.bin"
22
-	bootloader = open(bootloader_dir, "rb")
23
-	lengthbootloader = os.path.getsize(bootloader_dir)
24
-	firmware_with_boothloader_dir = target[0].dir.path +'/firmware_with_bootloader.bin'
25
-	if os.path.exists(firmware_with_boothloader_dir):
26
-		os.remove(firmware_with_boothloader_dir)
27
-	firmwareimage = open(firmware_with_boothloader_dir, "wb")
11
+	bootloader_bin = "buildroot/share/PlatformIO/scripts/" + "jgaurora_bootloader.bin"
12
+	bootloader = open(bootloader_bin, "rb")
13
+	lengthbootloader = os.path.getsize(bootloader_bin)
14
+
15
+	firmware_with_boothloader_bin = target[0].dir.path + '/firmware_with_bootloader.bin'
16
+	if os.path.exists(firmware_with_boothloader_bin):
17
+		os.remove(firmware_with_boothloader_bin)
18
+	firmwareimage = open(firmware_with_boothloader_bin, "wb")
28 19
 	position = 0
29 20
 	while position < lengthbootloader:
30 21
 		byte = bootloader.read(1)
@@ -38,11 +29,11 @@ def addboot(source,target,env):
38 29
 	bootloader.close()
39 30
 	firmware.close()
40 31
 	firmwareimage.close()
41
-	firmware_without_bootloader_dir = target[0].dir.path+'/firmware_for_sd_upload.bin'
42
-	if os.path.exists(firmware_without_bootloader_dir):
43
-		os.remove(firmware_without_bootloader_dir)
44
-	os.rename(target[0].path, firmware_without_bootloader_dir)
45
-	#os.rename(target[0].dir.path+'/firmware_with_bootloader.bin', target[0].dir.path+'/firmware.bin')
46 32
 
47
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", addboot);
33
+	firmware_without_bootloader_bin = target[0].dir.path + '/firmware_for_sd_upload.bin'
34
+	if os.path.exists(firmware_without_bootloader_bin):
35
+		os.remove(firmware_without_bootloader_bin)
36
+	os.rename(target[0].path, firmware_without_bootloader_bin)
37
+	#os.rename(target[0].dir.path+'/firmware_with_bootloader.bin', target[0].dir.path+'/firmware.bin')
48 38
 
39
+marlin.add_post_action(addboot);

+ 10
- 14
buildroot/share/PlatformIO/scripts/lerdge.py Dosyayı Görüntüle

@@ -1,20 +1,16 @@
1 1
 #
2
-# lerdge.py
3
-# Customizations for Lerdge build environments
2
+# buildroot/share/PlatformIO/scripts/lerdge.py
3
+# Customizations for Lerdge build environments:
4
+#   env:LERDGEX  env:LERDGEX_usb_flash_drive
5
+#   env:LERDGES  env:LERDGES_usb_flash_drive
6
+#   env:LERDGEK  env:LERDGEK_usb_flash_drive
4 7
 #
5
-import os,sys
8
+import os,marlin
6 9
 Import("env")
7 10
 
8 11
 from SCons.Script import DefaultEnvironment
9 12
 board = DefaultEnvironment().BoardConfig()
10 13
 
11
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/lerdge.ld")
12
-for i, flag in enumerate(env["LINKFLAGS"]):
13
-    if "-Wl,-T" in flag:
14
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
15
-    elif flag == "-T":
16
-        env["LINKFLAGS"][i + 1] = custom_ld_script
17
-
18 14
 def encryptByte(byte):
19 15
     byte = 0xFF & ((byte << 6) | (byte >> 2))
20 16
     i = 0x58 + byte
@@ -35,16 +31,16 @@ def encrypt_file(input, output_file, file_length):
35 31
 def encrypt(source, target, env):
36 32
     print("Encrypting to:", board.get("build.firmware"))
37 33
     firmware = open(target[0].path, "rb")
38
-    result = open(target[0].dir.path + "/" + board.get("build.firmware"), "wb")
34
+    renamed = open(target[0].dir.path + "/" + board.get("build.firmware"), "wb")
39 35
     length = os.path.getsize(target[0].path)
40 36
 
41
-    encrypt_file(firmware, result, length)
37
+    encrypt_file(firmware, renamed, length)
42 38
 
43 39
     firmware.close()
44
-    result.close()
40
+    renamed.close()
45 41
 
46 42
 if 'firmware' in board.get("build").keys():
47
-  env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
43
+  marlin.add_post_action(encrypt);
48 44
 else:
49 45
   print("You need to define output file via board_build.firmware = 'filename' parameter")
50 46
   exit(1);

+ 75
- 0
buildroot/share/PlatformIO/scripts/marlin.py Dosyayı Görüntüle

@@ -0,0 +1,75 @@
1
+#
2
+# buildroot/share/PlatformIO/scripts/marlin.py
3
+# Helper module with some commonly-used functions
4
+#
5
+import os,shutil
6
+
7
+from SCons.Script import DefaultEnvironment
8
+env = DefaultEnvironment()
9
+
10
+def copytree(src, dst, symlinks=False, ignore=None):
11
+   for item in os.listdir(src):
12
+        s = os.path.join(src, item)
13
+        d = os.path.join(dst, item)
14
+        if os.path.isdir(s):
15
+            shutil.copytree(s, d, symlinks, ignore)
16
+        else:
17
+            shutil.copy2(s, d)
18
+
19
+def replace_define(field, value):
20
+	for define in env['CPPDEFINES']:
21
+		if define[0] == field:
22
+			env['CPPDEFINES'].remove(define)
23
+	env['CPPDEFINES'].append((field, value))
24
+
25
+# Relocate the firmware to a new address, such as "0x08005000"
26
+def relocate_firmware(address):
27
+	replace_define("VECT_TAB_ADDR", address)
28
+
29
+# Relocate the vector table with a new offset
30
+def relocate_vtab(address):
31
+	replace_define("VECT_TAB_OFFSET", address)
32
+
33
+# Replace the existing -Wl,-T with the given ldscript path
34
+def custom_ld_script(ldname):
35
+	apath = os.path.abspath("buildroot/share/PlatformIO/ldscripts/" + ldname)
36
+	for i, flag in enumerate(env["LINKFLAGS"]):
37
+		if "-Wl,-T" in flag:
38
+			env["LINKFLAGS"][i] = "-Wl,-T" + apath
39
+		elif flag == "-T":
40
+			env["LINKFLAGS"][i + 1] = apath
41
+
42
+# Encrypt ${PROGNAME}.bin and save it with a new name
43
+# Called by specific encrypt() functions, mostly for MKS boards
44
+def encrypt_mks(source, target, env, new_name):
45
+	import sys
46
+
47
+	key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
48
+
49
+	firmware = open(target[0].path, "rb")
50
+	renamed = open(target[0].dir.path + "/" + new_name, "wb")
51
+	length = os.path.getsize(target[0].path)
52
+	position = 0
53
+	try:
54
+		while position < length:
55
+			byte = firmware.read(1)
56
+			if position >= 320 and position < 31040:
57
+				byte = chr(ord(byte) ^ key[position & 31])
58
+				if sys.version_info[0] > 2:
59
+					byte = bytes(byte, 'latin1')
60
+			renamed.write(byte)
61
+			position += 1
62
+	finally:
63
+		firmware.close()
64
+		renamed.close()
65
+
66
+def add_post_action(action):
67
+	env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", action);
68
+
69
+# Apply customizations for a MKS Robin
70
+def prepare_robin(address, ldname, fwname):
71
+	def encrypt(source, target, env):
72
+		encrypt_mks(source, target, env, fwname)
73
+	relocate_firmware(address)
74
+	custom_ld_script(ldname)
75
+	add_post_action(encrypt);

+ 20
- 24
buildroot/share/PlatformIO/scripts/mks_encrypt.py Dosyayı Görüntüle

@@ -1,32 +1,28 @@
1
-import os,sys
1
+#
2
+# buildroot/share/PlatformIO/scripts/mks_encrypt.py
3
+#
4
+# Apply encryption and save as 'build.firmware' for these environments:
5
+#  - env:mks_robin_stm32
6
+#  - env:flsun_hispeedv1
7
+#  - env:mks_robin_nano35_stm32
8
+#
2 9
 Import("env")
3 10
 
4 11
 from SCons.Script import DefaultEnvironment
5 12
 board = DefaultEnvironment().BoardConfig()
6 13
 
7
-# Encrypt ${PROGNAME}.bin and save it as build.firmware ('Robin.bin')
8
-def encrypt(source, target, env):
9
-  key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
14
+if 'firmware' in board.get("build").keys():
10 15
 
11
-  firmware = open(target[0].path, "rb")
12
-  robin = open(target[0].dir.path +'/'+ board.get("build.firmware"), "wb")
13
-  length = os.path.getsize(target[0].path)
14
-  position = 0
15
-  try:
16
-    while position < length:
17
-      byte = firmware.read(1)
18
-      if position >= 320 and position < 31040:
19
-        byte = chr(ord(byte) ^ key[position & 31])
20
-        if sys.version_info[0] > 2:
21
-          byte = bytes(byte, 'latin1')
22
-      robin.write(byte)
23
-      position += 1
24
-  finally:
25
-    firmware.close()
26
-    robin.close()
16
+	import marlin
17
+
18
+	# Encrypt ${PROGNAME}.bin and save it as build.firmware
19
+	def encrypt(source, target, env):
20
+		marlin.encrypt_mks(source, target, env, "build.firmware")
21
+
22
+	marlin.add_post_action(encrypt);
27 23
 
28
-if 'firmware' in board.get("build").keys():
29
-  env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
30 24
 else:
31
-  print("You need to define output file via board_build.firmware = 'filename' parameter", file=sys.stderr)
32
-  exit(1);
25
+
26
+	import sys
27
+	print("You need to define output file via board_build.firmware = 'filename' parameter", file=sys.stderr)
28
+	env.Exit(1);

+ 5
- 39
buildroot/share/PlatformIO/scripts/mks_robin.py Dosyayı Görüntüle

@@ -1,39 +1,5 @@
1
-import os
2
-Import("env")
3
-
4
-# Relocate firmware from 0x08000000 to 0x08007000
5
-for define in env['CPPDEFINES']:
6
-    if define[0] == "VECT_TAB_ADDR":
7
-        env['CPPDEFINES'].remove(define)
8
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
9
-
10
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin.ld")
11
-for i, flag in enumerate(env["LINKFLAGS"]):
12
-    if "-Wl,-T" in flag:
13
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
14
-    elif flag == "-T":
15
-        env["LINKFLAGS"][i + 1] = custom_ld_script
16
-
17
-# Encrypt ${PROGNAME}.bin and save it as 'Robin.bin'
18
-def encrypt(source, target, env):
19
-    import sys
20
-
21
-    key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
22
-
23
-    firmware = open(target[0].path, "rb")
24
-    robin = open(target[0].dir.path +'/Robin.bin', "wb")
25
-    length = os.path.getsize(target[0].path)
26
-    position = 0
27
-    try:
28
-        while position < length:
29
-            byte = firmware.read(1)
30
-            if position >= 320 and position < 31040:
31
-                byte = chr(ord(byte) ^ key[position & 31])
32
-                if sys.version_info[0] > 2:
33
-                    byte = bytes(byte, 'latin1')
34
-            robin.write(byte)
35
-            position += 1
36
-    finally:
37
-        firmware.close()
38
-        robin.close()
39
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
1
+#
2
+# buildroot/share/PlatformIO/scripts/mks_robin.py
3
+#
4
+import marlin
5
+marlin.prepare_robin("0x08007000", "mks_robin.ld", "Robin.bin")

+ 5
- 40
buildroot/share/PlatformIO/scripts/mks_robin_e3.py Dosyayı Görüntüle

@@ -1,40 +1,5 @@
1
-import os
2
-Import("env")
3
-
4
-# Relocate firmware from 0x08000000 to 0x08005000
5
-for define in env['CPPDEFINES']:
6
-    if define[0] == "VECT_TAB_ADDR":
7
-        env['CPPDEFINES'].remove(define)
8
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08005000"))
9
-
10
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_e3.ld")
11
-for i, flag in enumerate(env["LINKFLAGS"]):
12
-    if "-Wl,-T" in flag:
13
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
14
-    elif flag == "-T":
15
-        env["LINKFLAGS"][i + 1] = custom_ld_script
16
-
17
-
18
-# Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin'
19
-def encrypt(source, target, env):
20
-    import sys
21
-
22
-    key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
23
-
24
-    firmware = open(target[0].path, "rb")
25
-    robin = open(target[0].dir.path +'/Robin_e3.bin', "wb")
26
-    length = os.path.getsize(target[0].path)
27
-    position = 0
28
-    try:
29
-        while position < length:
30
-            byte = firmware.read(1)
31
-            if position >= 320 and position < 31040:
32
-                byte = chr(ord(byte) ^ key[position & 31])
33
-                if sys.version_info[0] > 2:
34
-                    byte = bytes(byte, 'latin1')
35
-            robin.write(byte)
36
-            position += 1
37
-    finally:
38
-        firmware.close()
39
-        robin.close()
40
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
1
+#
2
+# buildroot/share/PlatformIO/scripts/mks_robin_e3.py
3
+#
4
+import marlin
5
+marlin.prepare_robin("0x08005000", "mks_robin_e3.ld", "Robin_e3.bin")

+ 5
- 40
buildroot/share/PlatformIO/scripts/mks_robin_e3p.py Dosyayı Görüntüle

@@ -1,40 +1,5 @@
1
-import os
2
-Import("env")
3
-
4
-# Relocate firmware from 0x08000000 to 0x08007000
5
-for define in env['CPPDEFINES']:
6
-    if define[0] == "VECT_TAB_ADDR":
7
-        env['CPPDEFINES'].remove(define)
8
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
9
-
10
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_e3p.ld")
11
-for i, flag in enumerate(env["LINKFLAGS"]):
12
-    if "-Wl,-T" in flag:
13
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
14
-    elif flag == "-T":
15
-        env["LINKFLAGS"][i + 1] = custom_ld_script
16
-
17
-
18
-# Encrypt ${PROGNAME}.bin and save it as 'mks_robin_e3p.bin'
19
-def encrypt(source, target, env):
20
-    import sys
21
-
22
-    key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
23
-
24
-    firmware = open(target[0].path, "rb")
25
-    robin = open(target[0].dir.path +'/Robin_e3p.bin', "wb")
26
-    length = os.path.getsize(target[0].path)
27
-    position = 0
28
-    try:
29
-        while position < length:
30
-            byte = firmware.read(1)
31
-            if position >= 320 and position < 31040:
32
-                byte = chr(ord(byte) ^ key[position & 31])
33
-                if sys.version_info[0] > 2:
34
-                    byte = bytes(byte, 'latin1')
35
-            robin.write(byte)
36
-            position += 1
37
-    finally:
38
-        firmware.close()
39
-        robin.close()
40
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
1
+#
2
+# buildroot/share/PlatformIO/scripts/mks_robin_e3p.py
3
+#
4
+import marlin
5
+marlin.prepare_robin("0x08007000", "mks_robin_e3p.ld", "Robin_e3p.bin")

+ 5
- 40
buildroot/share/PlatformIO/scripts/mks_robin_lite.py Dosyayı Görüntüle

@@ -1,40 +1,5 @@
1
-import os
2
-Import("env")
3
-
4
-# Relocate firmware from 0x08000000 to 0x08005000
5
-for define in env['CPPDEFINES']:
6
-    if define[0] == "VECT_TAB_ADDR":
7
-        env['CPPDEFINES'].remove(define)
8
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08005000"))
9
-
10
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_lite.ld")
11
-for i, flag in enumerate(env["LINKFLAGS"]):
12
-    if "-Wl,-T" in flag:
13
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
14
-    elif flag == "-T":
15
-        env["LINKFLAGS"][i + 1] = custom_ld_script
16
-
17
-
18
-# Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin'
19
-def encrypt(source, target, env):
20
-    import sys
21
-
22
-    key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
23
-
24
-    firmware = open(target[0].path, "rb")
25
-    robin = open(target[0].dir.path +'/mksLite.bin', "wb")
26
-    length = os.path.getsize(target[0].path)
27
-    position = 0
28
-    try:
29
-        while position < length:
30
-            byte = firmware.read(1)
31
-            if position >= 320 and position < 31040:
32
-                byte = chr(ord(byte) ^ key[position & 31])
33
-                if sys.version_info[0] > 2:
34
-                    byte = bytes(byte, 'latin1')
35
-            robin.write(byte)
36
-            position += 1
37
-    finally:
38
-        firmware.close()
39
-        robin.close()
40
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
1
+#
2
+# buildroot/share/PlatformIO/scripts/mks_robin_lite.py
3
+#
4
+import marlin
5
+marlin.prepare_robin("0x08005000", "mks_robin_lite.ld", "mksLite.bin")

+ 5
- 40
buildroot/share/PlatformIO/scripts/mks_robin_lite3.py Dosyayı Görüntüle

@@ -1,40 +1,5 @@
1
-import os
2
-Import("env")
3
-
4
-# Relocate firmware from 0x08000000 to 0x08005000
5
-for define in env['CPPDEFINES']:
6
-    if define[0] == "VECT_TAB_ADDR":
7
-        env['CPPDEFINES'].remove(define)
8
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08005000"))
9
-
10
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_lite.ld")
11
-for i, flag in enumerate(env["LINKFLAGS"]):
12
-    if "-Wl,-T" in flag:
13
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
14
-    elif flag == "-T":
15
-        env["LINKFLAGS"][i + 1] = custom_ld_script
16
-
17
-
18
-# Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin'
19
-def encrypt(source, target, env):
20
-    import sys
21
-
22
-    key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
23
-
24
-    firmware = open(target[0].path, "rb")
25
-    robin = open(target[0].dir.path +'/mksLite3.bin', "wb")
26
-    length = os.path.getsize(target[0].path)
27
-    position = 0
28
-    try:
29
-        while position < length:
30
-            byte = firmware.read(1)
31
-            if position >= 320 and position < 31040:
32
-                byte = chr(ord(byte) ^ key[position & 31])
33
-                if sys.version_info[0] > 2:
34
-                    byte = bytes(byte, 'latin1')
35
-            robin.write(byte)
36
-            position += 1
37
-    finally:
38
-        firmware.close()
39
-        robin.close()
40
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
1
+#
2
+# buildroot/share/PlatformIO/scripts/mks_robin_lite3.py
3
+#
4
+import marlin
5
+marlin.prepare_robin("0x08005000", "mks_robin_lite.ld", "mksLite3.bin")

+ 5
- 40
buildroot/share/PlatformIO/scripts/mks_robin_mini.py Dosyayı Görüntüle

@@ -1,40 +1,5 @@
1
-import os
2
-Import("env")
3
-
4
-# Relocate firmware from 0x08000000 to 0x08007000
5
-for define in env['CPPDEFINES']:
6
-    if define[0] == "VECT_TAB_ADDR":
7
-        env['CPPDEFINES'].remove(define)
8
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
9
-
10
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_mini.ld")
11
-for i, flag in enumerate(env["LINKFLAGS"]):
12
-    if "-Wl,-T" in flag:
13
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
14
-    elif flag == "-T":
15
-        env["LINKFLAGS"][i + 1] = custom_ld_script
16
-
17
-
18
-# Encrypt ${PROGNAME}.bin and save it as 'Robin_mini.bin'
19
-def encrypt(source, target, env):
20
-    import sys
21
-
22
-    key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
23
-
24
-    firmware = open(target[0].path, "rb")
25
-    robin = open(target[0].dir.path +'/Robin_mini.bin', "wb")
26
-    length = os.path.getsize(target[0].path)
27
-    position = 0
28
-    try:
29
-        while position < length:
30
-            byte = firmware.read(1)
31
-            if position >= 320 and position < 31040:
32
-                byte = chr(ord(byte) ^ key[position & 31])
33
-                if sys.version_info[0] > 2:
34
-                    byte = bytes(byte, 'latin1')
35
-            robin.write(byte)
36
-            position += 1
37
-    finally:
38
-        firmware.close()
39
-        robin.close()
40
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
1
+#
2
+# buildroot/share/PlatformIO/scripts/mks_robin_mini.py
3
+#
4
+import marlin
5
+marlin.prepare_robin("0x08005000", "mks_robin_mini.ld", "Robin_mini.bin")

+ 5
- 40
buildroot/share/PlatformIO/scripts/mks_robin_nano.py Dosyayı Görüntüle

@@ -1,40 +1,5 @@
1
-import os
2
-Import("env")
3
-
4
-# Relocate firmware from 0x08000000 to 0x08007000
5
-for define in env['CPPDEFINES']:
6
-    if define[0] == "VECT_TAB_ADDR":
7
-        env['CPPDEFINES'].remove(define)
8
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
9
-
10
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld")
11
-for i, flag in enumerate(env["LINKFLAGS"]):
12
-    if "-Wl,-T" in flag:
13
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
14
-    elif flag == "-T":
15
-        env["LINKFLAGS"][i + 1] = custom_ld_script
16
-
17
-
18
-# Encrypt ${PROGNAME}.bin and save it as 'Robin_nano.bin'
19
-def encrypt(source, target, env):
20
-    import sys
21
-
22
-    key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
23
-
24
-    firmware = open(target[0].path, "rb")
25
-    robin = open(target[0].dir.path +'/Robin_nano.bin', "wb")
26
-    length = os.path.getsize(target[0].path)
27
-    position = 0
28
-    try:
29
-        while position < length:
30
-            byte = firmware.read(1)
31
-            if position >= 320 and position < 31040:
32
-                byte = chr(ord(byte) ^ key[position & 31])
33
-                if sys.version_info[0] > 2:
34
-                    byte = bytes(byte, 'latin1')
35
-            robin.write(byte)
36
-            position += 1
37
-    finally:
38
-        firmware.close()
39
-        robin.close()
40
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
1
+#
2
+# buildroot/share/PlatformIO/scripts/mks_robin_nano.py
3
+#
4
+import marlin
5
+marlin.prepare_robin("0x08007000", "mks_robin_nano.ld", "Robin_nano.bin")

+ 5
- 40
buildroot/share/PlatformIO/scripts/mks_robin_nano35.py Dosyayı Görüntüle

@@ -1,40 +1,5 @@
1
-import os
2
-Import("env")
3
-
4
-# Relocate firmware from 0x08000000 to 0x08007000
5
-for define in env['CPPDEFINES']:
6
-    if define[0] == "VECT_TAB_ADDR":
7
-        env['CPPDEFINES'].remove(define)
8
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
9
-
10
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld")
11
-for i, flag in enumerate(env["LINKFLAGS"]):
12
-    if "-Wl,-T" in flag:
13
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
14
-    elif flag == "-T":
15
-        env["LINKFLAGS"][i + 1] = custom_ld_script
16
-
17
-
18
-# Encrypt ${PROGNAME}.bin and save it as 'Robin_nano35.bin'
19
-def encrypt(source, target, env):
20
-    import sys
21
-
22
-    key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
23
-
24
-    firmware = open(target[0].path, "rb")
25
-    robin = open(target[0].dir.path +'/Robin_nano35.bin', "wb")
26
-    length = os.path.getsize(target[0].path)
27
-    position = 0
28
-    try:
29
-        while position < length:
30
-            byte = firmware.read(1)
31
-            if position >= 320 and position < 31040:
32
-                byte = chr(ord(byte) ^ key[position & 31])
33
-                if sys.version_info[0] > 2:
34
-                    byte = bytes(byte, 'latin1')
35
-            robin.write(byte)
36
-            position += 1
37
-    finally:
38
-        firmware.close()
39
-        robin.close()
40
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
1
+#
2
+# buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
3
+#
4
+import marlin
5
+marlin.prepare_robin("0x08007000", "mks_robin_nano.ld", "Robin_nano35.bin")

+ 5
- 39
buildroot/share/PlatformIO/scripts/mks_robin_pro.py Dosyayı Görüntüle

@@ -1,39 +1,5 @@
1
-import os
2
-Import("env")
3
-
4
-# Relocate firmware from 0x08000000 to 0x08007000
5
-for define in env['CPPDEFINES']:
6
-    if define[0] == "VECT_TAB_ADDR":
7
-        env['CPPDEFINES'].remove(define)
8
-env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
9
-
10
-custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_pro.ld")
11
-for i, flag in enumerate(env["LINKFLAGS"]):
12
-    if "-Wl,-T" in flag:
13
-        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
14
-    elif flag == "-T":
15
-        env["LINKFLAGS"][i + 1] = custom_ld_script
16
-
17
-# Encrypt ${PROGNAME}.bin and save it as 'Robin.bin'
18
-def encrypt(source, target, env):
19
-    import sys
20
-
21
-    key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
22
-
23
-    firmware = open(target[0].path, "rb")
24
-    robin = open(target[0].dir.path +'/Robin_pro.bin', "wb")
25
-    length = os.path.getsize(target[0].path)
26
-    position = 0
27
-    try:
28
-        while position < length:
29
-            byte = firmware.read(1)
30
-            if position >= 320 and position < 31040:
31
-                byte = chr(ord(byte) ^ key[position & 31])
32
-                if sys.version_info[0] > 2:
33
-                    byte = bytes(byte, 'latin1')
34
-            robin.write(byte)
35
-            position += 1
36
-    finally:
37
-        firmware.close()
38
-        robin.close()
39
-env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);
1
+#
2
+# buildroot/share/PlatformIO/scripts/mks_robin_pro.py
3
+#
4
+import marlin
5
+marlin.prepare_robin("0x08007000", "mks_robin_pro.ld", "Robin_pro.bin")

+ 14
- 19
buildroot/share/PlatformIO/scripts/stm32_bootloader.py Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1 1
 #
2 2
 # stm32_bootloader.py
3 3
 #
4
-import os,sys,shutil
4
+import os,sys,shutil,marlin
5 5
 Import("env")
6 6
 
7 7
 from SCons.Script import DefaultEnvironment
@@ -11,35 +11,30 @@ board = DefaultEnvironment().BoardConfig()
11 11
 # Copy the firmware.bin file to build.firmware, no encryption
12 12
 #
13 13
 def noencrypt(source, target, env):
14
-  firmware = os.path.join(target[0].dir.path, board.get("build.firmware"))
15
-  shutil.copy(target[0].path, firmware)
14
+	firmware = os.path.join(target[0].dir.path, board.get("build.firmware"))
15
+	shutil.copy(target[0].path, firmware)
16 16
 
17 17
 #
18 18
 # For build.offset define LD_FLASH_OFFSET, used by ldscript.ld
19 19
 #
20 20
 if 'offset' in board.get("build").keys():
21
-  LD_FLASH_OFFSET = board.get("build.offset")
21
+	LD_FLASH_OFFSET = board.get("build.offset")
22 22
 
23
-  # Remove an existing VECT_TAB_OFFSET from CPPDEFINES
24
-  for define in env['CPPDEFINES']:
25
-    if define[0] == "VECT_TAB_OFFSET":
26
-      env['CPPDEFINES'].remove(define)
23
+	marlin.relocate_vtab(LD_FLASH_OFFSET)
27 24
 
28
-  # Replace VECT_TAB_OFFSET with our LD_FLASH_OFFSET
29
-  env['CPPDEFINES'].append(("VECT_TAB_OFFSET", LD_FLASH_OFFSET))
25
+	# Get upload.maximum_ram_size (defined by /buildroot/share/PlatformIO/boards/VARIOUS.json)
26
+	maximum_ram_size = board.get("upload.maximum_ram_size")
30 27
 
31
-  # Get upload.maximum_ram_size (defined by /buildroot/share/PlatformIO/boards/VARIOUS.json)
32
-  maximum_ram_size = board.get("upload.maximum_ram_size")
33
-
34
-  for i, flag in enumerate(env["LINKFLAGS"]):
35
-    if "-Wl,--defsym=LD_FLASH_OFFSET" in flag:
36
-      env["LINKFLAGS"][i] = "-Wl,--defsym=LD_FLASH_OFFSET=" + LD_FLASH_OFFSET
37
-    if "-Wl,--defsym=LD_MAX_DATA_SIZE" in flag:
38
-      env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40)
28
+	for i, flag in enumerate(env["LINKFLAGS"]):
29
+		if "-Wl,--defsym=LD_FLASH_OFFSET" in flag:
30
+			env["LINKFLAGS"][i] = "-Wl,--defsym=LD_FLASH_OFFSET=" + LD_FLASH_OFFSET
31
+		if "-Wl,--defsym=LD_MAX_DATA_SIZE" in flag:
32
+			env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40)
39 33
 
40 34
 #
41 35
 # Only copy the file if there's no encrypt
42 36
 #
43 37
 board_keys = board.get("build").keys()
44 38
 if 'firmware' in board_keys and not 'encrypt' in board_keys:
45
-  env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", noencrypt)
39
+	import marlin
40
+	marlin.add_post_action(noencrypt)

buildroot/share/PlatformIO/variants/archim/.gitignore → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/.gitignore Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/build_gcc/Makefile → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/build_gcc/Makefile Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/build_gcc/debug.mk → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/build_gcc/debug.mk Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/build_gcc/gcc.mk → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/build_gcc/gcc.mk Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/build_gcc/libvariant_arduino_due_x.mk → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/build_gcc/libvariant_arduino_due_x.mk Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/build_gcc/release.mk → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/build_gcc/release.mk Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/debug_scripts/gcc/arduino_due_x_flash.gdb → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/debug_scripts/gcc/arduino_due_x_flash.gdb Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/debug_scripts/gcc/arduino_due_x_sram.gdb → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/debug_scripts/gcc/arduino_due_x_sram.gdb Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/debug_scripts/iar/arduino_due_flash.mac → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/debug_scripts/iar/arduino_due_flash.mac Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/debug_scripts/iar/arduino_due_sram.mac → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/debug_scripts/iar/arduino_due_sram.mac Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/libsam_sam3x8e_gcc_rel.a → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/libsam_sam3x8e_gcc_rel.a Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/libsam_sam3x8e_gcc_rel.a.txt → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/libsam_sam3x8e_gcc_rel.a.txt Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/linker_scripts/gcc/flash.ld → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/linker_scripts/gcc/flash.ld Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/linker_scripts/gcc/sram.ld → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/linker_scripts/gcc/sram.ld Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/linker_scripts/iar/flash.icf → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/linker_scripts/iar/flash.icf Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/linker_scripts/iar/sram.icf → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/linker_scripts/iar/sram.icf Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/pins_arduino.h → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/pins_arduino.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/variant.cpp → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.cpp Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/archim/variant.h → buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/variant.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_BTT002/PeripheralPins.c → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/PeripheralPins.c Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_BTT002/PinNamesVar.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/PinNamesVar.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_BTT002/hal_conf_extra.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/hal_conf_extra.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_BTT002/ldscript.ld → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/ldscript.ld Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_BTT002/variant.cpp → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/variant.cpp Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_BTT002/variant.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/variant.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_E3_RRF/PeripheralPins.c → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/PeripheralPins.c Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_E3_RRF/PinNamesVar.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/PinNamesVar.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_E3_RRF/hal_conf_extra.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/hal_conf_extra.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_E3_RRF/ldscript.ld → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/ldscript.ld Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_E3_RRF/variant.cpp → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/variant.cpp Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_E3_RRF/variant.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/variant.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/PeripheralPins.c → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/PeripheralPins.c Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/PinNamesVar.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/PinNamesVar.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/hal_conf_extra.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/hal_conf_extra.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/ldscript.ld → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/ldscript.ld Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/variant.cpp → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/variant.cpp Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/variant.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/variant.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_SKR_PRO_1v1/PeripheralPins.c → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/PeripheralPins.c Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_SKR_PRO_1v1/PinNamesVar.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/PinNamesVar.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_SKR_PRO_1v1/hal_conf_extra.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/hal_conf_extra.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_SKR_PRO_1v1/ldscript.ld → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/ldscript.ld Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_SKR_PRO_1v1/variant.cpp → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/variant.cpp Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BIGTREE_SKR_PRO_1v1/variant.h → buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/variant.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/PeripheralPins.c → buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/PeripheralPins.c Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/PinNamesVar.h → buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/PinNamesVar.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/hal_conf_extra.h → buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/hal_conf_extra.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/ldscript.ld → buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/ldscript.ld Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/variant.cpp → buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/variant.cpp Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/variant.h → buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/variant.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/FLY_F407ZG/PeripheralPins.c → buildroot/share/PlatformIO/variants/MARLIN_FLY_F407ZG/PeripheralPins.c Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/FLY_F407ZG/PinNamesVar.h → buildroot/share/PlatformIO/variants/MARLIN_FLY_F407ZG/PinNamesVar.h Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/FLY_F407ZG/ldscript.ld → buildroot/share/PlatformIO/variants/MARLIN_FLY_F407ZG/ldscript.ld Dosyayı Görüntüle


buildroot/share/PlatformIO/variants/FLY_F407ZG/variant.cpp → buildroot/share/PlatformIO/variants/MARLIN_FLY_F407ZG/variant.cpp Dosyayı Görüntüle


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor

Loading…
İptal
Kaydet