From bdc0bd0eef1920ff850434eeb0954d8c5715001a Mon Sep 17 00:00:00 2001 From: Boyd Date: Mon, 7 Apr 2025 16:22:58 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Native=20GD32=20support=20for=20Aqu?= =?UTF-8?q?ila=20v1.0.1=20(#27765)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-build-tests.yml | 3 ++ Marlin/src/HAL/GD32_MFL/HAL.h | 4 +- Marlin/src/core/boards.h | 10 ++++- .../pins/gd32f1/pins_AQUILA_101_GD32_MFL.h | 37 +++++++++++++++++++ Marlin/src/pins/pins.h | 7 ++++ Marlin/src/pins/stm32f1/env_validate.h | 5 ++- buildroot/tests/GD32F103RC_aquila_mfl | 17 +++++++++ ini/gd32.ini | 27 ++++++++++++-- 8 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 Marlin/src/pins/gd32f1/pins_AQUILA_101_GD32_MFL.h create mode 100755 buildroot/tests/GD32F103RC_aquila_mfl diff --git a/.github/workflows/ci-build-tests.yml b/.github/workflows/ci-build-tests.yml index 2fd316ec0f..58fd02eb5d 100644 --- a/.github/workflows/ci-build-tests.yml +++ b/.github/workflows/ci-build-tests.yml @@ -154,6 +154,9 @@ jobs: # GD32F3 - GD32F303RE_creality_mfl + # GD32F1 + - GD32F103RC_aquila_mfl + # LPC176x - Lengthy tests - LPC1768 - LPC1769 diff --git a/Marlin/src/HAL/GD32_MFL/HAL.h b/Marlin/src/HAL/GD32_MFL/HAL.h index a8a28cc7f3..fd3a10d72b 100644 --- a/Marlin/src/HAL/GD32_MFL/HAL.h +++ b/Marlin/src/HAL/GD32_MFL/HAL.h @@ -82,7 +82,9 @@ typedef libServo hal_servo_t; // Disable Marlin's software oversampling. // The MFL framework uses 16x hardware oversampling by default -#define HAL_ADC_FILTERED +#ifdef GD32F303RE + #define HAL_ADC_FILTERED +#endif #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 3d34e3717e..e7851d001a 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -549,14 +549,20 @@ // HC32 ARM Cortex-M4 // -#define BOARD_AQUILA_V101 7200 // Voxelab Aquila V1.0.0/V1.0.1/V1.0.2/V1.0.3 as found in the Voxelab Aquila X2 and C2 +#define BOARD_AQUILA_V101 7200 // Voxelab Aquila V1.0.0/1/2/3 (e.g., Aquila X2, C2). ... GD32 Variant Below! #define BOARD_CREALITY_ENDER2P_V24S4 7201 // Creality Ender 2 Pro v2.4.S4_170 (HC32f460kcta) +// +// GD32 ARM Cortex-M3 +// + +#define BOARD_AQUILA_V101_GD32_MFL 7300 // Voxelab Aquila V1.0.1 MFL (GD32F103RC) ... STM32/HC32 Variant Above! + // // GD32 ARM Cortex-M4 // -#define BOARD_CREALITY_V422_GD32_MFL 7300 // Creality V4.2.2 MFL (GD32F303RE) ... STM32 Variant Above! +#define BOARD_CREALITY_V422_GD32_MFL 7400 // Creality V4.2.2 MFL (GD32F303RE) ... STM32 Variant Above! // // Raspberry Pi diff --git a/Marlin/src/pins/gd32f1/pins_AQUILA_101_GD32_MFL.h b/Marlin/src/pins/gd32f1/pins_AQUILA_101_GD32_MFL.h new file mode 100644 index 0000000000..f3bc9378e9 --- /dev/null +++ b/Marlin/src/pins/gd32f1/pins_AQUILA_101_GD32_MFL.h @@ -0,0 +1,37 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2025 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Aquila v1.0.1 GD32 MFL (GD32F103RC) board pin assignments + */ + +#define ALLOW_GD32F1 + +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "Aquila v1.0.1 GD32 MFL" +#endif +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME "Aquila" +#endif + +#include "../stm32f1/pins_CREALITY_V4.h" diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 2e0919062c..dcb8415de8 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -964,6 +964,13 @@ #elif MB(CREALITY_ENDER2P_V24S4) #include "hc32f4/pins_CREALITY_ENDER2P_V24S4.h" // HC32F460 env:HC32F460C_e2p24s4 +// +// GD32 ARM Cortex-M3 +// + +#elif MB(AQUILA_V101_GD32_MFL) + #include "gd32f1/pins_AQUILA_101_GD32_MFL.h" // GD32F103RC env:GD32F103RC_aquila_mfl + // // GD32 ARM Cortex-M4 // diff --git a/Marlin/src/pins/stm32f1/env_validate.h b/Marlin/src/pins/stm32f1/env_validate.h index 34b07723e7..e219e7cd51 100644 --- a/Marlin/src/pins/stm32f1/env_validate.h +++ b/Marlin/src/pins/stm32f1/env_validate.h @@ -23,16 +23,19 @@ #define ENV_VALIDATE_H #if NOT_TARGET(__STM32F1__, STM32F1) - #if NONE(ALLOW_STM32F4, ALLOW_GD32F3) + #if NONE(ALLOW_STM32F4, ALLOW_GD32F3, ALLOW_GD32F1) #error "Oops! Select an STM32F1 board in 'Tools > Board.'" #elif ENABLED(ALLOW_STM32F4) && NOT_TARGET(STM32F4) #error "Oops! Select an STM32F4 board in 'Tools > Board.'" #elif ENABLED(ALLOW_GD32F3) && NOT_TARGET(ARDUINO_ARCH_MFL) #error "Oops! Make sure you have a GD32F3 MFL environment selected." + #elif ENABLED(ALLOW_GD32F1) && NOT_TARGET(ARDUINO_ARCH_MFL) + #error "Oops! Make sure you have a GD32F1 MFL environment selected." #endif #endif #undef ALLOW_STM32F4 #undef ALLOW_GD32F3 +#undef ALLOW_GD32F1 #endif diff --git a/buildroot/tests/GD32F103RC_aquila_mfl b/buildroot/tests/GD32F103RC_aquila_mfl new file mode 100755 index 0000000000..ca7cd05936 --- /dev/null +++ b/buildroot/tests/GD32F103RC_aquila_mfl @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# Build tests for GD32F103RC_aquila_mfl +# + +# exit on first failure +set -e + +restore_configs +opt_set MOTHERBOARD BOARD_AQUILA_V101_GD32_MFL SERIAL_PORT 0 +opt_enable EEPROM_SETTINGS SDSUPPORT EMERGENCY_PARSER FAN_SOFT_PWM PINS_DEBUGGING +opt_add NO_CREALITY_422_DRIVER_WARNING +opt_add NO_AUTO_ASSIGN_WARNING +exec_test $1 $2 "Aquila v1.0.1 MFL GD32 Default Configuration" "$3" + +# cleanup +restore_configs diff --git a/ini/gd32.ini b/ini/gd32.ini index 1286772786..e983f496ec 100644 --- a/ini/gd32.ini +++ b/ini/gd32.ini @@ -30,8 +30,8 @@ extra_scripts = ${common.extra_scripts} extends = gd32_base board = mfl_creality_422 board_build.offset = 0x7000 -board_build.rename = firmware-{time}.bin board_upload.offset_address = 0x08007000 +board_build.rename = firmware-{time}.bin build_flags = ${gd32_base.build_flags} -DMCU_GD32F303RE -DGD32F303RE @@ -40,7 +40,26 @@ build_flags = ${gd32_base.build_flags} -DTIMER_SERVO=4 -DTRANSFER_CLOCK_DIV=8 -fsingle-precision-constant -extra_scripts = ${gd32_base.extra_scripts} - buildroot/share/PlatformIO/scripts/offset_and_rename.py - +extra_scripts = ${gd32_base.extra_scripts} + buildroot/share/PlatformIO/scripts/offset_and_rename.py +monitor_speed = 115200 + +# +# Aquila v1.0.1 (GD32F103RC) +# +[env:GD32F103RC_aquila_mfl] +extends = gd32_base +board = mfl_aquila +board_build.offset = 0x7000 +board_upload.offset_address = 0x08007000 +board_build.rename = firmware-{time}.bin +build_flags = ${gd32_base.build_flags} + -DMCU_GD32F103RC + -DGD32F103RC + -DTIMER_TONE=2 + -DSS_TIMER=3 + -DTIMER_SERVO=4 + -DTRANSFER_CLOCK_DIV=8 +extra_scripts = ${gd32_base.extra_scripts} + buildroot/share/PlatformIO/scripts/offset_and_rename.py monitor_speed = 115200