Skip to content

Commit 3f5d713

Browse files
Fix some GD32 legacy pin name issues
1 parent b641cbe commit 3f5d713

File tree

8 files changed

+135
-70
lines changed

8 files changed

+135
-70
lines changed

hal/tests/TESTS/mbed_hal/sleep_manager_racecondition/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void sleep_manager_locking_thread_test()
3232
{
3333
for (uint32_t i = 0; i < 100; i++) {
3434
sleep_manager_lock_deep_sleep();
35-
ThisThread::sleep_for(25);
35+
ThisThread::sleep_for(25ms);
3636
sleep_manager_unlock_deep_sleep();
3737
}
3838
}
@@ -45,7 +45,7 @@ void sleep_manager_multithread_test()
4545
Thread t2(osPriorityNormal, TEST_STACK_SIZE);
4646

4747
t1.start(callback(cb));
48-
ThisThread::sleep_for(25);
48+
ThisThread::sleep_for(25ms);
4949
t2.start(callback(cb));
5050

5151
// Wait for the threads to finish
@@ -70,7 +70,7 @@ void sleep_manager_irq_test()
7070
Ticker ticker1;
7171
Timer timer;
7272

73-
ticker1.attach_us(&sleep_manager_locking_irq_test, 1000);
73+
ticker1.attach(&sleep_manager_locking_irq_test, 1ms);
7474

7575
// run this for 10 seconds
7676
timer.start();

hal/tests/TESTS/pin_names/arduino_uno/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void UART_test()
154154
}
155155

156156
// 3. check if Arduino_uno pins are not using the same UART instance as console
157-
int console_uart = pinmap_peripheral(CONSOLE_TX, serial_tx_pinmap());
157+
uint32_t console_uart = pinmap_peripheral(CONSOLE_TX, serial_tx_pinmap());
158158
if (console_uart != 0) {
159159
TEST_ASSERT_NOT_EQUAL(console_uart, pinmap_peripheral(TX_pin, serial_tx_pinmap()));
160160
}

platform/tests/TESTS/mbed_functional/callback/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -755,11 +755,6 @@ static int construct_count;
755755
static int destruct_count;
756756
static int copy_count;
757757

758-
static int live_count()
759-
{
760-
return construct_count - destruct_count;
761-
}
762-
763758
struct FunctionObject {
764759
FunctionObject(int n) : val(n)
765760
{
@@ -824,6 +819,11 @@ void test_trivial()
824819
}
825820

826821
#if MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL
822+
static int live_count()
823+
{
824+
return construct_count - destruct_count;
825+
}
826+
827827
void test_nontrivial()
828828
{
829829
{

targets/TARGET_GigaDevice/TARGET_GD32F30X/TARGET_GD32F307VG/PinNames.h

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -151,30 +151,31 @@ typedef enum {
151151
ADC_TEMP = 0xF0,
152152
ADC_VREF = 0xF1,
153153

154-
154+
#ifdef TARGET_FF_ARDUINO_UNO
155155
/* Arduino connector namings */
156-
A0 = PORTC_0,
157-
A1 = PORTC_1,
158-
A2 = PORTC_2,
159-
A3 = PORTC_3,
160-
A4 = PORTA_0,
161-
A5 = PORTB_1,
162-
D0 = PORTA_3,
163-
D1 = PORTA_2,
164-
D2 = PORTE_4,
165-
D3 = PORTD_12,
166-
D4 = PORTB_3,
167-
D5 = PORTC_7,
168-
D6 = PORTB_0,
169-
D7 = PORTB_4,
170-
D8 = PORTD_11,
171-
D9 = PORTE_5,
172-
D10 = PORTA_8,
173-
D11 = PORTB_15,
174-
D12 = PORTB_14,
175-
D13 = PORTB_13,
176-
D14 = PORTB_9,
177-
D15 = PORTB_8,
156+
ARDUINO_UNO_A0 = PORTC_0,
157+
ARDUINO_UNO_A1 = PORTC_1,
158+
ARDUINO_UNO_A2 = PORTC_2,
159+
ARDUINO_UNO_A3 = PORTC_3,
160+
ARDUINO_UNO_A4 = PORTA_0,
161+
ARDUINO_UNO_A5 = PORTB_1,
162+
ARDUINO_UNO_D0 = PORTA_3,
163+
ARDUINO_UNO_D1 = PORTA_2,
164+
ARDUINO_UNO_D2 = PORTE_4,
165+
ARDUINO_UNO_D3 = PORTD_12,
166+
ARDUINO_UNO_D4 = PORTB_3,
167+
ARDUINO_UNO_D5 = PORTC_7,
168+
ARDUINO_UNO_D6 = PORTB_0,
169+
ARDUINO_UNO_D7 = PORTB_4,
170+
ARDUINO_UNO_D8 = PORTD_11,
171+
ARDUINO_UNO_D9 = PORTE_5,
172+
ARDUINO_UNO_D10 = PORTA_8,
173+
ARDUINO_UNO_D11 = PORTB_15,
174+
ARDUINO_UNO_D12 = PORTB_14,
175+
ARDUINO_UNO_D13 = PORTB_13,
176+
ARDUINO_UNO_D14 = PORTB_9,
177+
ARDUINO_UNO_D15 = PORTB_8,
178+
#endif
178179

179180
LED1 = PORTE_0,
180181
LED2 = PORTE_1,
@@ -191,13 +192,7 @@ typedef enum {
191192
CONSOLE_TX = SERIAL_TX,
192193
CONSOLE_RX = SERIAL_RX,
193194

194-
I2C_SCL = D15,
195-
I2C_SDA = D14,
196-
SPI_MOSI = D11,
197-
SPI_MISO = D12,
198-
SPI_SCK = D13,
199-
SPI_CS = D10,
200-
PWM_OUT = D9,
195+
PWM_OUT = PORTE_5,
201196

202197
USBFS_VBUS = PORTA_9,
203198
USBFS_DM = PORTA_11,

targets/TARGET_GigaDevice/TARGET_GD32F4XX/TARGET_GD32F450ZI/PinNames.h

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -207,29 +207,31 @@ typedef enum {
207207
ADC_VREF = 0xF1,
208208
ADC_VBAT = 0xF2,
209209

210+
#ifdef TARGET_FF_ARDUINO_UNO
210211
/* Arduino connector pin definitions */
211-
A0 = PORTC_0,
212-
A1 = PORTA_5,
213-
A2 = PORTC_2,
214-
A3 = PORTC_3,
215-
A4 = PORTA_0, /* PORTB_11 */
216-
A5 = PORTC_5, /* PORTB_10 */
217-
D0 = PORTC_11,
218-
D1 = PORTC_10,
219-
D2 = PORTA_15,
220-
D3 = PORTD_12,
221-
D4 = PORTC_8,
222-
D5 = PORTC_7,
223-
D6 = PORTB_0,
224-
D7 = PORTC_12,
225-
D8 = PORTD_13,
226-
D9 = PORTA_8,
227-
D10 = PORTA_1,
228-
D11 = PORTB_15,
229-
D12 = PORTB_14,
230-
D13 = PORTB_13,
231-
D14 = PORTB_9,
232-
D15 = PORTB_8,
212+
ARDUINO_UNO_A0 = PORTC_0,
213+
ARDUINO_UNO_A1 = PORTA_5,
214+
ARDUINO_UNO_A2 = PORTC_2,
215+
ARDUINO_UNO_A3 = PORTC_3,
216+
ARDUINO_UNO_A4 = PORTA_0, /* PORTB_11 */
217+
ARDUINO_UNO_A5 = PORTC_5, /* PORTB_10 */
218+
ARDUINO_UNO_D0 = PORTC_11,
219+
ARDUINO_UNO_D1 = PORTC_10,
220+
ARDUINO_UNO_D2 = PORTA_15,
221+
ARDUINO_UNO_D3 = PORTD_12,
222+
ARDUINO_UNO_D4 = PORTC_8,
223+
ARDUINO_UNO_D5 = PORTC_7,
224+
ARDUINO_UNO_D6 = PORTB_0,
225+
ARDUINO_UNO_D7 = PORTC_12,
226+
ARDUINO_UNO_D8 = PORTD_13,
227+
ARDUINO_UNO_D9 = PORTA_8,
228+
ARDUINO_UNO_D10 = PORTA_1,
229+
ARDUINO_UNO_D11 = PORTB_15,
230+
ARDUINO_UNO_D12 = PORTB_14,
231+
ARDUINO_UNO_D13 = PORTB_13,
232+
ARDUINO_UNO_D14 = PORTB_9,
233+
ARDUINO_UNO_D15 = PORTB_8,
234+
#endif
233235

234236
LED1 = PORTF_6,
235237
LED2 = PORTC_13,
@@ -246,13 +248,7 @@ typedef enum {
246248
CONSOLE_TX = SERIAL_TX,
247249
CONSOLE_RX = SERIAL_RX,
248250

249-
I2C_SCL = PORTB_6,
250-
I2C_SDA = PORTB_7,
251-
SPI_MOSI = PORTB_5,
252-
SPI_MISO = PORTB_4,
253-
SPI_SCK = PORTB_3,
254-
SPI_CS = PORTE_2,
255-
PWM_OUT = D9,
251+
PWM_OUT = PORTA_8,
256252

257253
USBFS_VBUS = PORTA_9,
258254
USBFS_DM = PORTA_11,

targets/cmsis_mcu_descriptions.json5

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,78 @@
12611261
"sub_family": "EFR32MG12P332",
12621262
"vendor": "Silicon Labs:21"
12631263
},
1264+
"GD32F307VG": {
1265+
"algorithms": [
1266+
{
1267+
"default": true,
1268+
"file_name": "Flash/GD32F30x_CL.FLM",
1269+
"ram_size": null,
1270+
"ram_start": null,
1271+
"size": 1048576,
1272+
"start": 134217728,
1273+
"style": "Keil"
1274+
}
1275+
],
1276+
"family": "GD32F30x Series",
1277+
"from_pack": {
1278+
"pack": "GD32F30x_DFP",
1279+
"url": "https://gd32mcu.com/data/documents/pack/",
1280+
"vendor": "GigaDevice",
1281+
"version": "2.2.1"
1282+
},
1283+
"memories": {
1284+
"IRAM1": {
1285+
"access": {
1286+
"execute": false,
1287+
"non_secure": false,
1288+
"non_secure_callable": false,
1289+
"peripheral": false,
1290+
"read": true,
1291+
"secure": false,
1292+
"write": true
1293+
},
1294+
"default": true,
1295+
"p_name": null,
1296+
"size": 98304,
1297+
"start": 536870912,
1298+
"startup": false
1299+
},
1300+
"IROM1": {
1301+
"access": {
1302+
"execute": true,
1303+
"non_secure": false,
1304+
"non_secure_callable": false,
1305+
"peripheral": false,
1306+
"read": true,
1307+
"secure": false,
1308+
"write": false
1309+
},
1310+
"default": true,
1311+
"p_name": null,
1312+
"size": 1048576,
1313+
"start": 134217728,
1314+
"startup": true
1315+
}
1316+
},
1317+
"name": "GD32F307VG",
1318+
"processors": [
1319+
{
1320+
"address": null,
1321+
"ap": 0,
1322+
"apid": null,
1323+
"core": "CortexM4",
1324+
"default_reset_sequence": null,
1325+
"dp": 0,
1326+
"fpu": "SinglePrecision",
1327+
"mpu": "Present",
1328+
"name": null,
1329+
"svd": "SVD/GD32F30x_CL.svd",
1330+
"unit": 0
1331+
}
1332+
],
1333+
"sub_family": "GD32F307",
1334+
"vendor": "GigaDevice:123"
1335+
},
12641336
"GD32F450ZI": {
12651337
"algorithms": [
12661338
{

targets/targets.json5

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9304,7 +9304,7 @@
93049304
"GD32_Target"
93059305
],
93069306
"supported_form_factors": [
9307-
"ARDUINO"
9307+
"ARDUINO_UNO"
93089308
],
93099309
"core": "Cortex-M4F",
93109310
"extra_labels_add": [
@@ -9339,14 +9339,15 @@
93399339
"overrides": {
93409340
"network-default-interface-type": "ETHERNET"
93419341
},
9342+
"device_name": "GD32F307VG",
93429343
"image_url": "https://os.mbed.com/media/uploads/Ray_Chen/307-1.png"
93439344
},
93449345
"GD32_F450ZI": {
93459346
"inherits": [
93469347
"GD32_Target"
93479348
],
93489349
"supported_form_factors": [
9349-
"ARDUINO"
9350+
"ARDUINO_UNO"
93509351
],
93519352
"core": "Cortex-M4F",
93529353
"extra_labels_add": [

tools/cmake/toolchains/GCC_ARM.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ list(APPEND common_options
3434
"-Wextra"
3535
"-Wno-unused-parameter"
3636
"-Wno-missing-field-initializers"
37+
"-Wno-psabi" # Disable "parameter passing changed in GCC 7.1" warning
3738
"-fmessage-length=0"
3839
"-fno-exceptions"
3940
"-ffunction-sections"

0 commit comments

Comments
 (0)