Skip to content

Commit

Permalink
Fix some GD32 legacy pin name issues
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Sep 22, 2024
1 parent 9b4e213 commit 10bd7b9
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 70 deletions.
6 changes: 3 additions & 3 deletions hal/tests/TESTS/mbed_hal/sleep_manager_racecondition/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void sleep_manager_locking_thread_test()
{
for (uint32_t i = 0; i < 100; i++) {
sleep_manager_lock_deep_sleep();
ThisThread::sleep_for(25);
ThisThread::sleep_for(25ms);
sleep_manager_unlock_deep_sleep();
}
}
Expand All @@ -45,7 +45,7 @@ void sleep_manager_multithread_test()
Thread t2(osPriorityNormal, TEST_STACK_SIZE);

t1.start(callback(cb));
ThisThread::sleep_for(25);
ThisThread::sleep_for(25ms);
t2.start(callback(cb));

// Wait for the threads to finish
Expand All @@ -70,7 +70,7 @@ void sleep_manager_irq_test()
Ticker ticker1;
Timer timer;

ticker1.attach_us(&sleep_manager_locking_irq_test, 1000);
ticker1.attach(&sleep_manager_locking_irq_test, 1ms);

// run this for 10 seconds
timer.start();
Expand Down
2 changes: 1 addition & 1 deletion hal/tests/TESTS/pin_names/arduino_uno/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void UART_test()
}

// 3. check if Arduino_uno pins are not using the same UART instance as console
int console_uart = pinmap_peripheral(CONSOLE_TX, serial_tx_pinmap());
uint32_t console_uart = pinmap_peripheral(CONSOLE_TX, serial_tx_pinmap());
if (console_uart != 0) {
TEST_ASSERT_NOT_EQUAL(console_uart, pinmap_peripheral(TX_pin, serial_tx_pinmap()));
}
Expand Down
10 changes: 5 additions & 5 deletions platform/tests/TESTS/mbed_functional/callback/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,11 +755,6 @@ static int construct_count;
static int destruct_count;
static int copy_count;

static int live_count()
{
return construct_count - destruct_count;
}

struct FunctionObject {
FunctionObject(int n) : val(n)
{
Expand Down Expand Up @@ -824,6 +819,11 @@ void test_trivial()
}

#if MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL
static int live_count()
{
return construct_count - destruct_count;
}

void test_nontrivial()
{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,30 +151,31 @@ typedef enum {
ADC_TEMP = 0xF0,
ADC_VREF = 0xF1,


#ifdef TARGET_FF_ARDUINO_UNO
/* Arduino connector namings */
A0 = PORTC_0,
A1 = PORTC_1,
A2 = PORTC_2,
A3 = PORTC_3,
A4 = PORTA_0,
A5 = PORTB_1,
D0 = PORTA_3,
D1 = PORTA_2,
D2 = PORTE_4,
D3 = PORTD_12,
D4 = PORTB_3,
D5 = PORTC_7,
D6 = PORTB_0,
D7 = PORTB_4,
D8 = PORTD_11,
D9 = PORTE_5,
D10 = PORTA_8,
D11 = PORTB_15,
D12 = PORTB_14,
D13 = PORTB_13,
D14 = PORTB_9,
D15 = PORTB_8,
ARDUINO_UNO_A0 = PORTC_0,
ARDUINO_UNO_A1 = PORTC_1,
ARDUINO_UNO_A2 = PORTC_2,
ARDUINO_UNO_A3 = PORTC_3,
ARDUINO_UNO_A4 = PORTA_0,
ARDUINO_UNO_A5 = PORTB_1,
ARDUINO_UNO_D0 = PORTA_3,
ARDUINO_UNO_D1 = PORTA_2,
ARDUINO_UNO_D2 = PORTE_4,
ARDUINO_UNO_D3 = PORTD_12,
ARDUINO_UNO_D4 = PORTB_3,
ARDUINO_UNO_D5 = PORTC_7,
ARDUINO_UNO_D6 = PORTB_0,
ARDUINO_UNO_D7 = PORTB_4,
ARDUINO_UNO_D8 = PORTD_11,
ARDUINO_UNO_D9 = PORTE_5,
ARDUINO_UNO_D10 = PORTA_8,
ARDUINO_UNO_D11 = PORTB_15,
ARDUINO_UNO_D12 = PORTB_14,
ARDUINO_UNO_D13 = PORTB_13,
ARDUINO_UNO_D14 = PORTB_9,
ARDUINO_UNO_D15 = PORTB_8,
#endif

LED1 = PORTE_0,
LED2 = PORTE_1,
Expand All @@ -191,13 +192,7 @@ typedef enum {
CONSOLE_TX = SERIAL_TX,
CONSOLE_RX = SERIAL_RX,

I2C_SCL = D15,
I2C_SDA = D14,
SPI_MOSI = D11,
SPI_MISO = D12,
SPI_SCK = D13,
SPI_CS = D10,
PWM_OUT = D9,
PWM_OUT = PORTE_5,

USBFS_VBUS = PORTA_9,
USBFS_DM = PORTA_11,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,29 +207,31 @@ typedef enum {
ADC_VREF = 0xF1,
ADC_VBAT = 0xF2,

#ifdef TARGET_FF_ARDUINO_UNO
/* Arduino connector pin definitions */
A0 = PORTC_0,
A1 = PORTA_5,
A2 = PORTC_2,
A3 = PORTC_3,
A4 = PORTA_0, /* PORTB_11 */
A5 = PORTC_5, /* PORTB_10 */
D0 = PORTC_11,
D1 = PORTC_10,
D2 = PORTA_15,
D3 = PORTD_12,
D4 = PORTC_8,
D5 = PORTC_7,
D6 = PORTB_0,
D7 = PORTC_12,
D8 = PORTD_13,
D9 = PORTA_8,
D10 = PORTA_1,
D11 = PORTB_15,
D12 = PORTB_14,
D13 = PORTB_13,
D14 = PORTB_9,
D15 = PORTB_8,
ARDUINO_UNO_A0 = PORTC_0,
ARDUINO_UNO_A1 = PORTA_5,
ARDUINO_UNO_A2 = PORTC_2,
ARDUINO_UNO_A3 = PORTC_3,
ARDUINO_UNO_A4 = PORTA_0, /* PORTB_11 */
ARDUINO_UNO_A5 = PORTC_5, /* PORTB_10 */
ARDUINO_UNO_D0 = PORTC_11,
ARDUINO_UNO_D1 = PORTC_10,
ARDUINO_UNO_D2 = PORTA_15,
ARDUINO_UNO_D3 = PORTD_12,
ARDUINO_UNO_D4 = PORTC_8,
ARDUINO_UNO_D5 = PORTC_7,
ARDUINO_UNO_D6 = PORTB_0,
ARDUINO_UNO_D7 = PORTC_12,
ARDUINO_UNO_D8 = PORTD_13,
ARDUINO_UNO_D9 = PORTA_8,
ARDUINO_UNO_D10 = PORTA_1,
ARDUINO_UNO_D11 = PORTB_15,
ARDUINO_UNO_D12 = PORTB_14,
ARDUINO_UNO_D13 = PORTB_13,
ARDUINO_UNO_D14 = PORTB_9,
ARDUINO_UNO_D15 = PORTB_8,
#endif

LED1 = PORTF_6,
LED2 = PORTC_13,
Expand All @@ -246,13 +248,7 @@ typedef enum {
CONSOLE_TX = SERIAL_TX,
CONSOLE_RX = SERIAL_RX,

I2C_SCL = PORTB_6,
I2C_SDA = PORTB_7,
SPI_MOSI = PORTB_5,
SPI_MISO = PORTB_4,
SPI_SCK = PORTB_3,
SPI_CS = PORTE_2,
PWM_OUT = D9,
PWM_OUT = PORTA_8,

USBFS_VBUS = PORTA_9,
USBFS_DM = PORTA_11,
Expand Down
72 changes: 72 additions & 0 deletions targets/cmsis_mcu_descriptions.json5
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,78 @@
"sub_family": "EFR32MG12P332",
"vendor": "Silicon Labs:21"
},
"GD32F307VG": {
"algorithms": [
{
"default": true,
"file_name": "Flash/GD32F30x_CL.FLM",
"ram_size": null,
"ram_start": null,
"size": 1048576,
"start": 134217728,
"style": "Keil"
}
],
"family": "GD32F30x Series",
"from_pack": {
"pack": "GD32F30x_DFP",
"url": "https://gd32mcu.com/data/documents/pack/",
"vendor": "GigaDevice",
"version": "2.2.1"
},
"memories": {
"IRAM1": {
"access": {
"execute": false,
"non_secure": false,
"non_secure_callable": false,
"peripheral": false,
"read": true,
"secure": false,
"write": true
},
"default": true,
"p_name": null,
"size": 98304,
"start": 536870912,
"startup": false
},
"IROM1": {
"access": {
"execute": true,
"non_secure": false,
"non_secure_callable": false,
"peripheral": false,
"read": true,
"secure": false,
"write": false
},
"default": true,
"p_name": null,
"size": 1048576,
"start": 134217728,
"startup": true
}
},
"name": "GD32F307VG",
"processors": [
{
"address": null,
"ap": 0,
"apid": null,
"core": "CortexM4",
"default_reset_sequence": null,
"dp": 0,
"fpu": "SinglePrecision",
"mpu": "Present",
"name": null,
"svd": "SVD/GD32F30x_CL.svd",
"unit": 0
}
],
"sub_family": "GD32F307",
"vendor": "GigaDevice:123"
},
"GD32F450ZI": {
"algorithms": [
{
Expand Down
5 changes: 3 additions & 2 deletions targets/targets.json5
Original file line number Diff line number Diff line change
Expand Up @@ -9304,7 +9304,7 @@
"GD32_Target"
],
"supported_form_factors": [
"ARDUINO"
"ARDUINO_UNO"
],
"core": "Cortex-M4F",
"extra_labels_add": [
Expand Down Expand Up @@ -9339,14 +9339,15 @@
"overrides": {
"network-default-interface-type": "ETHERNET"
},
"device_name": "GD32F307VG",
"image_url": "https://os.mbed.com/media/uploads/Ray_Chen/307-1.png"
},
"GD32_F450ZI": {
"inherits": [
"GD32_Target"
],
"supported_form_factors": [
"ARDUINO"
"ARDUINO_UNO"
],
"core": "Cortex-M4F",
"extra_labels_add": [
Expand Down
1 change: 1 addition & 0 deletions tools/cmake/toolchains/GCC_ARM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ list(APPEND common_options
"-Wextra"
"-Wno-unused-parameter"
"-Wno-missing-field-initializers"
"-Wno-psabi" # Disable "parameter passing changed in GCC 7.1" warning
"-fmessage-length=0"
"-fno-exceptions"
"-ffunction-sections"
Expand Down

0 comments on commit 10bd7b9

Please sign in to comment.