Skip to content

Commit

Permalink
Add Arduino GD32F330xx support
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgerhardt committed Apr 30, 2023
1 parent a62c7e9 commit 9094fb7
Show file tree
Hide file tree
Showing 22 changed files with 129 additions and 37 deletions.
6 changes: 4 additions & 2 deletions boards/genericGD32F330C4.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330c4t6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330C4_GENERIC"
},
"debug": {
"jlink_device": "GD32F330C4",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330C4 (4k RAM, 16k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330C6.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330c6t6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330C6_GENERIC"
},
"debug": {
"jlink_device": "GD32F330C6",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330C6 (4k RAM, 32k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330C8.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330c8t6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330C8_GENERIC"
},
"debug": {
"jlink_device": "GD32F330C8",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330C8 (8k RAM, 64k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330CB.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330cbt6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330CB_GENERIC"
},
"debug": {
"jlink_device": "GD32F330CB",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330CB (16k RAM, 128k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330F4.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330f4p6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330F4_GENERIC"
},
"debug": {
"jlink_device": "GD32F330F4",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330F4 (4k RAM, 16k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330F6.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330f6p6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330F6_GENERIC"
},
"debug": {
"jlink_device": "GD32F330F6",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330F6 (4k RAM, 32k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330F8.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330f8p6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330F8_GENERIC"
},
"debug": {
"jlink_device": "GD32F330F8",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330F8 (8k RAM, 64k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330G4.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330g4u6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330G4_GENERIC"
},
"debug": {
"jlink_device": "GD32F330G4",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330G4 (4k RAM, 16k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330G6.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330g6u6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330G6_GENERIC"
},
"debug": {
"jlink_device": "GD32F330G6",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330G6 (4k RAM, 32k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330G8.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330g8u6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330G8_GENERIC"
},
"debug": {
"jlink_device": "GD32F330G8",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330G8 (8k RAM, 64k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330K4.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330k4u6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330K4_GENERIC"
},
"debug": {
"jlink_device": "GD32F330K4",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330K4 (4k RAM, 16k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330K6.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330k6u6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330K6_GENERIC"
},
"debug": {
"jlink_device": "GD32F330K6",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330K6 (4k RAM, 32k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330K8.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330k8u6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330K8_GENERIC"
},
"debug": {
"jlink_device": "GD32F330K8",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330K8 (8k RAM, 64k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330R8.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330r8t6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330R8_GENERIC"
},
"debug": {
"jlink_device": "GD32F330R8",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330R8 (16k RAM, 64k Flash)",
"upload": {
Expand Down
6 changes: 4 additions & 2 deletions boards/genericGD32F330RB.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"f_cpu": "84000000L",
"mcu": "gd32f330rbt6",
"spl_series": "GD32F3x0",
"series": "GD32F330"
"series": "GD32F330",
"variant": "GD32F330RB_GENERIC"
},
"debug": {
"jlink_device": "GD32F330RB",
Expand All @@ -21,7 +22,8 @@
]
},
"frameworks": [
"spl"
"spl",
"arduino"
],
"name": "GD32F330RB (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", "GD32F350", "GD32E230"]]):
elif any([self.name.startswith(x) for x in ["GD32F190", "GD32F170", "GD32F150", "GD32F130", "GD32F350", "GD32F330", "GD32E230"]]):
self.arduino_variant = self.name_no_package + "_GENERIC"

def infer_mbedos_variant(self):
Expand Down
4 changes: 2 additions & 2 deletions misc/scripts/gd32_genpinmap/datasheet_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ def process_af_dataframe(dfs: DataFrame, datasheet_info: DatasheetParsingInfo, p
if len(af_list_quirks) == 1:
parser_result_alternate_functions = af_list_quirks[0].af_list
else:
alternate_funcs = filter_nans(j)
alternate_funcs = filter_nans(j[1:])
print(alternate_funcs)
if any([not x.startswith("AF") for x in alternate_funcs]):
if not all([x.startswith("AF") for x in alternate_funcs]) or len(alternate_funcs) == 0:
print("Fail: These are not the alternate function descriptions: " + str(alternate_funcs))
# check if we can use the columns:
af_cols = dfs.columns[1:]
Expand Down
3 changes: 2 additions & 1 deletion 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\\GD32F3x0\\GD32F350xx_Datasheet_Rev2.3.pdf"
"C:\\Users\\Max\\Desktop\\gd32_dev\\gigadevice-firmware-and-docs\\GD32F3x0\\GD32F330xx_Datasheet_Rev2.6.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",
Expand Down
55 changes: 54 additions & 1 deletion misc/scripts/gd32_genpinmap/known_datasheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,60 @@
],
series = "GD32F350", # series
family_type = "B" # family type
)
),
"GD32F330xx_Datasheet_Rev2.6.pdf": DatasheetParsingInfo(
alternate_funcs = [
DatasheetAFPageParsingInfo([34], { "1": ["GD32F330x4"], "2": ["GD32F330xB", "GD32F330x8", "GD32F330x6"], "3": ["GD32F330xB", "GD32F330x8"]}, quirks=[
ParseUsingAreaQuirk((125.389,124.645,643.318,536.16)),
]),
DatasheetAFPageParsingInfo([35], { "1": ["GD32F330x4"], "2": ["GD32F330xB", "GD32F330x8", "GD32F330x6"], "3": ["GD32F330xB", "GD32F330x8"]}, quirks=[
ParseUsingAreaQuirk((94.879,125.389,562.205,534.672)),
]),
DatasheetAFPageParsingInfo([36], { "1": ["GD32F330x4"], "2": ["GD32F330xB", "GD32F330x8", "GD32F330x6"], "3": ["GD32F330xB", "GD32F330x8"]}, quirks=[
ParseUsingAreaQuirk((110.506,123.157,405.934,533.928)),
]),
DatasheetAFPageParsingInfo([36], { "1": ["GD32F330x4"], "2": ["GD32F330xB", "GD32F330x8", "GD32F330x6"], "3": ["GD32F330xB", "GD32F330x8"]}, quirks=[
ParseUsingAreaQuirk((442.397,118.692,729.639,539.137)),
]),
DatasheetAFPageParsingInfo([37], { "1": ["GD32F330x4"], "2": ["GD32F330xB", "GD32F330x8", "GD32F330x6"], "3": ["GD32F330xB", "GD32F330x8"]}, quirks=[
ParseUsingAreaQuirk((111.25,123.901,436.444,535.416)),
]),
],
pin_defs = [
# GD32F330Rx
DatasheetPinDefPageParsingInfo([19], "GD32F330Rx", "LQFP64", [
ParseUsingAreaQuirk((169.294,123.901,769.079,535.416)),
OverwritePinDescriptionQuirk("PA2", "Default: PA2\rAlternate: USART1_TX, TIMER1_CH2, TIMER14_CH0\rAdditional: ADC_IN2"),
]),
DatasheetPinDefPageParsingInfo([20], "GD32F330Rx", "LQFP64", [
ParseUsingAreaQuirk((79.996,122.413,768.335,533.928)),
OverwritePinDescriptionQuirk("PB12", "Default: PB12\rAlternate: SPI1_NSS, TIMER0_BKIN, I2C1_SMBA, EVENTOUT"),
]),
DatasheetPinDefPageParsingInfo([21], "GD32F330Rx", "LQFP64", [ParseUsingAreaQuirk((80.74,124.645,768.335,533.183))]),
DatasheetPinDefPageParsingInfo([22], "GD32F330Rx", "LQFP64", [ParseUsingAreaQuirk((81.484,124.645,491.511,533.928))]),
# GD32F330Cx
DatasheetPinDefPageParsingInfo([22], "GD32F330Cx", "LQFP48", [ParseUsingAreaQuirk((636.62,123.157,767.591,534.672))]),
DatasheetPinDefPageParsingInfo([23], "GD32F330Cx", "LQFP48", [ParseUsingAreaQuirk((79.996,117.948,770.567,535.416))]),
DatasheetPinDefPageParsingInfo([24], "GD32F330Cx", "LQFP48", [
ParseUsingAreaQuirk((79.996,123.901,759.405,535.416)),
OverwritePinDescriptionQuirk("PF6", "Default: PF6\rAlternate: I2C0_SCL(3), I2C1_SCL(5)"),
]),
DatasheetPinDefPageParsingInfo([25], "GD32F330Cx", "LQFP48", [ParseUsingAreaQuirk((79.252,123.901,543.602,533.928))]),
# GD32F330Kx (LQFP32)
DatasheetPinDefPageParsingInfo([25], "GD32F330Kx", "LQFP32", [ParseUsingAreaQuirk((688.711,123.157,773.544,535.416))]),
DatasheetPinDefPageParsingInfo([26], "GD32F330Kx", "LQFP32", [ParseUsingAreaQuirk((79.996,123.157,760.893,537.648))]),
DatasheetPinDefPageParsingInfo([27], "GD32F330Kx", "LQFP32", [ParseUsingAreaQuirk((79.252,121.669,670.851,536.16))]),
# GD32F330Kx (QFN32) is ommited here, same info as for LQFP32!
# GD32F330Gx (QFN28)
DatasheetPinDefPageParsingInfo([30], "GD32F330Gx", "QFN28", [ParseUsingAreaQuirk((230.314,120.18,770.567,534))]),
DatasheetPinDefPageParsingInfo([31], "GD32F330Gx", "QFN28", [ParseUsingAreaQuirk((77.764,122.413,735.592,536.16))]),
# GD32F330Fx (TSSOP20)
DatasheetPinDefPageParsingInfo([32], "GD32F330Fx", "TSSOP20", [ParseUsingAreaQuirk((199.06,123.157,766.847,537.648))]),
DatasheetPinDefPageParsingInfo([33], "GD32F330Fx", "TSSOP20", [ParseUsingAreaQuirk((79.252,120.924,352.355,536.904))]),
],
series = "GD32F330", # series
family_type = "B" # family type
),
}

#remapping_infos = [
Expand Down
Loading

0 comments on commit 9094fb7

Please sign in to comment.