Skip to content

Commit

Permalink
Add Arduino GD32F350xx support
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgerhardt committed Apr 30, 2023
1 parent 188d866 commit a62c7e9
Show file tree
Hide file tree
Showing 18 changed files with 112 additions and 29 deletions.
6 changes: 4 additions & 2 deletions boards/genericGD32F350C4.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350c4t6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350C4_GENERIC"
},
"debug": {
"jlink_device": "GD32F350C4",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350C4 (4k RAM, 16k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350C6.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350c6t6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350C6_GENERIC"
},
"debug": {
"jlink_device": "GD32F350C6",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350C6 (6k RAM, 32k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350C8.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350c8t6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350C8_GENERIC"
},
"debug": {
"jlink_device": "GD32F350C8",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350C8 (8k RAM, 64k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350CB.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350cbt6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350CB_GENERIC"
},
"debug": {
"jlink_device": "GD32F350CB",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350CB (16k RAM, 128k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350G4.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350g4u6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350G4_GENERIC"
},
"debug": {
"jlink_device": "GD32F350G4",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350G4 (4k RAM, 16k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350G6.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350g6u6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350G6_GENERIC"
},
"debug": {
"jlink_device": "GD32F350G6",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350G6 (6k RAM, 32k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350K4.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350k4u6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350K4_GENERIC"
},
"debug": {
"jlink_device": "GD32F350K4",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350K4 (4k RAM, 16k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350K6.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350k6u6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350K6_GENERIC"
},
"debug": {
"jlink_device": "GD32F350K6",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350K6 (6k RAM, 32k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350K8.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350k8u6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350K8_GENERIC"
},
"debug": {
"jlink_device": "GD32F350K8",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350K8 (8k RAM, 64k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350R4.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350r4t6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350R4_GENERIC"
},
"debug": {
"jlink_device": "GD32F350R4",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350R4 (4k RAM, 16k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350R6.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350r6t6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350R6_GENERIC"
},
"debug": {
"jlink_device": "GD32F350R6",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350R6 (16k RAM, 32k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350R8.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350r8t6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350R8_GENERIC"
},
"debug": {
"jlink_device": "GD32F350R8",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350R8 (16k RAM, 64k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F350RB.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "108000000L",
"mcu": "gd32f350rbt6",
"spl_series": "GD32F3x0",
"series": "GD32F350"
"series": "GD32F350",
"variant": "GD32F350RB_GENERIC"
},
"debug": {
"jlink_device": "GD32F350RB",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F350RB (16k RAM, 128k Flash)",
"upload": {
Expand Down
2 changes: 1 addition & 1 deletion misc/scripts/board_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def infer_arduino_variant(self):
if self.name in GD32MCUInfo.known_arduino_variants:
self.arduino_variant = GD32MCUInfo.known_arduino_variants[self.name]
# generated by gd32_genpinmap.py
elif any([self.name.startswith(x) for x in ["GD32F190", "GD32F170", "GD32F150", "GD32F130", "GD32E230"]]):
elif any([self.name.startswith(x) for x in ["GD32F190", "GD32F170", "GD32F150", "GD32F130", "GD32F350", "GD32E230"]]):
self.arduino_variant = self.name_no_package + "_GENERIC"

def infer_mbedos_variant(self):
Expand Down
5 changes: 5 additions & 0 deletions misc/scripts/gd32_genpinmap/datasheet_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ def process_af_dataframe(dfs: DataFrame, datasheet_info: DatasheetParsingInfo, p
print(alternate_funcs)
if any([not x.startswith("AF") for x in alternate_funcs]):
print("Fail: These are not the alternate function descriptions: " + str(alternate_funcs))
# check if we can use the columns:
af_cols = dfs.columns[1:]
if all([x.startswith("AF") for x in af_cols]):
parser_result_alternate_functions = af_cols
print("Saved by using column names")
else:
parser_result_alternate_functions = alternate_funcs
else:
Expand Down
5 changes: 3 additions & 2 deletions misc/scripts/gd32_genpinmap/gd32_genpinmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def main_func():
all_mcus = read_all_known_mcus()
# temporary static path
datasheet_pdf_paths = [
"C:\\Users\\Max\\Desktop\\gd32_dev\\gigadevice-firmware-and-docs\\GD32F30x\\GD32F303xx_Datasheet_Rev1.9.pdf"
"C:\\Users\\Max\\Desktop\\gd32_dev\\gigadevice-firmware-and-docs\\GD32F3x0\\GD32F350xx_Datasheet_Rev2.3.pdf"
#"C:\\Users\\Max\\Desktop\\gd32_dev\\gigadevice-firmware-and-docs\\GD32F30x\\GD32F303xx_Datasheet_Rev1.9.pdf"
#"C:\\Users\\Max\\Desktop\\gd32_dev\\gigadevice-firmware-and-docs\\GD32E23x\\GD32E230xx_Datasheet_Rev1.4.pdf",
#"C:\\Users\\Max\\Desktop\\gd32_dev\\gigadevice-firmware-and-docs\\GD32F1x0\\GD32F190xx_Datasheet_Rev2.1.pdf",
#"C:\\Users\\Max\\Desktop\\gd32_dev\\gigadevice-firmware-and-docs\\GD32F1x0\\GD32F170xx_Datasheet_Rev2.1.pdf",
Expand All @@ -68,7 +69,7 @@ def main_func():
device_pinmap = GD32DatasheetParser.get_pinmap_for_pdf(datasheet_pdf_path)
save_pinmap(device_pinmap)
device_pinmap.solve_remapper_pins()
return
#return
all_matching_mcus = get_all_mcus_matching_pinmap(all_mcus, device_pinmap)
GD32PinMapGenerator.generate_from_pinmap(device_pinmap, all_matching_mcus)
if __name__ == "__main__":
Expand Down
51 changes: 51 additions & 0 deletions misc/scripts/gd32_genpinmap/known_datasheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,57 @@
series = "GD32F303", # series
family_type = "A", # family type
family_name= "GD32F30x"
),
"GD32F350xx_Datasheet_Rev2.3.pdf": DatasheetParsingInfo(
alternate_funcs = [
DatasheetAFPageParsingInfo([30], { "1": ["GD32F350x4"], "2": ["GD32F350xB", "GD32F350x8", "GD32F350x6"], "3": ["GD32F350xB", "GD32F350x8"]}, quirks=[
ParseUsingAreaQuirk((127.622,122.413,748.243,535.416)),
]),
DatasheetAFPageParsingInfo([31], { "1": ["GD32F350x4"], "2": ["GD32F350xB", "GD32F350x8", "GD32F350x6"], "3": ["GD32F350xB", "GD32F350x8"]}, quirks=[
ParseUsingAreaQuirk((97.112,117.204,687.223,539.137)),
]),
DatasheetAFPageParsingInfo([32], { "1": ["GD32F350x4"], "2": ["GD32F350xB", "GD32F350x8", "GD32F350x6"], "3": ["GD32F350xB", "GD32F350x8"]}, quirks=[
ParseUsingAreaQuirk((97.112,124.645,394.027,534.672)),
]),
DatasheetAFPageParsingInfo([32], { "1": ["GD32F350x4"], "2": ["GD32F350xB", "GD32F350x8", "GD32F350x6"], "3": ["GD32F350xB", "GD32F350x8"]}, quirks=[
ParseUsingAreaQuirk((431.979,116.459,728.151,555.508)),
]),
DatasheetAFPageParsingInfo([33], { "1": ["GD32F350x4"], "2": ["GD32F350xB", "GD32F350x8", "GD32F350x6"], "3": ["GD32F350xB", "GD32F350x8"]}, quirks=[
ParseUsingAreaQuirk((97.112,123.901,422.305,534.672)),
]),
],
pin_defs = [
# GD32F350Rx
DatasheetPinDefPageParsingInfo([17], "GD32F350Rx", "LQFP64", [ParseUsingAreaQuirk((233.291,125.389,771.311,533.183))]),
DatasheetPinDefPageParsingInfo([18], "GD32F350Rx", "LQFP64", [
ParseUsingAreaQuirk((82.973,124.645,766.102,533.928)),
OverwritePinDescriptionQuirk("PB0", "Default: PB0\rAlternate: TIMER2_CH2, TIMER0_CH1_ON, TSI_G2_IO1, USART1_RX(4), EVENTOUT\rAdditional: ADC_IN8"),
]),
DatasheetPinDefPageParsingInfo([19], "GD32F350Rx", "LQFP64", [ParseUsingAreaQuirk((81.484,123.157,773.544,535.416))]),
DatasheetPinDefPageParsingInfo([20], "GD32F350Rx", "LQFP64", [ParseUsingAreaQuirk((83.717,123.157,760.893,535.416))]),
DatasheetPinDefPageParsingInfo([21], "GD32F350Rx", "LQFP64", [ParseUsingAreaQuirk((81.484,123.901,201.293,534.672))]),
# GD32F350Cx
DatasheetPinDefPageParsingInfo([21], "GD32F350Cx", "LQFP48", [ParseUsingAreaQuirk((347.89,123.901,760.149,537.648))]),
DatasheetPinDefPageParsingInfo([22], "GD32F350Cx", "LQFP48", [ParseUsingAreaQuirk((82.973,124.645,767.591,537.648))]),
DatasheetPinDefPageParsingInfo([23], "GD32F350Cx", "LQFP48", [ParseUsingAreaQuirk((83.717,123.901,771.311,537.648))]),
DatasheetPinDefPageParsingInfo([24], "GD32F350Cx", "LQFP48", [ParseUsingAreaQuirk((82.229,123.157,446.118,538.393))]),
# GD32F350Kx
DatasheetPinDefPageParsingInfo([24], "GD32F350Kx", "QFN32", [
ParseUsingAreaQuirk((588.995,123.901,762.382,539.881)),
OverwritePinDescriptionQuirk("PA0", "Default: PA0\rAlternate: USART0_CTS(3), USART1_CTS(4), TIMER1_CH0, TIMER1_ETI, CMP0_OUT, TSI_G0_IO0, I2C1_SCL(5)\rAdditional: ADC_IN0, CMP0_IM6, RTC_TAMP1, WKUP0"),
]),
DatasheetPinDefPageParsingInfo([25], "GD32F350Kx", "QFN32", [ParseUsingAreaQuirk((84.461,122.413,769.079,537.648))]),
DatasheetPinDefPageParsingInfo([26], "GD32F350Kx", "QFN32", [ParseUsingAreaQuirk((82.229,123.901,760.893,536.16))]),
# GD32F350Gx
DatasheetPinDefPageParsingInfo([27], "GD32F350Gx", "QFN28", [
ParseUsingAreaQuirk((288.358,123.157,769.079,536.904)),
OverwritePinDescriptionQuirk("PA5", "Default: PA5\rAlternate: SPI0_SCK, I2S0_CK, CEC, TIMER1_CH0, TIMER1_ETI, TSI_G1_IO1\rAdditional: ADC_IN5, CMP0_IM5, CMP1_IM5"),
]),
DatasheetPinDefPageParsingInfo([28], "GD32F350Gx", "QFN28", [ParseUsingAreaQuirk((81.484,125.389,758.661,534.672))]),
DatasheetPinDefPageParsingInfo([29], "GD32F350Gx", "QFN28", [ParseUsingAreaQuirk((83.717,124.645,359.052,534.672))]),
],
series = "GD32F350", # series
family_type = "B" # family type
)
}

Expand Down
Binary file not shown.

0 comments on commit a62c7e9

Please sign in to comment.