浏览代码

✨ Add BOARD_CREALITY_V24S1_301F4

Co-Authored-By: Miguel Risco-Castillo <mriscoc@users.noreply.github.com>
Scott Lahteine 2 年前
父节点
当前提交
38f4d8abfc

+ 1
- 0
.github/workflows/test-builds.yml 查看文件

@@ -76,6 +76,7 @@ jobs:
76 76
         - STM32F103RE_btt
77 77
         - STM32F103RE_btt_USB
78 78
         - STM32F103RE_creality
79
+        - STM32F401RC_creality
79 80
         - STM32F103VE_longer
80 81
         - STM32F407VE_black
81 82
         - STM32F401VE_STEVAL

+ 1
- 0
Marlin/src/core/boards.h 查看文件

@@ -418,6 +418,7 @@
418 418
 #define BOARD_MKS_EAGLE               4237  // MKS Eagle (STM32F407VE)
419 419
 #define BOARD_ARTILLERY_RUBY          4238  // Artillery Ruby (STM32F401RC)
420 420
 #define BOARD_FYSETC_SPIDER_V2_2      4239  // FYSETC Spider V2.2 (STM32F446VE)
421
+#define BOARD_CREALITY_V24S1_301F4    4240  // Creality v2.4.S1_301F4 (STM32F401RC) as found in the Ender-3 S1 F4
421 422
 
422 423
 //
423 424
 // ARM Cortex M7

+ 1
- 1
Marlin/src/inc/Conditionals_LCD.h 查看文件

@@ -488,7 +488,7 @@
488 488
   #ifndef LCD_SERIAL_PORT
489 489
     #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_E3_TURBO)
490 490
       #define LCD_SERIAL_PORT 1
491
-    #elif MB(CREALITY_V24S1_301)
491
+    #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4)
492 492
       #define LCD_SERIAL_PORT 2 // Creality Ender3S1 board
493 493
     #else
494 494
       #define LCD_SERIAL_PORT 3 // Creality 4.x board

+ 1
- 1
Marlin/src/libs/BL24CXX.cpp 查看文件

@@ -48,7 +48,7 @@
48 48
 #ifdef __STM32F1__
49 49
   #define SDA_IN()  do{ PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH &= 0XFFFF0FFF; PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH |= 8 << 12; }while(0)
50 50
   #define SDA_OUT() do{ PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH &= 0XFFFF0FFF; PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH |= 3 << 12; }while(0)
51
-#elif STM32F1
51
+#elif defined(STM32F1) || defined(STM32F4)
52 52
   #define SDA_IN()  SET_INPUT(IIC_EEPROM_SDA)
53 53
   #define SDA_OUT() SET_OUTPUT(IIC_EEPROM_SDA)
54 54
 #endif

+ 2
- 0
Marlin/src/pins/pins.h 查看文件

@@ -695,6 +695,8 @@
695 695
   #include "stm32f4/pins_MKS_EAGLE.h"           // STM32F4                                env:mks_eagle
696 696
 #elif MB(ARTILLERY_RUBY)
697 697
   #include "stm32f4/pins_ARTILLERY_RUBY.h"      // STM32F4                                env:Artillery_Ruby
698
+#elif MB(CREALITY_V24S1_301F4)
699
+  #include "stm32f4/pins_CREALITY_V24S1_301F4.h" // STM32F4                               env:STM32F401RC_creality env:STM32F401RC_creality_jlink env:STM32F401RC_creality_stlink
698 700
 
699 701
 //
700 702
 // ARM Cortex M7

+ 7
- 1
Marlin/src/pins/stm32f1/env_validate.h 查看文件

@@ -22,5 +22,11 @@
22 22
 #pragma once
23 23
 
24 24
 #if NOT_TARGET(__STM32F1__, STM32F1)
25
-  #error "Oops! Select an STM32F1 board in 'Tools > Board.'"
25
+  #if DISABLED(ALLOW_STM32F4)
26
+    #error "Oops! Select an STM32F1 board in 'Tools > Board.'"
27
+  #elif NOT_TARGET(STM32F4)
28
+    #error "Oops! Select an STM32F4 board in 'Tools > Board.'"
29
+  #endif
26 30
 #endif
31
+
32
+#undef ALLOW_STM32F4

+ 14
- 8
Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h 查看文件

@@ -22,7 +22,8 @@
22 22
 #pragma once
23 23
 
24 24
 /**
25
- * Creality V24S1_301 (STM32F103RE / STM32F103RC) board pin assignments as found on Ender 3 S1
25
+ * Creality V24S1_301 (STM32F103RE / STM32F103RC) board pin assignments as found on Ender 3 S1.
26
+ * Also supports the STM32F4 version of the board with identical pin mapping.
26 27
  */
27 28
 
28 29
 #include "env_validate.h"
@@ -35,8 +36,12 @@
35 36
   #error "Disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN when using BLTOUCH with Creality V24S1-301."
36 37
 #endif
37 38
 
38
-#define BOARD_INFO_NAME      "Creality V24S1-301"
39
-#define DEFAULT_MACHINE_NAME "Ender 3 S1"
39
+#ifndef BOARD_INFO_NAME
40
+  #define BOARD_INFO_NAME      "Creality V24S1-301"
41
+#endif
42
+#ifndef DEFAULT_MACHINE_NAME
43
+  #define DEFAULT_MACHINE_NAME "Ender 3 S1"
44
+#endif
40 45
 
41 46
 //
42 47
 // Servos
@@ -70,8 +75,8 @@
70 75
 //
71 76
 // SD Card
72 77
 //
73
-#define ONBOARD_SPI_DEVICE                  1
74
-#define ONBOARD_SD_CS_PIN                   PA4  // SDSS
78
+#define ONBOARD_SPI_DEVICE                     1
79
+#define ONBOARD_SD_CS_PIN                   PA4   // SDSS
75 80
 
76 81
 //
77 82
 // M3/M4/M5 - Spindle/Laser Control
@@ -80,9 +85,10 @@
80 85
   //#define HEATER_0_PIN                    -1
81 86
   //#define HEATER_BED_PIN                  -1
82 87
   #define FAN_PIN                           -1
83
-  #define SPINDLE_LASER_ENA_PIN             PA0  // FET 1
84
-  #define SPINDLE_LASER_PWM_PIN             PA0  // Bed FET
85
-  #define SPINDLE_DIR_PIN                   PA0  // FET 4
88
+  #define SPINDLE_LASER_ENA_PIN             PC0   // FET 1
89
+  #define SPINDLE_LASER_PWM_PIN             PC0   // Bed FET
90
+  #define SPINDLE_DIR_PIN                   PC0   // FET 4
91
+  #define LASER_SOFT_PWM_PIN                PC0
86 92
 #endif
87 93
 
88 94
 #include "pins_CREALITY_V4.h"

+ 3
- 1
Marlin/src/pins/stm32f1/pins_CREALITY_V4.h 查看文件

@@ -43,7 +43,9 @@
43 43
 //
44 44
 // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
45 45
 //
46
-#define DISABLE_DEBUG
46
+#ifndef DISABLE_DEBUG
47
+  #define DISABLE_DEBUG
48
+#endif
47 49
 
48 50
 //
49 51
 // EEPROM

+ 38
- 0
Marlin/src/pins/stm32f4/pins_CREALITY_V24S1_301F4.h 查看文件

@@ -0,0 +1,38 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2022 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
+/**
25
+ * Creality V24S1_301F4 (STM32F401RC) board pin assignments as found on Ender 3 S1.
26
+ */
27
+
28
+#ifndef BOARD_INFO_NAME
29
+  #define BOARD_INFO_NAME "Creality V24S1-301F4"
30
+#endif
31
+#ifndef DEFAULT_MACHINE_NAME
32
+  #define DEFAULT_MACHINE_NAME "Ender-3 S1 F4"
33
+#endif
34
+
35
+#define DISABLE_DEBUG false // DISABLE_(DEBUG|JTAG) is not supported for STM32F4.
36
+#define ALLOW_STM32F4
37
+
38
+#include "../stm32f1/pins_CREALITY_V24S1_301.h"

+ 65
- 0
buildroot/share/PlatformIO/boards/marlin_CREALITY_STM32F401RC.json 查看文件

@@ -0,0 +1,65 @@
1
+{
2
+  "build": {
3
+    "core": "stm32",
4
+    "cpu": "cortex-m4",
5
+    "extra_flags": "-DSTM32F401xx",
6
+    "f_cpu": "84000000L",
7
+    "hwids": [
8
+      [
9
+        "0x1EAF",
10
+        "0x0003"
11
+      ],
12
+      [
13
+        "0x0483",
14
+        "0x3748"
15
+      ]
16
+    ],
17
+    "ldscript": "ldscript.ld",
18
+    "mcu": "stm32f401rct6",
19
+    "variant": "MARLIN_CREALITY_STM32F401RC"
20
+  },
21
+  "debug": {
22
+    "jlink_device": "STM32F401RC",
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": "STM32F401RC (64k RAM. 256k Flash)",
49
+  "upload": {
50
+    "disable_flushing": false,
51
+    "maximum_ram_size": 65536,
52
+    "maximum_size": 262144,
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/stm32f401rc.html",
64
+  "vendor": "Generic"
65
+}

+ 252
- 0
buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/PeripheralPins.c 查看文件

@@ -0,0 +1,252 @@
1
+/*
2
+ *******************************************************************************
3
+ * Copyright (c) 2019, STMicroelectronics
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ *    this list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ *    this list of conditions and the following disclaimer in the documentation
13
+ *    and/or other materials provided with the distribution.
14
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
15
+ *    may be used to endorse or promote products derived from this software
16
+ *    without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *******************************************************************************
29
+ * Automatically generated from STM32F401R[(B-C)|(D-E)]Tx.xml
30
+ */
31
+#include "Arduino.h"
32
+#include "PeripheralPins.h"
33
+
34
+/* =====
35
+ * Note: Commented lines are alternative possibilities which are not used per default.
36
+ *       If you change them, you will have to know what you do
37
+ * =====
38
+ */
39
+
40
+//*** ADC ***
41
+
42
+#ifdef HAL_ADC_MODULE_ENABLED
43
+WEAK const PinMap PinMap_ADC[] = {
44
+  {PA_0,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0
45
+  {PA_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1
46
+  {PA_2,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2
47
+  {PA_3,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3
48
+  {PA_4,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4
49
+  {PA_5,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5
50
+  {PA_6,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
51
+  {PA_7,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7
52
+  {PB_0,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
53
+  {PB_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
54
+  {PC_0,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10
55
+  {PC_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11
56
+  {PC_2,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12
57
+  {PC_3,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13
58
+  {PC_4,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14
59
+  {PC_5,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15
60
+  {NC,    NP,    0}
61
+};
62
+#endif
63
+
64
+//*** No DAC ***
65
+
66
+//*** I2C ***
67
+
68
+#ifdef HAL_I2C_MODULE_ENABLED
69
+WEAK const PinMap PinMap_I2C_SDA[] = {
70
+  {PB_3,  I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C2)},
71
+  {PB_4,  I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C3)},
72
+  {PB_7,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
73
+  {PB_9,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
74
+  {PC_9,  I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
75
+  {NC,    NP,    0}
76
+};
77
+
78
+WEAK const PinMap PinMap_I2C_SCL[] = {
79
+  {PA_8,  I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
80
+  {PB_6,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
81
+  {PB_8,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
82
+  {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
83
+  {NC,    NP,    0}
84
+};
85
+#endif
86
+
87
+//*** PWM ***
88
+
89
+#ifdef HAL_TIM_MODULE_ENABLED
90
+WEAK const PinMap PinMap_PWM[] = {
91
+  //{PA_0,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
92
+  {PA_0,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1
93
+  //{PA_1,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
94
+  {PA_1,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2
95
+  //{PA_2,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
96
+  {PA_2,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3
97
+  //{PA_2,  TIM9,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1
98
+  //{PA_3,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
99
+  {PA_3,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4
100
+  //{PA_3,  TIM9,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2
101
+  {PA_5,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
102
+  {PA_6,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
103
+  //{PA_7,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
104
+  {PA_7,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
105
+  {PA_8,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1
106
+  {PA_9,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2
107
+  {PA_10, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
108
+  {PA_11, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4
109
+  {PA_15, TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
110
+  //{PB_0,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
111
+  {PB_0,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3
112
+  //{PB_1,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
113
+  {PB_1,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
114
+  {PB_3,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
115
+  {PB_4,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
116
+  {PB_5,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
117
+  {PB_6,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1
118
+  {PB_7,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2
119
+  {PB_8,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3
120
+  //{PB_8,  TIM10,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1
121
+  {PB_9,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4
122
+  //{PB_9,  TIM11,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1
123
+  {PB_10, TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
124
+  {PB_13, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
125
+  {PB_14, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
126
+  {PB_15, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
127
+  {PC_6,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
128
+  {PC_7,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
129
+  {PC_8,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3
130
+  {PC_9,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
131
+  {NC,    NP,    0}
132
+};
133
+#endif
134
+
135
+//*** SERIAL ***
136
+
137
+#ifdef HAL_UART_MODULE_ENABLED
138
+WEAK const PinMap PinMap_UART_TX[] = {
139
+  {PA_2,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
140
+  {PA_9,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
141
+  {PA_11, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
142
+  {PB_6,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
143
+  {PC_6,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
144
+  {NC,    NP,    0}
145
+};
146
+
147
+WEAK const PinMap PinMap_UART_RX[] = {
148
+  {PA_3,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
149
+  {PA_10, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
150
+  {PA_12, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
151
+  {PB_7,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
152
+  {PC_7,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
153
+  {NC,    NP,    0}
154
+};
155
+
156
+WEAK const PinMap PinMap_UART_RTS[] = {
157
+  {PA_1,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
158
+  {PA_12, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
159
+  {NC,    NP,    0}
160
+};
161
+
162
+WEAK const PinMap PinMap_UART_CTS[] = {
163
+  {PA_0,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
164
+  {PA_11, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
165
+  {NC,    NP,    0}
166
+};
167
+#endif
168
+
169
+//*** SPI ***
170
+
171
+#ifdef HAL_SPI_MODULE_ENABLED
172
+WEAK const PinMap PinMap_SPI_MOSI[] = {
173
+  {PA_7,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
174
+  //{PB_5,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
175
+  {PB_5,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
176
+  {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
177
+  {PC_3,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
178
+  {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
179
+  {NC,    NP,    0}
180
+};
181
+
182
+WEAK const PinMap PinMap_SPI_MISO[] = {
183
+  {PA_6,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
184
+  //{PB_4,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
185
+  {PB_4,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
186
+  {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
187
+  {PC_2,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
188
+  {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
189
+  {NC,    NP,    0}
190
+};
191
+
192
+WEAK const PinMap PinMap_SPI_SCLK[] = {
193
+  {PA_5,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
194
+  //{PB_3,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
195
+  {PB_3,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
196
+  {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
197
+  {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
198
+  {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
199
+  {NC,    NP,    0}
200
+};
201
+
202
+WEAK const PinMap PinMap_SPI_SSEL[] = {
203
+  {PA_4,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
204
+  //{PA_4,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
205
+  //{PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
206
+  {PA_15, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
207
+  {PB_9,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
208
+  {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
209
+  {NC,    NP,    0}
210
+};
211
+#endif
212
+
213
+//*** No CAN ***
214
+
215
+//*** No ETHERNET ***
216
+
217
+//*** No QUADSPI ***
218
+
219
+//*** USB ***
220
+
221
+#ifdef HAL_PCD_MODULE_ENABLED
222
+WEAK const PinMap PinMap_USB_OTG_FS[] = {
223
+#ifndef ARDUINO_CoreBoard_F401RC
224
+  {PA_8,  USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF
225
+  {PA_9,  USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS
226
+  {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID
227
+#endif
228
+  {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM
229
+  {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP
230
+  {NC,    NP,    0}
231
+};
232
+#endif
233
+
234
+//*** No USB_OTG_HS ***
235
+
236
+//*** SD ***
237
+
238
+#ifdef HAL_SD_MODULE_ENABLED
239
+WEAK const PinMap PinMap_SD[] = {
240
+  {PB_8,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D4
241
+  {PB_9,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D5
242
+  {PC_6,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D6
243
+  {PC_7,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D7
244
+  {PC_8,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D0
245
+  {PC_9,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D1
246
+  {PC_10, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D2
247
+  {PC_11, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D3
248
+  {PC_12, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CK
249
+  {PD_2,  SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CMD
250
+  {NC,    NP,    0}
251
+};
252
+#endif

+ 33
- 0
buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/PinNamesVar.h 查看文件

@@ -0,0 +1,33 @@
1
+/* SYS_WKUP */
2
+#ifdef PWR_WAKEUP_PIN1
3
+  SYS_WKUP1 = PA_0,
4
+#endif
5
+#ifdef PWR_WAKEUP_PIN2
6
+  SYS_WKUP2 = NC,
7
+#endif
8
+#ifdef PWR_WAKEUP_PIN3
9
+  SYS_WKUP3 = NC,
10
+#endif
11
+#ifdef PWR_WAKEUP_PIN4
12
+  SYS_WKUP4 = NC,
13
+#endif
14
+#ifdef PWR_WAKEUP_PIN5
15
+  SYS_WKUP5 = NC,
16
+#endif
17
+#ifdef PWR_WAKEUP_PIN6
18
+  SYS_WKUP6 = NC,
19
+#endif
20
+#ifdef PWR_WAKEUP_PIN7
21
+  SYS_WKUP7 = NC,
22
+#endif
23
+#ifdef PWR_WAKEUP_PIN8
24
+  SYS_WKUP8 = NC,
25
+#endif
26
+/* USB */
27
+#ifdef USBCON
28
+  USB_OTG_FS_SOF = PA_8,
29
+  USB_OTG_FS_VBUS = PA_9,
30
+  USB_OTG_FS_ID = PA_10,
31
+  USB_OTG_FS_DM = PA_11,
32
+  USB_OTG_FS_DP = PA_12,
33
+#endif

+ 495
- 0
buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/hal_conf_custom.h 查看文件

@@ -0,0 +1,495 @@
1
+/**
2
+  ******************************************************************************
3
+  * @file    stm32f4xx_hal_conf.h
4
+  * @brief   HAL configuration file.
5
+  ******************************************************************************
6
+  * @attention
7
+  *
8
+  * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
9
+  * All rights reserved.</center></h2>
10
+  *
11
+  * This software component is licensed by ST under BSD 3-Clause license,
12
+  * the "License"; You may not use this file except in compliance with the
13
+  * License. You may obtain a copy of the License at:
14
+  *                        opensource.org/licenses/BSD-3-Clause
15
+  *
16
+  ******************************************************************************
17
+  */
18
+
19
+/* Define to prevent recursive inclusion -------------------------------------*/
20
+#ifndef __STM32F4xx_HAL_CONF_CUSTOM
21
+#define __STM32F4xx_HAL_CONF_CUSTOM
22
+
23
+#ifdef __cplusplus
24
+extern "C" {
25
+#endif
26
+
27
+/* Exported types ------------------------------------------------------------*/
28
+/* Exported constants --------------------------------------------------------*/
29
+
30
+/* ########################## Module Selection ############################## */
31
+ /**
32
+  * @brief This is the list of modules to be used in the HAL driver
33
+  */
34
+#define HAL_MODULE_ENABLED
35
+#define HAL_ADC_MODULE_ENABLED
36
+#define HAL_CRC_MODULE_ENABLED
37
+#define HAL_DMA_MODULE_ENABLED
38
+#define HAL_FLASH_MODULE_ENABLED
39
+#define HAL_GPIO_MODULE_ENABLED
40
+#define HAL_I2C_MODULE_ENABLED
41
+#define HAL_IWDG_MODULE_ENABLED
42
+#define HAL_PWR_MODULE_ENABLED
43
+#define HAL_RCC_MODULE_ENABLED
44
+#define HAL_RTC_MODULE_ENABLED
45
+#define HAL_SPI_MODULE_ENABLED
46
+#define HAL_TIM_MODULE_ENABLED
47
+#define HAL_CORTEX_MODULE_ENABLED
48
+//#define HAL_PCD_MODULE_ENABLED // Automatically added if any type of USB is enabled, as in Arduino IDE. (STM32 v3.10700.191028)
49
+
50
+//#define HAL_CAN_MODULE_ENABLED
51
+//#define HAL_CAN_LEGACY_MODULE_ENABLED
52
+//#define HAL_CEC_MODULE_ENABLED
53
+//#define HAL_CRYP_MODULE_ENABLED
54
+//#define HAL_DAC_MODULE_ENABLED
55
+//#define HAL_DCMI_MODULE_ENABLED
56
+//#define HAL_DMA2D_MODULE_ENABLED
57
+//#define HAL_ETH_MODULE_ENABLED
58
+//#define HAL_NAND_MODULE_ENABLED
59
+//#define HAL_NOR_MODULE_ENABLED
60
+//#define HAL_PCCARD_MODULE_ENABLED
61
+//#define HAL_SRAM_MODULE_ENABLED
62
+//#define HAL_SDRAM_MODULE_ENABLED
63
+//#define HAL_HASH_MODULE_ENABLED
64
+//#define HAL_EXTI_MODULE_ENABLED
65
+//#define HAL_SMBUS_MODULE_ENABLED
66
+//#define HAL_I2S_MODULE_ENABLED
67
+//#define HAL_LTDC_MODULE_ENABLED
68
+//#define HAL_DSI_MODULE_ENABLED
69
+//#define HAL_QSPI_MODULE_ENABLED
70
+//#define HAL_RNG_MODULE_ENABLED
71
+//#define HAL_SAI_MODULE_ENABLED
72
+#define HAL_SD_MODULE_ENABLED
73
+//#define HAL_UART_MODULE_ENABLED
74
+//#define HAL_USART_MODULE_ENABLED
75
+//#define HAL_IRDA_MODULE_ENABLED
76
+//#define HAL_SMARTCARD_MODULE_ENABLED
77
+//#define HAL_WWDG_MODULE_ENABLED
78
+//#define HAL_HCD_MODULE_ENABLED
79
+//#define HAL_FMPI2C_MODULE_ENABLED
80
+//#define HAL_SPDIFRX_MODULE_ENABLED
81
+//#define HAL_DFSDM_MODULE_ENABLED
82
+//#define HAL_LPTIM_MODULE_ENABLED
83
+//#define HAL_MMC_MODULE_ENABLED
84
+
85
+/* ########################## HSE/HSI Values adaptation ##################### */
86
+/**
87
+  * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
88
+  *        This value is used by the RCC HAL module to compute the system frequency
89
+  *        (when HSE is used as system clock source, directly or through the PLL).
90
+  */
91
+#ifndef HSE_VALUE
92
+#define HSE_VALUE              8000000U /*!< Value of the External oscillator in Hz */
93
+#endif /* HSE_VALUE */
94
+
95
+#ifndef HSE_STARTUP_TIMEOUT
96
+#define HSE_STARTUP_TIMEOUT    100U      /*!< Time out for HSE start up, in ms */
97
+#endif /* HSE_STARTUP_TIMEOUT */
98
+
99
+/**
100
+  * @brief Internal High Speed oscillator (HSI) value.
101
+  *        This value is used by the RCC HAL module to compute the system frequency
102
+  *        (when HSI is used as system clock source, directly or through the PLL).
103
+  */
104
+#ifndef HSI_VALUE
105
+#define HSI_VALUE              16000000U /*!< Value of the Internal oscillator in Hz */
106
+#endif /* HSI_VALUE */
107
+
108
+/**
109
+  * @brief Internal Low Speed oscillator (LSI) value.
110
+  */
111
+#ifndef LSI_VALUE
112
+#define LSI_VALUE               32000U    /*!< LSI Typical Value in Hz */
113
+#endif /* LSI_VALUE */                      /*!< Value of the Internal Low Speed oscillator in Hz
114
+The real value may vary depending on the variations
115
+in voltage and temperature. */
116
+/**
117
+  * @brief External Low Speed oscillator (LSE) value.
118
+  */
119
+#ifndef LSE_VALUE
120
+#define LSE_VALUE               32768U    /*!< Value of the External Low Speed oscillator in Hz */
121
+#endif /* LSE_VALUE */
122
+
123
+#ifndef LSE_STARTUP_TIMEOUT
124
+#define LSE_STARTUP_TIMEOUT    5000U     /*!< Time out for LSE start up, in ms */
125
+#endif /* LSE_STARTUP_TIMEOUT */
126
+
127
+/**
128
+  * @brief External clock source for I2S peripheral
129
+  *        This value is used by the I2S HAL module to compute the I2S clock source
130
+  *        frequency, this source is inserted directly through I2S_CKIN pad.
131
+  */
132
+#ifndef EXTERNAL_CLOCK_VALUE
133
+#define EXTERNAL_CLOCK_VALUE     12288000U /*!< Value of the External oscillator in Hz*/
134
+#endif /* EXTERNAL_CLOCK_VALUE */
135
+
136
+/* Tip: To avoid modifying this file each time you need to use different HSE,
137
+   ===  you can define the HSE value in your toolchain compiler preprocessor. */
138
+
139
+/* ########################### System Configuration ######################### */
140
+/**
141
+  * @brief This is the HAL system configuration section
142
+  */
143
+#if !defined (VDD_VALUE)
144
+#define  VDD_VALUE                    3300U /*!< Value of VDD in mv */
145
+#endif
146
+#if !defined (TICK_INT_PRIORITY)
147
+#define  TICK_INT_PRIORITY            0x00U /*!< tick interrupt priority */
148
+#endif
149
+#if !defined (USE_RTOS)
150
+#define  USE_RTOS                     0U
151
+#endif
152
+#if !defined (PREFETCH_ENABLE)
153
+#define  PREFETCH_ENABLE              1U
154
+#endif
155
+#if !defined (INSTRUCTION_CACHE_ENABLE)
156
+#define  INSTRUCTION_CACHE_ENABLE     1U
157
+#endif
158
+#if !defined (DATA_CACHE_ENABLE)
159
+#define  DATA_CACHE_ENABLE            1U
160
+#endif
161
+
162
+#define  USE_HAL_ADC_REGISTER_CALLBACKS         0U /* ADC register callback disabled       */
163
+#define  USE_HAL_CAN_REGISTER_CALLBACKS         0U /* CAN register callback disabled       */
164
+#define  USE_HAL_CEC_REGISTER_CALLBACKS         0U /* CEC register callback disabled       */
165
+#define  USE_HAL_CRYP_REGISTER_CALLBACKS        0U /* CRYP register callback disabled      */
166
+#define  USE_HAL_DAC_REGISTER_CALLBACKS         0U /* DAC register callback disabled       */
167
+#define  USE_HAL_DCMI_REGISTER_CALLBACKS        0U /* DCMI register callback disabled      */
168
+#define  USE_HAL_DFSDM_REGISTER_CALLBACKS       0U /* DFSDM register callback disabled     */
169
+#define  USE_HAL_DMA2D_REGISTER_CALLBACKS       0U /* DMA2D register callback disabled     */
170
+#define  USE_HAL_DSI_REGISTER_CALLBACKS         0U /* DSI register callback disabled       */
171
+#define  USE_HAL_ETH_REGISTER_CALLBACKS         0U /* ETH register callback disabled       */
172
+#define  USE_HAL_HASH_REGISTER_CALLBACKS        0U /* HASH register callback disabled      */
173
+#define  USE_HAL_HCD_REGISTER_CALLBACKS         0U /* HCD register callback disabled       */
174
+#define  USE_HAL_I2C_REGISTER_CALLBACKS         0U /* I2C register callback disabled       */
175
+#define  USE_HAL_FMPI2C_REGISTER_CALLBACKS      0U /* FMPI2C register callback disabled    */
176
+#define  USE_HAL_I2S_REGISTER_CALLBACKS         0U /* I2S register callback disabled       */
177
+#define  USE_HAL_IRDA_REGISTER_CALLBACKS        0U /* IRDA register callback disabled      */
178
+#define  USE_HAL_LPTIM_REGISTER_CALLBACKS       0U /* LPTIM register callback disabled     */
179
+#define  USE_HAL_LTDC_REGISTER_CALLBACKS        0U /* LTDC register callback disabled      */
180
+#define  USE_HAL_MMC_REGISTER_CALLBACKS         0U /* MMC register callback disabled       */
181
+#define  USE_HAL_NAND_REGISTER_CALLBACKS        0U /* NAND register callback disabled      */
182
+#define  USE_HAL_NOR_REGISTER_CALLBACKS         0U /* NOR register callback disabled       */
183
+#define  USE_HAL_PCCARD_REGISTER_CALLBACKS      0U /* PCCARD register callback disabled    */
184
+#define  USE_HAL_PCD_REGISTER_CALLBACKS         0U /* PCD register callback disabled       */
185
+#define  USE_HAL_QSPI_REGISTER_CALLBACKS        0U /* QSPI register callback disabled      */
186
+#define  USE_HAL_RNG_REGISTER_CALLBACKS         0U /* RNG register callback disabled       */
187
+#define  USE_HAL_RTC_REGISTER_CALLBACKS         0U /* RTC register callback disabled       */
188
+#define  USE_HAL_SAI_REGISTER_CALLBACKS         0U /* SAI register callback disabled       */
189
+#define  USE_HAL_SD_REGISTER_CALLBACKS          0U /* SD register callback disabled        */
190
+#define  USE_HAL_SMARTCARD_REGISTER_CALLBACKS   0U /* SMARTCARD register callback disabled */
191
+#define  USE_HAL_SDRAM_REGISTER_CALLBACKS       0U /* SDRAM register callback disabled     */
192
+#define  USE_HAL_SRAM_REGISTER_CALLBACKS        0U /* SRAM register callback disabled      */
193
+#define  USE_HAL_SPDIFRX_REGISTER_CALLBACKS     0U /* SPDIFRX register callback disabled   */
194
+#define  USE_HAL_SMBUS_REGISTER_CALLBACKS       0U /* SMBUS register callback disabled     */
195
+#define  USE_HAL_SPI_REGISTER_CALLBACKS         0U /* SPI register callback disabled       */
196
+#define  USE_HAL_TIM_REGISTER_CALLBACKS         0U /* TIM register callback disabled       */
197
+#define  USE_HAL_UART_REGISTER_CALLBACKS        0U /* UART register callback disabled      */
198
+#define  USE_HAL_USART_REGISTER_CALLBACKS       0U /* USART register callback disabled     */
199
+#define  USE_HAL_WWDG_REGISTER_CALLBACKS        0U /* WWDG register callback disabled      */
200
+
201
+/* ########################## Assert Selection ############################## */
202
+/**
203
+  * @brief Uncomment the line below to expanse the "assert_param" macro in the
204
+  *        HAL drivers code
205
+  */
206
+/* #define USE_FULL_ASSERT    1U */
207
+
208
+/* ################## Ethernet peripheral configuration ##################### */
209
+
210
+/* Section 1 : Ethernet peripheral configuration */
211
+
212
+/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
213
+#define MAC_ADDR0   2U
214
+#define MAC_ADDR1   0U
215
+#define MAC_ADDR2   0U
216
+#define MAC_ADDR3   0U
217
+#define MAC_ADDR4   0U
218
+#define MAC_ADDR5   0U
219
+
220
+/* Definition of the Ethernet driver buffers size and count */
221
+#define ETH_RX_BUF_SIZE                ETH_MAX_PACKET_SIZE /* buffer size for receive               */
222
+#define ETH_TX_BUF_SIZE                ETH_MAX_PACKET_SIZE /* buffer size for transmit              */
223
+#define ETH_RXBUFNB                    ((uint32_t)4U)       /* 4 Rx buffers of size ETH_RX_BUF_SIZE  */
224
+#define ETH_TXBUFNB                    ((uint32_t)4U)       /* 4 Tx buffers of size ETH_TX_BUF_SIZE  */
225
+
226
+/* Section 2: PHY configuration section */
227
+
228
+/* DP83848_PHY_ADDRESS Address*/
229
+#define DP83848_PHY_ADDRESS           0x01U
230
+/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
231
+#define PHY_RESET_DELAY                 0x000000FFU
232
+/* PHY Configuration delay */
233
+#define PHY_CONFIG_DELAY                0x00000FFFU
234
+
235
+#define PHY_READ_TO                     0x0000FFFFU
236
+#define PHY_WRITE_TO                    0x0000FFFFU
237
+
238
+/* Section 3: Common PHY Registers */
239
+
240
+#define PHY_BCR                         ((uint16_t)0x0000)  /*!< Transceiver Basic Control Register   */
241
+#define PHY_BSR                         ((uint16_t)0x0001)  /*!< Transceiver Basic Status Register    */
242
+
243
+#define PHY_RESET                       ((uint16_t)0x8000)  /*!< PHY Reset */
244
+#define PHY_LOOPBACK                    ((uint16_t)0x4000)  /*!< Select loop-back mode */
245
+#define PHY_FULLDUPLEX_100M             ((uint16_t)0x2100)  /*!< Set the full-duplex mode at 100 Mb/s */
246
+#define PHY_HALFDUPLEX_100M             ((uint16_t)0x2000)  /*!< Set the half-duplex mode at 100 Mb/s */
247
+#define PHY_FULLDUPLEX_10M              ((uint16_t)0x0100)  /*!< Set the full-duplex mode at 10 Mb/s  */
248
+#define PHY_HALFDUPLEX_10M              ((uint16_t)0x0000)  /*!< Set the half-duplex mode at 10 Mb/s  */
249
+#define PHY_AUTONEGOTIATION             ((uint16_t)0x1000)  /*!< Enable auto-negotiation function     */
250
+#define PHY_RESTART_AUTONEGOTIATION     ((uint16_t)0x0200)  /*!< Restart auto-negotiation function    */
251
+#define PHY_POWERDOWN                   ((uint16_t)0x0800)  /*!< Select the power down mode           */
252
+#define PHY_ISOLATE                     ((uint16_t)0x0400)  /*!< Isolate PHY from MII                 */
253
+
254
+#define PHY_AUTONEGO_COMPLETE           ((uint16_t)0x0020)  /*!< Auto-Negotiation process completed   */
255
+#define PHY_LINKED_STATUS               ((uint16_t)0x0004)  /*!< Valid link established               */
256
+#define PHY_JABBER_DETECTION            ((uint16_t)0x0002)  /*!< Jabber condition detected            */
257
+
258
+/* Section 4: Extended PHY Registers */
259
+#define PHY_SR                          ((uint16_t)0x10U)    /*!< PHY status register Offset                      */
260
+
261
+#define PHY_SPEED_STATUS                ((uint16_t)0x0002U)  /*!< PHY Speed mask                                  */
262
+#define PHY_DUPLEX_STATUS               ((uint16_t)0x0004U)  /*!< PHY Duplex mask                                 */
263
+
264
+/* ################## SPI peripheral configuration ########################## */
265
+
266
+/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
267
+ * Activated: CRC code is present inside driver
268
+ * Deactivated: CRC code cleaned from driver
269
+ */
270
+#ifndef USE_SPI_CRC
271
+#define USE_SPI_CRC                     0U
272
+#endif
273
+
274
+/* Includes ------------------------------------------------------------------*/
275
+/**
276
+  * @brief Include module's header file
277
+  */
278
+
279
+#ifdef HAL_RCC_MODULE_ENABLED
280
+#include "stm32f4xx_hal_rcc.h"
281
+#endif /* HAL_RCC_MODULE_ENABLED */
282
+
283
+#ifdef HAL_GPIO_MODULE_ENABLED
284
+#include "stm32f4xx_hal_gpio.h"
285
+#endif /* HAL_GPIO_MODULE_ENABLED */
286
+
287
+#ifdef HAL_EXTI_MODULE_ENABLED
288
+#include "stm32f4xx_hal_exti.h"
289
+#endif /* HAL_EXTI_MODULE_ENABLED */
290
+
291
+#ifdef HAL_DMA_MODULE_ENABLED
292
+#include "stm32f4xx_hal_dma.h"
293
+#endif /* HAL_DMA_MODULE_ENABLED */
294
+
295
+#ifdef HAL_CORTEX_MODULE_ENABLED
296
+#include "stm32f4xx_hal_cortex.h"
297
+#endif /* HAL_CORTEX_MODULE_ENABLED */
298
+
299
+#ifdef HAL_ADC_MODULE_ENABLED
300
+#include "stm32f4xx_hal_adc.h"
301
+#endif /* HAL_ADC_MODULE_ENABLED */
302
+
303
+#ifdef HAL_CAN_MODULE_ENABLED
304
+#include "stm32f4xx_hal_can.h"
305
+#endif /* HAL_CAN_MODULE_ENABLED */
306
+
307
+#ifdef HAL_CAN_LEGACY_MODULE_ENABLED
308
+#include "stm32f4xx_hal_can_legacy.h"
309
+#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */
310
+
311
+#ifdef HAL_CRC_MODULE_ENABLED
312
+#include "stm32f4xx_hal_crc.h"
313
+#endif /* HAL_CRC_MODULE_ENABLED */
314
+
315
+#ifdef HAL_CRYP_MODULE_ENABLED
316
+#include "stm32f4xx_hal_cryp.h"
317
+#endif /* HAL_CRYP_MODULE_ENABLED */
318
+
319
+#ifdef HAL_DMA2D_MODULE_ENABLED
320
+#include "stm32f4xx_hal_dma2d.h"
321
+#endif /* HAL_DMA2D_MODULE_ENABLED */
322
+
323
+#ifdef HAL_DAC_MODULE_ENABLED
324
+#include "stm32f4xx_hal_dac.h"
325
+#endif /* HAL_DAC_MODULE_ENABLED */
326
+
327
+#ifdef HAL_DCMI_MODULE_ENABLED
328
+#include "stm32f4xx_hal_dcmi.h"
329
+#endif /* HAL_DCMI_MODULE_ENABLED */
330
+
331
+#ifdef HAL_ETH_MODULE_ENABLED
332
+#include "stm32f4xx_hal_eth.h"
333
+#endif /* HAL_ETH_MODULE_ENABLED */
334
+
335
+#ifdef HAL_FLASH_MODULE_ENABLED
336
+#include "stm32f4xx_hal_flash.h"
337
+#endif /* HAL_FLASH_MODULE_ENABLED */
338
+
339
+#ifdef HAL_SRAM_MODULE_ENABLED
340
+#include "stm32f4xx_hal_sram.h"
341
+#endif /* HAL_SRAM_MODULE_ENABLED */
342
+
343
+#ifdef HAL_NOR_MODULE_ENABLED
344
+#include "stm32f4xx_hal_nor.h"
345
+#endif /* HAL_NOR_MODULE_ENABLED */
346
+
347
+#ifdef HAL_NAND_MODULE_ENABLED
348
+#include "stm32f4xx_hal_nand.h"
349
+#endif /* HAL_NAND_MODULE_ENABLED */
350
+
351
+#ifdef HAL_PCCARD_MODULE_ENABLED
352
+#include "stm32f4xx_hal_pccard.h"
353
+#endif /* HAL_PCCARD_MODULE_ENABLED */
354
+
355
+#ifdef HAL_SDRAM_MODULE_ENABLED
356
+#include "stm32f4xx_hal_sdram.h"
357
+#endif /* HAL_SDRAM_MODULE_ENABLED */
358
+
359
+#ifdef HAL_HASH_MODULE_ENABLED
360
+#include "stm32f4xx_hal_hash.h"
361
+#endif /* HAL_HASH_MODULE_ENABLED */
362
+
363
+#ifdef HAL_I2C_MODULE_ENABLED
364
+#include "stm32f4xx_hal_i2c.h"
365
+#endif /* HAL_I2C_MODULE_ENABLED */
366
+
367
+#ifdef HAL_SMBUS_MODULE_ENABLED
368
+#include "stm32f4xx_hal_smbus.h"
369
+#endif /* HAL_SMBUS_MODULE_ENABLED */
370
+
371
+#ifdef HAL_I2S_MODULE_ENABLED
372
+#include "stm32f4xx_hal_i2s.h"
373
+#endif /* HAL_I2S_MODULE_ENABLED */
374
+
375
+#ifdef HAL_IWDG_MODULE_ENABLED
376
+#include "stm32f4xx_hal_iwdg.h"
377
+#endif /* HAL_IWDG_MODULE_ENABLED */
378
+
379
+#ifdef HAL_LTDC_MODULE_ENABLED
380
+#include "stm32f4xx_hal_ltdc.h"
381
+#endif /* HAL_LTDC_MODULE_ENABLED */
382
+
383
+#ifdef HAL_PWR_MODULE_ENABLED
384
+#include "stm32f4xx_hal_pwr.h"
385
+#endif /* HAL_PWR_MODULE_ENABLED */
386
+
387
+#ifdef HAL_RNG_MODULE_ENABLED
388
+#include "stm32f4xx_hal_rng.h"
389
+#endif /* HAL_RNG_MODULE_ENABLED */
390
+
391
+#ifdef HAL_RTC_MODULE_ENABLED
392
+#include "stm32f4xx_hal_rtc.h"
393
+#endif /* HAL_RTC_MODULE_ENABLED */
394
+
395
+#ifdef HAL_SAI_MODULE_ENABLED
396
+#include "stm32f4xx_hal_sai.h"
397
+#endif /* HAL_SAI_MODULE_ENABLED */
398
+
399
+#ifdef HAL_SD_MODULE_ENABLED
400
+#include "stm32f4xx_hal_sd.h"
401
+#endif /* HAL_SD_MODULE_ENABLED */
402
+
403
+#ifdef HAL_SPI_MODULE_ENABLED
404
+#include "stm32f4xx_hal_spi.h"
405
+#endif /* HAL_SPI_MODULE_ENABLED */
406
+
407
+#ifdef HAL_TIM_MODULE_ENABLED
408
+#include "stm32f4xx_hal_tim.h"
409
+#endif /* HAL_TIM_MODULE_ENABLED */
410
+
411
+#ifdef HAL_UART_MODULE_ENABLED
412
+#include "stm32f4xx_hal_uart.h"
413
+#endif /* HAL_UART_MODULE_ENABLED */
414
+
415
+#ifdef HAL_USART_MODULE_ENABLED
416
+#include "stm32f4xx_hal_usart.h"
417
+#endif /* HAL_USART_MODULE_ENABLED */
418
+
419
+#ifdef HAL_IRDA_MODULE_ENABLED
420
+#include "stm32f4xx_hal_irda.h"
421
+#endif /* HAL_IRDA_MODULE_ENABLED */
422
+
423
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
424
+#include "stm32f4xx_hal_smartcard.h"
425
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
426
+
427
+#ifdef HAL_WWDG_MODULE_ENABLED
428
+#include "stm32f4xx_hal_wwdg.h"
429
+#endif /* HAL_WWDG_MODULE_ENABLED */
430
+
431
+#ifdef HAL_PCD_MODULE_ENABLED
432
+#include "stm32f4xx_hal_pcd.h"
433
+#endif /* HAL_PCD_MODULE_ENABLED */
434
+
435
+#ifdef HAL_HCD_MODULE_ENABLED
436
+#include "stm32f4xx_hal_hcd.h"
437
+#endif /* HAL_HCD_MODULE_ENABLED */
438
+
439
+#ifdef HAL_DSI_MODULE_ENABLED
440
+#include "stm32f4xx_hal_dsi.h"
441
+#endif /* HAL_DSI_MODULE_ENABLED */
442
+
443
+#ifdef HAL_QSPI_MODULE_ENABLED
444
+#include "stm32f4xx_hal_qspi.h"
445
+#endif /* HAL_QSPI_MODULE_ENABLED */
446
+
447
+#ifdef HAL_CEC_MODULE_ENABLED
448
+#include "stm32f4xx_hal_cec.h"
449
+#endif /* HAL_CEC_MODULE_ENABLED */
450
+
451
+#ifdef HAL_FMPI2C_MODULE_ENABLED
452
+#include "stm32f4xx_hal_fmpi2c.h"
453
+#endif /* HAL_FMPI2C_MODULE_ENABLED */
454
+
455
+#ifdef HAL_SPDIFRX_MODULE_ENABLED
456
+#include "stm32f4xx_hal_spdifrx.h"
457
+#endif /* HAL_SPDIFRX_MODULE_ENABLED */
458
+
459
+#ifdef HAL_DFSDM_MODULE_ENABLED
460
+#include "stm32f4xx_hal_dfsdm.h"
461
+#endif /* HAL_DFSDM_MODULE_ENABLED */
462
+
463
+#ifdef HAL_LPTIM_MODULE_ENABLED
464
+#include "stm32f4xx_hal_lptim.h"
465
+#endif /* HAL_LPTIM_MODULE_ENABLED */
466
+
467
+#ifdef HAL_MMC_MODULE_ENABLED
468
+#include "stm32f4xx_hal_mmc.h"
469
+#endif /* HAL_MMC_MODULE_ENABLED */
470
+
471
+/* Exported macro ------------------------------------------------------------*/
472
+#ifdef USE_FULL_ASSERT
473
+/**
474
+  * @brief  The assert_param macro is used for function's parameters check.
475
+  * @param  expr If expr is false, it calls assert_failed function
476
+  *         which reports the name of the source file and the source
477
+  *         line number of the call that failed.
478
+  *         If expr is true, it returns no value.
479
+  * @retval None
480
+  */
481
+#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
482
+/* Exported functions ------------------------------------------------------- */
483
+void assert_failed(uint8_t *file, uint32_t line);
484
+#else
485
+#define assert_param(expr) ((void)0U)
486
+#endif /* USE_FULL_ASSERT */
487
+
488
+#ifdef __cplusplus
489
+}
490
+#endif
491
+
492
+#endif /* __STM32F4xx_HAL_CONF_CUSTOM_H */
493
+
494
+
495
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 187
- 0
buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/ldscript.ld 查看文件

@@ -0,0 +1,187 @@
1
+/*
2
+*****************************************************************************
3
+**
4
+
5
+**  File        : LinkerScript.ld
6
+**
7
+**  Abstract    : Linker script for STM32F401RETx Device with
8
+**                512KByte FLASH, 96KByte RAM
9
+**
10
+**                Set heap size, stack size and stack location according
11
+**                to application requirements.
12
+**
13
+**                Set memory bank area and size if external memory is used.
14
+**
15
+**  Target      : STMicroelectronics STM32
16
+**
17
+**
18
+**  Distribution: The file is distributed as is, without any warranty
19
+**                of any kind.
20
+**
21
+*****************************************************************************
22
+** @attention
23
+**
24
+** <h2><center>&copy; COPYRIGHT(c) 2014 Ac6</center></h2>
25
+**
26
+** Redistribution and use in source and binary forms, with or without modification,
27
+** are permitted provided that the following conditions are met:
28
+**   1. Redistributions of source code must retain the above copyright notice,
29
+**      this list of conditions and the following disclaimer.
30
+**   2. Redistributions in binary form must reproduce the above copyright notice,
31
+**      this list of conditions and the following disclaimer in the documentation
32
+**      and/or other materials provided with the distribution.
33
+**   3. Neither the name of Ac6 nor the names of its contributors
34
+**      may be used to endorse or promote products derived from this software
35
+**      without specific prior written permission.
36
+**
37
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
38
+** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40
+** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
41
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
42
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43
+** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
44
+** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45
+** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
46
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47
+**
48
+*****************************************************************************
49
+*/
50
+
51
+/* Entry Point */
52
+ENTRY(Reset_Handler)
53
+
54
+/* Highest address of the user mode stack */
55
+_estack = 0x20010000;    /* end of RAM */
56
+
57
+/* Generate a link error if heap and stack don't fit into RAM */
58
+_Min_Heap_Size = 0x200;;      /* required amount of heap  */
59
+_Min_Stack_Size = 0x400;; /* required amount of stack */
60
+
61
+/* Specify the memory areas */
62
+MEMORY
63
+{
64
+FLASH (rx)      : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
65
+RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 64K
66
+}
67
+
68
+/* Define output sections */
69
+SECTIONS
70
+{
71
+  /* The startup code goes first into FLASH */
72
+  .isr_vector :
73
+  {
74
+    . = ALIGN(4);
75
+    KEEP(*(.isr_vector)) /* Startup code */
76
+    . = ALIGN(4);
77
+  } >FLASH
78
+
79
+  /* The program code and other data goes into FLASH */
80
+  .text ALIGN(4):
81
+  {
82
+    . = ALIGN(4);
83
+    *(.text)           /* .text sections (code) */
84
+    *(.text*)          /* .text* sections (code) */
85
+    *(.glue_7)         /* glue arm to thumb code */
86
+    *(.glue_7t)        /* glue thumb to arm code */
87
+    *(.eh_frame)
88
+
89
+    KEEP (*(.init))
90
+    KEEP (*(.fini))
91
+
92
+    . = ALIGN(4);
93
+    _etext = .;        /* define a global symbols at end of code */
94
+  } >FLASH
95
+
96
+  /* Constant data goes into FLASH */
97
+  .rodata :
98
+  {
99
+    . = ALIGN(4);
100
+    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
101
+    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
102
+    . = ALIGN(4);
103
+  } >FLASH
104
+
105
+  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
106
+  .ARM : {
107
+    __exidx_start = .;
108
+    *(.ARM.exidx*)
109
+    __exidx_end = .;
110
+  } >FLASH
111
+
112
+  .preinit_array     :
113
+  {
114
+    PROVIDE_HIDDEN (__preinit_array_start = .);
115
+    KEEP (*(.preinit_array*))
116
+    PROVIDE_HIDDEN (__preinit_array_end = .);
117
+  } >FLASH
118
+  .init_array :
119
+  {
120
+    PROVIDE_HIDDEN (__init_array_start = .);
121
+    KEEP (*(SORT(.init_array.*)))
122
+    KEEP (*(.init_array*))
123
+    PROVIDE_HIDDEN (__init_array_end = .);
124
+  } >FLASH
125
+  .fini_array :
126
+  {
127
+    PROVIDE_HIDDEN (__fini_array_start = .);
128
+    KEEP (*(SORT(.fini_array.*)))
129
+    KEEP (*(.fini_array*))
130
+    PROVIDE_HIDDEN (__fini_array_end = .);
131
+  } >FLASH
132
+
133
+  /* used by the startup to initialize data */
134
+  _sidata = LOADADDR(.data);
135
+
136
+  /* Initialized data sections goes into RAM, load LMA copy after code */
137
+  .data :
138
+  {
139
+    . = ALIGN(4);
140
+    _sdata = .;        /* create a global symbol at data start */
141
+    *(.data)           /* .data sections */
142
+    *(.data*)          /* .data* sections */
143
+
144
+    . = ALIGN(4);
145
+    _edata = .;        /* define a global symbol at data end */
146
+  } >RAM AT> FLASH
147
+
148
+
149
+  /* Uninitialized data section */
150
+  . = ALIGN(4);
151
+  .bss :
152
+  {
153
+    /* This is used by the startup in order to initialize the .bss secion */
154
+    _sbss = .;         /* define a global symbol at bss start */
155
+    __bss_start__ = _sbss;
156
+    *(.bss)
157
+    *(.bss*)
158
+    *(COMMON)
159
+
160
+    . = ALIGN(4);
161
+    _ebss = .;         /* define a global symbol at bss end */
162
+    __bss_end__ = _ebss;
163
+  } >RAM
164
+
165
+  /* User_heap_stack section, used to check that there is enough RAM left */
166
+  ._user_heap_stack :
167
+  {
168
+    . = ALIGN(8);
169
+    PROVIDE ( end = . );
170
+    PROVIDE ( _end = . );
171
+    . = . + _Min_Heap_Size;
172
+    . = . + _Min_Stack_Size;
173
+    . = ALIGN(8);
174
+  } >RAM
175
+
176
+
177
+
178
+  /* Remove information from the standard libraries */
179
+  /DISCARD/ :
180
+  {
181
+    libc.a ( * )
182
+    libm.a ( * )
183
+    libgcc.a ( * )
184
+  }
185
+
186
+  .ARM.attributes 0 : { *(.ARM.attributes) }
187
+}

+ 238
- 0
buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.cpp 查看文件

@@ -0,0 +1,238 @@
1
+/*
2
+  Copyright (c) 2011 Arduino.  All right reserved.
3
+
4
+  This library is free software; you can redistribute it and/or
5
+  modify it under the terms of the GNU Lesser General Public
6
+  License as published by the Free Software Foundation; either
7
+  version 2.1 of the License, or (at your option) any later version.
8
+
9
+  This library is distributed in the hope that it will be useful,
10
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+  See the GNU Lesser General Public License for more details.
13
+
14
+  You should have received a copy of the GNU Lesser General Public
15
+  License along with this library; if not, write to the Free Software
16
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
+*/
18
+
19
+#include "pins_arduino.h"
20
+
21
+#ifdef __cplusplus
22
+extern "C" {
23
+#endif
24
+
25
+// Digital PinName array
26
+const PinName digitalPin[] = {
27
+  PA_0,  // Digital pin 0
28
+  PA_1,  // Digital pin 1
29
+  PA_2,  // Digital pin 2
30
+  PA_3,  // Digital pin 3
31
+  PA_4,  // Digital pin 4
32
+  PA_5,  // Digital pin 5
33
+  PA_6,  // Digital pin 6
34
+  PA_7,  // Digital pin 7
35
+  PA_8,  // Digital pin 8
36
+  PA_9,  // Digital pin 9
37
+  PA_10, // Digital pin 10
38
+  PA_11, // Digital pin 11
39
+  PA_12, // Digital pin 12
40
+  PA_13, // Digital pin 13
41
+  PA_14, // Digital pin 14
42
+  PA_15, // Digital pin 15
43
+
44
+  PB_0,  // Digital pin 16
45
+  PB_1,  // Digital pin 17
46
+  PB_2,  // Digital pin 18
47
+  PB_3,  // Digital pin 19
48
+  PB_4,  // Digital pin 20
49
+  PB_5,  // Digital pin 21
50
+  PB_6,  // Digital pin 22
51
+  PB_7,  // Digital pin 23
52
+  PB_8,  // Digital pin 24
53
+  PB_9,  // Digital pin 25
54
+  PB_10, // Digital pin 26
55
+  PB_12, // Digital pin 27
56
+  PB_13, // Digital pin 28
57
+  PB_14, // Digital pin 29
58
+  PB_15, // Digital pin 30
59
+
60
+  PC_0,  // Digital pin 31
61
+  PC_1,  // Digital pin 32
62
+  PC_2,  // Digital pin 33
63
+  PC_3,  // Digital pin 34
64
+  PC_4,  // Digital pin 35
65
+  PC_5,  // Digital pin 36
66
+  PC_6,  // Digital pin 37
67
+  PC_7,  // Digital pin 38
68
+  PC_8,  // Digital pin 39
69
+  PC_9,  // Digital pin 40
70
+  PC_10, // Digital pin 41
71
+  PC_11, // Digital pin 42
72
+  PC_12, // Digital pin 43
73
+  PC_13, // Digital pin 44
74
+  PC_14, // Digital pin 45
75
+  PC_15, // Digital pin 46
76
+
77
+  PD_2,  // Digital pin 47
78
+
79
+  PH_0,  // Digital pin 48, used by the external oscillator
80
+  PH_1   // Digital pin 49, used by the external oscillator
81
+};
82
+
83
+// Analog (Ax) pin number array
84
+const uint32_t analogInputPin[] = {
85
+  0,  // A0,  PA0
86
+  1,  // A1,  PA1
87
+  2,  // A2,  PA2
88
+  3,  // A3,  PA3
89
+  4,  // A4,  PA4
90
+  5,  // A5,  PA5
91
+  6,  // A6,  PA6
92
+  7,  // A7,  PA7
93
+  16, // A8,  PB0
94
+  17, // A9,  PB1
95
+  31, // A10, PC0
96
+  32, // A11, PC1
97
+  33, // A12, PC2
98
+  34, // A13, PC3
99
+  35, // A14, PC4
100
+  36  // A15, PC5
101
+};
102
+
103
+#ifdef __cplusplus
104
+}
105
+#endif
106
+
107
+// ----------------------------------------------------------------------------
108
+
109
+#ifdef __cplusplus
110
+extern "C" {
111
+#endif
112
+
113
+/*
114
+ * @brief  Configures the System clock source, PLL Multiplier and Divider factors,
115
+ *               AHB/APBx prescalers and Flash settings
116
+ * @note   This function should be called only once the RCC clock configuration
117
+ *         is reset to the default reset state (done in SystemInit() function).
118
+ * @param  None
119
+ * @retval None
120
+ */
121
+
122
+/******************************************************************************/
123
+/*            PLL (clocked by HSE) used as System clock source                */
124
+/******************************************************************************/
125
+static uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
126
+{
127
+  RCC_OscInitTypeDef RCC_OscInitStruct;
128
+  RCC_ClkInitTypeDef RCC_ClkInitStruct;
129
+
130
+  /* The voltage scaling allows optimizing the power consumption when the device is
131
+  clocked below the maximum system frequency, to update the voltage scaling value
132
+  regarding system frequency refer to product datasheet. */
133
+  __HAL_RCC_PWR_CLK_ENABLE();
134
+  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
135
+
136
+  // Enable HSE oscillator and activate PLL with HSE as source
137
+  RCC_OscInitStruct.OscillatorType      = RCC_OSCILLATORTYPE_HSE;
138
+  if (bypass == 0) {
139
+    RCC_OscInitStruct.HSEState          = RCC_HSE_ON; // External 8 MHz xtal on OSC_IN/OSC_OUT
140
+  } else {
141
+    RCC_OscInitStruct.HSEState          = RCC_HSE_BYPASS; // External 8 MHz clock on OSC_IN
142
+  }
143
+
144
+  RCC_OscInitStruct.PLL.PLLState        = RCC_PLL_ON;
145
+  RCC_OscInitStruct.PLL.PLLSource       = RCC_PLLSOURCE_HSE;
146
+  RCC_OscInitStruct.PLL.PLLM            = HSE_VALUE / 1000000L; // Expects an 8 MHz external clock by default. Redefine HSE_VALUE if not
147
+  RCC_OscInitStruct.PLL.PLLN            = 336;           // VCO output clock = 336 MHz (1 MHz * 336)
148
+  RCC_OscInitStruct.PLL.PLLP            = RCC_PLLP_DIV4; // PLLCLK = 84 MHz (336 MHz / 4)
149
+  RCC_OscInitStruct.PLL.PLLQ            = 7;             // USB clock = 48 MHz (336 MHz / 7) --> OK for USB
150
+  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
151
+    return 0; // FAIL
152
+  }
153
+
154
+  // Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers
155
+  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
156
+  RCC_ClkInitStruct.SYSCLKSource   = RCC_SYSCLKSOURCE_PLLCLK; // 84 MHz
157
+  RCC_ClkInitStruct.AHBCLKDivider  = RCC_SYSCLK_DIV1;         // 84 MHz
158
+  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;           // 42 MHz
159
+  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;           // 84 MHz
160
+  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
161
+    return 0; // FAIL
162
+  }
163
+
164
+  /* Output clock on MCO1 pin(PA8) for debugging purpose */
165
+  /*
166
+  if (bypass == 0)
167
+    HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_2); // 4 MHz
168
+  else
169
+    HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_1); // 8 MHz
170
+  */
171
+
172
+  return 1; // OK
173
+}
174
+
175
+/******************************************************************************/
176
+/*            PLL (clocked by HSI) used as System clock source                */
177
+/******************************************************************************/
178
+uint8_t SetSysClock_PLL_HSI(void)
179
+{
180
+  RCC_OscInitTypeDef RCC_OscInitStruct;
181
+  RCC_ClkInitTypeDef RCC_ClkInitStruct;
182
+
183
+  /* The voltage scaling allows optimizing the power consumption when the device is
184
+    clocked below the maximum system frequency, to update the voltage scaling value
185
+    regarding system frequency refer to product datasheet. */
186
+  __HAL_RCC_PWR_CLK_ENABLE();
187
+  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
188
+
189
+  // Enable HSI oscillator and activate PLL with HSI as source
190
+  RCC_OscInitStruct.OscillatorType      = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
191
+  RCC_OscInitStruct.HSIState            = RCC_HSI_ON;
192
+  RCC_OscInitStruct.HSEState            = RCC_HSE_OFF;
193
+  RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
194
+  RCC_OscInitStruct.PLL.PLLState        = RCC_PLL_ON;
195
+  RCC_OscInitStruct.PLL.PLLSource       = RCC_PLLSOURCE_HSI;
196
+  RCC_OscInitStruct.PLL.PLLM            = 16;            // VCO input clock = 1 MHz (16 MHz / 16)
197
+  RCC_OscInitStruct.PLL.PLLN            = 336;           // VCO output clock = 336 MHz (1 MHz * 336)
198
+  RCC_OscInitStruct.PLL.PLLP            = RCC_PLLP_DIV4; // PLLCLK = 84 MHz (336 MHz / 4)
199
+  RCC_OscInitStruct.PLL.PLLQ            = 7;             // USB clock = 48 MHz (336 MHz / 7) --> freq is ok but not precise enough
200
+  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
201
+    return 0; // FAIL
202
+  }
203
+
204
+  /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
205
+  RCC_ClkInitStruct.ClockType      = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
206
+  RCC_ClkInitStruct.SYSCLKSource   = RCC_SYSCLKSOURCE_PLLCLK; // 84 MHz
207
+  RCC_ClkInitStruct.AHBCLKDivider  = RCC_SYSCLK_DIV1;         // 84 MHz
208
+  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;           // 42 MHz
209
+  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;           // 84 MHz
210
+  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
211
+    return 0; // FAIL
212
+  }
213
+
214
+  /* Output clock on MCO1 pin(PA8) for debugging purpose */
215
+  //HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1); // 16 MHz
216
+
217
+  return 1; // OK
218
+}
219
+
220
+WEAK void SystemClock_Config(void)
221
+{
222
+  /* 1- If fail try to start with HSE and external xtal */
223
+  if (SetSysClock_PLL_HSE(0) == 0) {
224
+    /* 2- Try to start with HSE and external clock */
225
+    if (SetSysClock_PLL_HSE(1) == 0) {
226
+      /* 3- If fail start with HSI clock */
227
+      if (SetSysClock_PLL_HSI() == 0) {
228
+        Error_Handler();
229
+      }
230
+    }
231
+  }
232
+  /* Output clock on MCO2 pin(PC9) for debugging purpose */
233
+  //HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_4);
234
+}
235
+
236
+#ifdef __cplusplus
237
+}
238
+#endif

+ 151
- 0
buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h 查看文件

@@ -0,0 +1,151 @@
1
+/*
2
+  Copyright (c) 2011 Arduino.  All right reserved.
3
+
4
+  This library is free software; you can redistribute it and/or
5
+  modify it under the terms of the GNU Lesser General Public
6
+  License as published by the Free Software Foundation; either
7
+  version 2.1 of the License, or (at your option) any later version.
8
+
9
+  This library is distributed in the hope that it will be useful,
10
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+  See the GNU Lesser General Public License for more details.
13
+
14
+  You should have received a copy of the GNU Lesser General Public
15
+  License along with this library; if not, write to the Free Software
16
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
+*/
18
+
19
+#ifndef _VARIANT_ARDUINO_STM32_
20
+#define _VARIANT_ARDUINO_STM32_
21
+
22
+#ifdef __cplusplus
23
+extern "C" {
24
+#endif // __cplusplus
25
+
26
+
27
+//                  | DIGITAL | ANALOG | USART     | TWI      | SPI                    | SPECIAL   |
28
+//                  |---------|--------|-----------|----------|------------------------|-----------|
29
+#define PA0  0   // | 0       | A0     |           |          |                        |           |
30
+#define PA1  1   // | 1       | A1     |           |          |                        |           |
31
+#define PA2  2   // | 2       | A2     | USART2_TX |          |                        |           |
32
+#define PA3  3   // | 3       | A3     | USART2_RX |          |                        |           |
33
+#define PA4  4   // | 4       | A4     |           |          | SPI1_SS, (SPI3_SS)     |           |
34
+#define PA5  5   // | 5       | A5     |           |          | SPI1_SCK               |           |
35
+#define PA6  6   // | 6       | A6     |           |          | SPI1_MISO              |           |
36
+#define PA7  7   // | 7       | A7     |           |          | SPI1_MOSI              |           |
37
+#define PA8  8   // | 8       |        |           | TWI3_SCL |                        |           |
38
+#define PA9  9   // | 9       |        | USART1_TX |          |                        |           |
39
+#define PA10 10  // | 10      |        | USART1_RX |          |                        |           |
40
+#define PA11 11  // | 11      |        | USART6_TX |          |                        |           |
41
+#define PA12 12  // | 12      |        | USART6_RX |          |                        |           |
42
+#define PA13 13  // | 13      |        |           |          |                        | SWD_SWDIO |
43
+#define PA14 14  // | 14      |        |           |          |                        | SWD_SWCLK |
44
+#define PA15 15  // | 15      |        |           |          | SPI3_SS, (SPI1_SS)     |           |
45
+//                  |---------|--------|-----------|----------|------------------------|-----------|
46
+#define PB0  16  // | 16      | A8     |           |          |                        |           |
47
+#define PB1  17  // | 17      | A9     |           |          |                        |           |
48
+#define PB2  18  // | 18      |        |           |          |                        | BOOT1     |
49
+#define PB3  19  // | 19      |        |           | TWI2_SDA | SPI3_SCK,  (SPI1_SCK)  |           |
50
+#define PB4  20  // | 20      |        |           | TWI3_SDA | SPI3_MISO, (SPI1_MISO) |           |
51
+#define PB5  21  // | 21      |        |           |          | SPI3_MOSI, (SPI1_MOSI) |           |
52
+#define PB6  22  // | 22      |        | USART1_TX | TWI1_SCL |                        |           |
53
+#define PB7  23  // | 23      |        | USART1_RX | TWI1_SDA |                        |           |
54
+#define PB8  24  // | 24      |        |           | TWI1_SCL |                        |           |
55
+#define PB9  25  // | 25      |        |           | TWI1_SDA | SPI2_SS                |           |
56
+#define PB10 26  // | 26      |        |           | TWI2_SCL | SPI2_SCK               |           |
57
+#define PB12 27  // | 27      |        |           |          | SPI2_SS                |           |
58
+#define PB13 28  // | 28      |        |           |          | SPI2_SCK               |           |
59
+#define PB14 29  // | 29      |        |           |          | SPI2_MISO              |           |
60
+#define PB15 30  // | 30      |        |           |          | SPI2_MOSI              |           |
61
+//                  |---------|--------|-----------|----------|------------------------|-----------|
62
+#define PC0  31  // | 31      | A10    |           |          |                        |           |
63
+#define PC1  32  // | 32      | A11    |           |          |                        |           |
64
+#define PC2  33  // | 33      | A12    |           |          | SPI2_MISO              |           |
65
+#define PC3  34  // | 34      | A13    |           |          | SPI2_MOSI              |           |
66
+#define PC4  35  // | 35      | A14    |           |          |                        |           |
67
+#define PC5  36  // | 36      | A15    |           |          |                        |           |
68
+#define PC6  37  // | 37      |        | USART6_TX |          |                        |           |
69
+#define PC7  38  // | 38      |        | USART6_RX |          |                        |           |
70
+#define PC8  39  // | 39      |        |           |          |                        |           |
71
+#define PC9  40  // | 40      |        |           | TWI3_SDA |                        |           |
72
+#define PC10 41  // | 41      |        |           |          | SPI3_SCK               |           |
73
+#define PC11 42  // | 42      |        |           |          | SPI3_MISO              |           |
74
+#define PC12 43  // | 43      |        |           |          | SPI3_MOSI              |           |
75
+#define PC13 44  // | 44      |        |           |          |                        |           |
76
+#define PC14 45  // | 45      |        |           |          |                        | OSC32_IN  |
77
+#define PC15 46  // | 46      |        |           |          |                        | OSC32_OUT |
78
+//                  |---------|--------|-----------|----------|------------------------|-----------|
79
+#define PD2  47  // | 47      |        |           |          |                        |           |
80
+//                  |---------|--------|-----------|----------|------------------------|-----------|
81
+#define PH0  48  // | 48      |        |           |          |                        | OSC_IN    |
82
+#define PH1  49  // | 49      |        |           |          |                        | OSC_OUT   |
83
+//                  |---------|--------|-----------|----------|------------------------|-----------|
84
+
85
+// This must be a literal
86
+#define NUM_DIGITAL_PINS        50
87
+#define NUM_ANALOG_INPUTS       16
88
+
89
+// SPI definitions
90
+#define PIN_SPI_SS              PA4
91
+#define PIN_SPI_SS1             PA4
92
+#define PIN_SPI_MOSI            PA7
93
+#define PIN_SPI_MISO            PA6
94
+#define PIN_SPI_SCK             PA5
95
+
96
+
97
+// Timer Definitions
98
+#define TIMER_TONE              TIM2
99
+#define TIMER_SERVO             TIM5
100
+#define TIMER_SERIAL            TIM11
101
+
102
+// UART Definitions
103
+//#define ENABLE_HWSERIAL1        done automatically by the #define SERIAL_UART_INSTANCE below
104
+#define ENABLE_HWSERIAL2
105
+
106
+
107
+// Define here Serial instance number to map on Serial generic name (if not already used by SerialUSB)
108
+#define SERIAL_UART_INSTANCE    1 //1 for Serial = Serial1 (USART1)
109
+
110
+// Default pin used for 'Serial' instance
111
+// Mandatory for Firmata
112
+#define PIN_SERIAL_RX           PA10
113
+#define PIN_SERIAL_TX           PA9
114
+
115
+// Used when user instanciate a hardware Serial using its peripheral name.
116
+// Example: HardwareSerial mySerial(USART3);
117
+// will use PIN_SERIAL3_RX and PIN_SERIAL3_TX if defined.
118
+#define PIN_SERIAL1_RX          PA10
119
+#define PIN_SERIAL1_TX          PA9
120
+#define PIN_SERIAL2_RX          PA3
121
+#define PIN_SERIAL2_TX          PA2
122
+
123
+#ifdef __cplusplus
124
+} // extern "C"
125
+#endif
126
+/*----------------------------------------------------------------------------
127
+ *        Arduino objects - C++ only
128
+ *----------------------------------------------------------------------------*/
129
+
130
+#ifdef __cplusplus
131
+  // These serial port names are intended to allow libraries and architecture-neutral
132
+  // sketches to automatically default to the correct port name for a particular type
133
+  // of use.  For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
134
+  // the first hardware serial port whose RX/TX pins are not dedicated to another use.
135
+  //
136
+  // SERIAL_PORT_MONITOR        Port which normally prints to the Arduino Serial Monitor
137
+  //
138
+  // SERIAL_PORT_USBVIRTUAL     Port which is USB virtual serial
139
+  //
140
+  // SERIAL_PORT_LINUXBRIDGE    Port which connects to a Linux system via Bridge library
141
+  //
142
+  // SERIAL_PORT_HARDWARE       Hardware serial port, physical RX & TX pins.
143
+  //
144
+  // SERIAL_PORT_HARDWARE_OPEN  Hardware serial ports which are open for use.  Their RX & TX
145
+  //                            pins are NOT connected to anything by default.
146
+  #define SERIAL_PORT_MONITOR         Serial
147
+  #define SERIAL_PORT_HARDWARE        Serial1
148
+  #define SERIAL_PORT_HARDWARE_OPEN   Serial2
149
+#endif
150
+
151
+#endif /* _VARIANT_ARDUINO_STM32_ */

+ 0
- 6
buildroot/tests/STM32F103RE_creality 查看文件

@@ -15,12 +15,6 @@ exec_test $1 $2 "Ender 3 v2 with CrealityUI" "$3"
15 15
 
16 16
 use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
17 17
 opt_disable DWIN_CREALITY_LCD
18
-opt_enable BLTOUCH AUTO_BED_LEVELING_UBL Z_SAFE_HOMING INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING BAUD_RATE_GCODE \
19
-           DWIN_LCD_PROUI SOUND_MENU_ITEM PRINTCOUNTER
20
-exec_test $1 $2 "Ender 3 v2 with ProUI" "$3"
21
-
22
-use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
23
-opt_disable DWIN_CREALITY_LCD
24 18
 opt_enable DWIN_CREALITY_LCD_JYERSUI AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY
25 19
 exec_test $1 $2 "Ender 3 v2 with JyersUI" "$3"
26 20
 

+ 20
- 0
buildroot/tests/STM32F401RC_creality 查看文件

@@ -0,0 +1,20 @@
1
+#!/usr/bin/env bash
2
+#
3
+# Build tests for STM32F401RC_creality
4
+#
5
+
6
+# exit on first failure
7
+set -e
8
+
9
+use_example_configs "Creality/Ender-3 S1"
10
+opt_disable DWIN_CREALITY_LCD Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN AUTO_BED_LEVELING_BILINEAR CONFIGURATION_EMBEDDING CANCEL_OBJECTS FWRETRACT
11
+opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING \
12
+           SOUND_MENU_ITEM PRINTCOUNTER NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE FILAMENT_RUNOUT_SENSOR \
13
+           BLTOUCH Z_SAFE_HOMING AUTO_BED_LEVELING_UBL MESH_EDIT_MENU \
14
+           LIMITED_MAX_FR_EDITING LIMITED_MAX_ACCEL_EDITING LIMITED_JERK_EDITING BAUD_RATE_GCODE
15
+opt_set MOTHERBOARD BOARD_CREALITY_V24S1_301F4 \
16
+        PREHEAT_3_LABEL '"CUSTOM"' PREHEAT_3_TEMP_HOTEND 240 PREHEAT_3_TEMP_BED 60 PREHEAT_3_FAN_SPEED 128
17
+exec_test $1 $2 "Ender-3 S1 with ProUI" "$3"
18
+
19
+# clean up
20
+restore_configs

+ 28
- 1
ini/stm32f4.ini 查看文件

@@ -588,4 +588,31 @@ build_flags       = ${common_stm32.build_flags}
588 588
                     -DUSB_PRODUCT=\"Artillery_3D_Printer\"
589 589
                     -DFLASH_DATA_SECTOR=1U -DFLASH_BASE_ADDRESS=0x08004000
590 590
 extra_scripts     = ${common_stm32.extra_scripts}
591
-  pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
591
+                    pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
592
+
593
+#
594
+# Ender-3 S1 STM32F401RC_creality
595
+#
596
+[env:STM32F401RC_creality]
597
+extends                     = stm32_variant
598
+board                       = genericSTM32F401RC
599
+board_build.variant         = MARLIN_CREALITY_STM32F401RC
600
+board_build.offset          = 0x10000
601
+board_upload.offset_address = 0x08010000
602
+build_flags                 = ${stm32_variant.build_flags} -DMCU_STM32F401RC -DSTM32F4
603
+                              -DSS_TIMER=4 -DTIMER_SERVO=TIM5
604
+                              -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8
605
+build_unflags               = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC
606
+extra_scripts               = ${stm32_variant.extra_scripts}
607
+                              pre:buildroot/share/PlatformIO/scripts/random-bin.py
608
+monitor_speed               = 115200
609
+
610
+[env:STM32F401RC_creality_jlink]
611
+extends                     = env:STM32F401RC_creality
612
+debug_tool                  = jlink
613
+upload_protocol             = jlink
614
+
615
+[env:STM32F401RC_creality_stlink]
616
+extends                     = env:STM32F401RC_creality
617
+debug_tool                  = stlink
618
+upload_protocol             = stlink

正在加载...
取消
保存