소스 검색

USB FD via native USB Host + MSC (#20571)

Victor Oliveira 4 년 전
부모
커밋
84ab088b40
No account linked to committer's email address

+ 11
- 3
Marlin/Configuration_adv.h 파일 보기

@@ -1326,9 +1326,6 @@
1326 1326
    */
1327 1327
   //#define USB_FLASH_DRIVE_SUPPORT
1328 1328
   #if ENABLED(USB_FLASH_DRIVE_SUPPORT)
1329
-    #define USB_CS_PIN    SDSS
1330
-    #define USB_INTR_PIN  SD_DETECT_PIN
1331
-
1332 1329
     /**
1333 1330
      * USB Host Shield Library
1334 1331
      *
@@ -1339,7 +1336,18 @@
1339 1336
      *   is less tested and is known to interfere with Servos.
1340 1337
      *   [1] This requires USB_INTR_PIN to be interrupt-capable.
1341 1338
      */
1339
+    //#define USE_UHS2_USB
1342 1340
     //#define USE_UHS3_USB
1341
+
1342
+    /**
1343
+     * Native USB Host supported by some boards (USB OTG)
1344
+     */
1345
+    //#define USE_OTG_USB_HOST
1346
+
1347
+    #if DISABLED(USE_OTG_USB_HOST)
1348
+      #define USB_CS_PIN    SDSS
1349
+      #define USB_INTR_PIN  SD_DETECT_PIN
1350
+    #endif
1343 1351
   #endif
1344 1352
 
1345 1353
   /**

+ 117
- 0
Marlin/src/HAL/STM32/usb_host.cpp 파일 보기

@@ -0,0 +1,117 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
24
+
25
+#include "../../inc/MarlinConfig.h"
26
+
27
+#if BOTH(USE_OTG_USB_HOST, USBHOST)
28
+
29
+#include "usb_host.h"
30
+#include "../shared/Marduino.h"
31
+#include "usbh_core.h"
32
+#include "usbh_msc.h"
33
+
34
+USBH_HandleTypeDef hUsbHost;
35
+USBHost usb;
36
+BulkStorage bulk(&usb);
37
+
38
+static void USBH_UserProcess(USBH_HandleTypeDef *phost, uint8_t id) {
39
+  switch(id) {
40
+    case HOST_USER_SELECT_CONFIGURATION:
41
+      //SERIAL_ECHOLNPGM("APPLICATION_SELECT_CONFIGURATION");
42
+      break;
43
+    case HOST_USER_DISCONNECTION:
44
+      //SERIAL_ECHOLNPGM("APPLICATION_DISCONNECT");
45
+      //usb.setUsbTaskState(USB_STATE_RUNNING);
46
+      break;
47
+    case HOST_USER_CLASS_ACTIVE:
48
+      //SERIAL_ECHOLNPGM("APPLICATION_READY");
49
+      usb.setUsbTaskState(USB_STATE_RUNNING);
50
+      break;
51
+    case HOST_USER_CONNECTION:
52
+      break;
53
+    default:
54
+      break;
55
+  }
56
+}
57
+
58
+bool USBHost::start() {
59
+  if (USBH_Init(&hUsbHost, USBH_UserProcess, TERN(USE_USB_HS_IN_FS, HOST_HS, HOST_FS)) != USBH_OK) {
60
+    SERIAL_ECHOLNPGM("Error: USBH_Init");
61
+    return false;
62
+  }
63
+  if (USBH_RegisterClass(&hUsbHost, USBH_MSC_CLASS) != USBH_OK) {
64
+    SERIAL_ECHOLNPGM("Error: USBH_RegisterClass");
65
+    return false;
66
+  }
67
+  if (USBH_Start(&hUsbHost) != USBH_OK) {
68
+    SERIAL_ECHOLNPGM("Error: USBH_Start");
69
+    return false;
70
+  }
71
+  return true;
72
+}
73
+
74
+void USBHost::Task() {
75
+  USBH_Process(&hUsbHost);
76
+}
77
+
78
+uint8_t USBHost::getUsbTaskState() {
79
+  return usb_task_state;
80
+}
81
+
82
+void USBHost::setUsbTaskState(uint8_t state) {
83
+  usb_task_state = state;
84
+  if (usb_task_state == USB_STATE_RUNNING) {
85
+    MSC_LUNTypeDef info;
86
+    USBH_MSC_GetLUNInfo(&hUsbHost, usb.lun, &info);
87
+    capacity = info.capacity.block_nbr / 2000;
88
+    block_size = info.capacity.block_size;
89
+    block_count = info.capacity.block_nbr;
90
+    // SERIAL_ECHOLNPAIR("info.capacity.block_nbr : %ld\n", info.capacity.block_nbr);
91
+    // SERIAL_ECHOLNPAIR("info.capacity.block_size: %d\n", info.capacity.block_size);
92
+    // SERIAL_ECHOLNPAIR("capacity                : %d MB\n", capacity);
93
+  }
94
+};
95
+
96
+bool BulkStorage::LUNIsGood(uint8_t t) {
97
+  return USBH_MSC_IsReady(&hUsbHost) && USBH_MSC_UnitIsReady(&hUsbHost, t);
98
+}
99
+
100
+uint32_t BulkStorage::GetCapacity(uint8_t lun) {
101
+  return usb->block_count;
102
+}
103
+
104
+uint16_t BulkStorage::GetSectorSize(uint8_t lun) {
105
+  return usb->block_size;
106
+}
107
+
108
+uint8_t BulkStorage::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf) {
109
+  return USBH_MSC_Read(&hUsbHost, lun, addr, buf, blocks) != USBH_OK;
110
+}
111
+
112
+uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf) {
113
+  return USBH_MSC_Write(&hUsbHost, lun, addr, const_cast <uint8_t*>(buf), blocks) != USBH_OK;
114
+}
115
+
116
+#endif // USE_OTG_USB_HOST && USBHOST
117
+#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

+ 60
- 0
Marlin/src/HAL/STM32/usb_host.h 파일 보기

@@ -0,0 +1,60 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#include <stdint.h>
25
+
26
+typedef enum {
27
+  USB_STATE_INIT,
28
+  USB_STATE_ERROR,
29
+  USB_STATE_RUNNING,
30
+} usb_state_t;
31
+
32
+class USBHost {
33
+public:
34
+  bool start();
35
+  void Task();
36
+  uint8_t getUsbTaskState();
37
+  void setUsbTaskState(uint8_t state);
38
+  uint8_t regRd(uint8_t reg) { return 0x0; };
39
+  uint8_t usb_task_state = USB_STATE_INIT;
40
+  uint8_t lun = 0;
41
+  uint32_t capacity = 0;
42
+  uint16_t block_size = 0;
43
+  uint32_t block_count = 0;
44
+};
45
+
46
+class BulkStorage {
47
+public:
48
+  BulkStorage(USBHost *usb) : usb(usb) {};
49
+
50
+  bool LUNIsGood(uint8_t t);
51
+  uint32_t GetCapacity(uint8_t lun);
52
+  uint16_t GetSectorSize(uint8_t lun);
53
+  uint8_t Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf);
54
+  uint8_t Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf);
55
+
56
+  USBHost *usb;
57
+};
58
+
59
+extern USBHost usb;
60
+extern BulkStorage bulk;

+ 4
- 0
Marlin/src/inc/Conditionals_adv.h 파일 보기

@@ -386,6 +386,10 @@
386 386
   #define HOMING_BUMP_MM { 0, 0, 0 }
387 387
 #endif
388 388
 
389
+#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && NONE(USE_OTG_USB_HOST, USE_UHS3_USB)
390
+  #define USE_UHS2_USB
391
+#endif
392
+
389 393
 /**
390 394
  * Driver Timings (in nanoseconds)
391 395
  * NOTE: Driver timing order is longest-to-shortest duration.

+ 5
- 1
Marlin/src/inc/SanityCheck.h 파일 보기

@@ -2912,10 +2912,14 @@ static_assert(   _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
2912 2912
   #error "PRINTCOUNTER requires EEPROM_SETTINGS."
2913 2913
 #endif
2914 2914
 
2915
-#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !PINS_EXIST(USB_CS, USB_INTR)
2915
+#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !PINS_EXIST(USB_CS, USB_INTR) && DISABLED(USE_OTG_USB_HOST)
2916 2916
   #error "USB_CS_PIN and USB_INTR_PIN are required for USB_FLASH_DRIVE_SUPPORT."
2917 2917
 #endif
2918 2918
 
2919
+#if ENABLED(USE_OTG_USB_HOST) && !defined(HAS_OTG_USB_HOST_SUPPORT)
2920
+  #error "The current board does not support USE_OTG_USB_HOST."
2921
+#endif
2922
+
2919 2923
 #if ENABLED(SD_FIRMWARE_UPDATE) && !defined(__AVR_ATmega2560__)
2920 2924
   #error "SD_FIRMWARE_UPDATE requires an ATmega2560-based (Arduino Mega) board."
2921 2925
 #endif

+ 8
- 4
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h 파일 보기

@@ -53,6 +53,13 @@
53 53
 #define SPI_DEVICE                             2
54 54
 
55 55
 //
56
+// Servos
57
+//
58
+#ifndef SERVO0_PIN
59
+  #define SERVO0_PIN                        PA8   // Enable BLTOUCH support on IO0 (WIFI connector)
60
+#endif
61
+
62
+//
56 63
 // Limit Switches
57 64
 //
58 65
 #define X_STOP_PIN                          PA15
@@ -91,6 +98,7 @@
91 98
 #ifndef DEFAULT_PWM_MOTOR_CURRENT
92 99
   #define DEFAULT_PWM_MOTOR_CURRENT { 800, 800, 800 }
93 100
 #endif
101
+
94 102
 //
95 103
 // Temperature Sensors
96 104
 //
@@ -111,10 +119,6 @@
111 119
 #define POWER_LOSS_PIN                      PA2   // PW_DET
112 120
 #define PS_ON_PIN                           PA3   // PW_OFF
113 121
 
114
-#ifndef SERVO0_PIN
115
-  #define SERVO0_PIN                        PA8   // Enable BLTOUCH support on IO0 (WIFI connector)
116
-#endif
117
-
118 122
 #define MT_DET_1_PIN                        PA4
119 123
 #define MT_DET_PIN_INVERTING               false
120 124
 

+ 3
- 0
Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h 파일 보기

@@ -35,6 +35,9 @@
35 35
 #define I2C_EEPROM
36 36
 #define MARLIN_EEPROM_SIZE                0x2000  // 8KB (24C64 ... 64Kb = 8KB)
37 37
 
38
+// USB Flash Drive support
39
+#define HAS_OTG_USB_HOST_SUPPORT
40
+
38 41
 #define TP                                        // Enable to define servo and probe pins
39 42
 
40 43
 //

+ 3
- 0
Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h 파일 보기

@@ -44,6 +44,9 @@
44 44
   #define FLASH_EEPROM_LEVELING
45 45
 #endif
46 46
 
47
+// USB Flash Drive support
48
+#define HAS_OTG_USB_HOST_SUPPORT
49
+
47 50
 //
48 51
 // Servos
49 52
 //

+ 1
- 0
Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h 파일 보기

@@ -41,6 +41,7 @@
41 41
 //#define SRAM_EEPROM_EMULATION                   // Use BackSRAM-based EEPROM emulation
42 42
 //#define FLASH_EEPROM_EMULATION                  // Use Flash-based EEPROM emulation
43 43
 #define I2C_EEPROM
44
+#define MARLIN_EEPROM_SIZE                0x1000  // 4KB
44 45
 
45 46
 //
46 47
 // Release PB4 (Z_DIR_PIN) from JTAG NRST role

+ 4
- 0
Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h 파일 보기

@@ -36,6 +36,10 @@
36 36
 //#define SRAM_EEPROM_EMULATION                   // Use BackSRAM-based EEPROM emulation
37 37
 //#define FLASH_EEPROM_EMULATION                  // Use Flash-based EEPROM emulation
38 38
 #define I2C_EEPROM
39
+#define MARLIN_EEPROM_SIZE                0x1000  // 4KB
40
+
41
+// USB Flash Drive support
42
+#define HAS_OTG_USB_HOST_SUPPORT
39 43
 
40 44
 //
41 45
 // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role

+ 15
- 3
Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp 파일 보기

@@ -44,8 +44,9 @@
44 44
 #include "../../core/serial.h"
45 45
 #include "../../module/temperature.h"
46 46
 
47
-static_assert(USB_CS_PIN   != -1, "USB_CS_PIN must be defined");
48
-static_assert(USB_INTR_PIN != -1, "USB_INTR_PIN must be defined");
47
+#if DISABLED(USE_OTG_USB_HOST) && !PINS_EXIST(USB_CS, USB_INTR)
48
+  #error "USB_FLASH_DRIVE_SUPPORT requires USB_CS_PIN and USB_INTR_PIN to be defined."
49
+#endif
49 50
 
50 51
 #if ENABLED(USE_UHS3_USB)
51 52
   #define NO_AUTO_SPEED
@@ -81,6 +82,17 @@ static_assert(USB_INTR_PIN != -1, "USB_INTR_PIN must be defined");
81 82
 
82 83
   #define UHS_START  (usb.Init() == 0)
83 84
   #define UHS_STATE(state) UHS_USB_HOST_STATE_##state
85
+#elif ENABLED(USE_OTG_USB_HOST)
86
+
87
+  #if HAS_SD_HOST_DRIVE
88
+    #include HAL_PATH(../../HAL, msc_sd.h)
89
+  #endif
90
+
91
+  #include HAL_PATH(../../HAL, usb_host.h)
92
+
93
+  #define UHS_START usb.start()
94
+  #define rREVISION 0
95
+  #define UHS_STATE(state) USB_STATE_##state
84 96
 #else
85 97
   #include "lib-uhs2/Usb.h"
86 98
   #include "lib-uhs2/masstorage.h"
@@ -250,7 +262,7 @@ bool Sd2Card::isInserted() {
250 262
   return state == MEDIA_READY;
251 263
 }
252 264
 
253
-bool Sd2Card::ready() {
265
+bool Sd2Card::isReady() {
254 266
   return state > DO_STARTUP;
255 267
 }
256 268
 

+ 22
- 19
Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h 파일 보기

@@ -23,26 +23,27 @@
23 23
 
24 24
 /**
25 25
  * \file
26
- * \brief Sd2Card class for V2 SD/SDHC cards
26
+ * \brief Sd2Card class for USB Flash Drive
27 27
  */
28
-
29 28
 #include "../SdFatConfig.h"
30 29
 #include "../SdInfo.h"
31 30
 
32
-/**
33
- * Define SOFTWARE_SPI to use bit-bang SPI
34
- */
35
-#if EITHER(MEGA_SOFT_SPI, USE_SOFTWARE_SPI)
36
-  #define SOFTWARE_SPI
37
-#endif
31
+#if DISABLED(USE_OTG_USB_HOST)
32
+  /**
33
+   * Define SOFTWARE_SPI to use bit-bang SPI
34
+   */
35
+  #if EITHER(MEGA_SOFT_SPI, USE_SOFTWARE_SPI)
36
+    #define SOFTWARE_SPI
37
+  #endif
38 38
 
39
-// SPI pin definitions - do not edit here - change in SdFatConfig.h
40
-#if ENABLED(SOFTWARE_SPI)
41
-  #warning "Auto-assigning '10' as the SD_CHIP_SELECT_PIN."
42
-  #define SD_CHIP_SELECT_PIN  10                // Software SPI chip select pin for the SD
43
-#else
44
-  // hardware pin defs
45
-  #define SD_CHIP_SELECT_PIN  SS_PIN            // The default chip select pin for the SD card is SS.
39
+  // SPI pin definitions - do not edit here - change in SdFatConfig.h
40
+  #if ENABLED(SOFTWARE_SPI)
41
+    #warning "Auto-assigning '10' as the SD_CHIP_SELECT_PIN."
42
+    #define SD_CHIP_SELECT_PIN  10                // Software SPI chip select pin for the SD
43
+  #else
44
+    // hardware pin defs
45
+    #define SD_CHIP_SELECT_PIN  SS_PIN            // The default chip select pin for the SD card is SS.
46
+  #endif
46 47
 #endif
47 48
 
48 49
 class Sd2Card {
@@ -54,22 +55,24 @@ class Sd2Card {
54 55
   public:
55 56
     static bool usbStartup();
56 57
 
57
-    bool init(const uint8_t sckRateID=0, const pin_t chipSelectPin=SD_CHIP_SELECT_PIN);
58
+    bool init(const uint8_t sckRateID=0, const pin_t chipSelectPin=TERN(USE_OTG_USB_HOST, 0, SD_CHIP_SELECT_PIN));
58 59
 
59 60
     static void idle();
60 61
 
61
-    inline bool readStart(const uint32_t block)                  { pos = block; return ready(); }
62
+    inline bool readStart(const uint32_t block)                  { pos = block; return isReady(); }
62 63
     inline bool readData(uint8_t* dst)                           { return readBlock(pos++, dst); }
63 64
     inline bool readStop() const                                 { return true; }
64 65
 
65
-    inline bool writeStart(const uint32_t block, const uint32_t) { pos = block; return ready(); }
66
+    inline bool writeStart(const uint32_t block, const uint32_t) { pos = block; return isReady(); }
66 67
     inline bool writeData(uint8_t* src)                          { return writeBlock(pos++, src); }
67 68
     inline bool writeStop() const                                { return true; }
68 69
 
69 70
     bool readBlock(uint32_t block, uint8_t* dst);
70 71
     bool writeBlock(uint32_t blockNumber, const uint8_t* src);
71 72
 
73
+    bool readCSD(csd_t* csd) { return true; };
74
+
72 75
     uint32_t cardSize();
73 76
     static bool isInserted();
74
-    static bool ready();
77
+    bool isReady();
75 78
 };

+ 47
- 3
platformio.ini 파일 보기

@@ -59,7 +59,7 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
59 59
   -<src/lcd/extui/anycubic_i3mega_lcd.cpp> -<src/lcd/extui/lib/anycubic_i3mega>
60 60
   -<src/lcd/lcdprint.cpp>
61 61
   -<src/lcd/touch/touch_buttons.cpp>
62
-  -<src/sd/usb_flashdrive>
62
+  -<src/sd/usb_flashdrive/lib-uhs2> -<src/sd/usb_flashdrive/lib-uhs3>
63 63
   -<src/HAL/shared/backtrace>
64 64
   -<src/feature/babystep.cpp>
65 65
   -<src/feature/backlash.cpp>
@@ -272,7 +272,8 @@ HAS_DGUS_LCD            = src_filter=+<src/lcd/extui/lib/dgus> +<src/lcd/extui/d
272 272
 TOUCH_UI_FTDI_EVE       = src_filter=+<src/lcd/extui/lib/ftdi_eve_touch_ui>
273 273
 EXTUI_EXAMPLE           = src_filter=+<src/lcd/extui/example.cpp>
274 274
 MALYAN_LCD              = src_filter=+<src/lcd/extui/malyan_lcd.cpp>
275
-USB_FLASH_DRIVE_SUPPORT = src_filter=+<src/sd/usb_flashdrive>
275
+USE_UHS2_USB            = src_filter=+<src/sd/usb_flashdrive/lib-uhs2>
276
+USE_UHS3_USB            = src_filter=+<src/sd/usb_flashdrive/lib-uhs3>
276 277
 AUTO_BED_LEVELING_BILINEAR = src_filter=+<src/feature/bedlevel/abl>
277 278
 AUTO_BED_LEVELING_(3POINT|(BI)?LINEAR) = src_filter=+<src/gcode/bedlevel/abl>
278 279
 MESH_BED_LEVELING       = src_filter=+<src/feature/bedlevel/mbl> +<src/gcode/bedlevel/mbl>
@@ -1279,6 +1280,23 @@ debug_tool        = stlink
1279 1280
 debug_init_break  =
1280 1281
 
1281 1282
 #
1283
+# USB Flash Drive mix-ins for STM32
1284
+#
1285
+[stm32_flash_drive]
1286
+platform_packages = framework-arduinoststm32@https://github.com/rhapsodyv/Arduino_Core_STM32/archive/usb-host-msc.zip
1287
+build_flags       = ${common_stm32.build_flags}
1288
+  -DHAL_PCD_MODULE_ENABLED -DHAL_HCD_MODULE_ENABLED
1289
+  -DUSBHOST -DUSBH_IRQ_PRIO=3 -DUSBH_IRQ_SUBPRIO=4
1290
+
1291
+#
1292
+# BigTreeTech SKR Pro (STM32F407ZGT6 ARM Cortex-M4) with USB Flash Drive Support
1293
+#
1294
+[env:BIGTREE_SKR_PRO_usb_flash_drive]
1295
+extends           = env:BIGTREE_SKR_PRO
1296
+platform_packages = ${stm32_flash_drive.platform_packages}
1297
+build_flags       = ${stm32_flash_drive.build_flags}
1298
+
1299
+#
1282 1300
 # Bigtreetech GTR V1.0 (STM32F407IGT6 ARM Cortex-M4)
1283 1301
 #
1284 1302
 [env:BIGTREE_GTR_V1_0]
@@ -1291,6 +1309,14 @@ build_flags       = ${common_stm32.build_flags}
1291 1309
   -DSTM32F407IX -DVECT_TAB_OFFSET=0x8000
1292 1310
 
1293 1311
 #
1312
+# Bigtreetech GTR V1.0 (STM32F407IGT6 ARM Cortex-M4) with USB Flash Drive Support
1313
+#
1314
+[env:BIGTREE_GTR_V1_0_usb_flash_drive]
1315
+extends           = env:BIGTREE_GTR_V1_0
1316
+platform_packages = ${stm32_flash_drive.platform_packages}
1317
+build_flags       = ${stm32_flash_drive.build_flags}
1318
+
1319
+#
1294 1320
 # BigTreeTech BTT002 V1.0 (STM32F407VGT6 ARM Cortex-M4)
1295 1321
 #
1296 1322
 [env:BIGTREE_BTT002]
@@ -1392,13 +1418,16 @@ extra_scripts        = ${common.extra_scripts}
1392 1418
 #
1393 1419
 [env:mks_robin_pro2]
1394 1420
 platform             = ${common_stm32.platform}
1421
+platform_packages    = ${stm32_flash_drive.platform_packages}
1395 1422
 extends              = common_stm32
1396
-build_flags          = ${common_stm32.build_flags} -DHAL_HCD_MODULE_ENABLED -DUSBHOST
1423
+build_flags          = ${stm32_flash_drive.build_flags}
1397 1424
 board                = genericSTM32F407VET6
1398 1425
 board_build.core     = stm32
1399 1426
 board_build.variant  = MARLIN_F4x7Vx
1400 1427
 board_build.ldscript = ldscript.ld
1401 1428
 board_build.firmware = firmware.bin
1429
+board_build.offset   = 0x0000
1430
+board_upload.offset_address = 0x08000000
1402 1431
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
1403 1432
 debug_tool           = jlink
1404 1433
 upload_protocol      = jlink
@@ -1427,6 +1456,21 @@ extra_scripts        = ${common.extra_scripts}
1427 1456
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
1428 1457
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
1429 1458
 
1459
+#
1460
+# MKS Robin Nano V3 with USB Flash Drive Support
1461
+# Currently, using a STM32duino fork, until USB Host get merged
1462
+#
1463
+[env:mks_robin_nano_v3_usb_flash_drive]
1464
+extends           = env:mks_robin_nano_v3
1465
+platform_packages = ${stm32_flash_drive.platform_packages}
1466
+build_flags       = ${stm32_flash_drive.build_flags}
1467
+  -DUSBCON
1468
+  -DUSE_USBHOST_HS
1469
+  -DUSBD_IRQ_PRIO=5
1470
+  -DUSBD_IRQ_SUBPRIO=6
1471
+  -DUSE_USB_HS_IN_FS
1472
+  -DUSBD_USE_CDC
1473
+
1430 1474
 #################################
1431 1475
 #                               #
1432 1476
 #      Other Architectures      #

Loading…
취소
저장