#
# Marlin Firmware
# PlatformIO Configuration File
#

####################################
#
# HAL/MFL GD32 Environments
#
####################################

[gd32_base]
platform            = https://github.com/bmourit/platform-mfl/archive/refs/tags/V1.0.4.zip
board_build.core    = gd32
build_src_filter    = ${common.default_src_filter} +<src/HAL/GD32_MFL> +<src/HAL/shared/backtrace>
build_unflags       = -std=gnu++11 -std=gnu++14 -std=gnu++17
build_flags         = -std=gnu++23
                      -DARDUINO_ARCH_MFL
                      -DPLATFORM_M997_SUPPORT
                      -DTIMER_IRQ_PRIORITY=12
                      -DADC_RESOLUTION=12
                      -DCORE_DEBUG
                      -Wno-deprecated-declarations
extra_scripts       = ${common.extra_scripts}

#
# Creality (GD32F303RE)
#
[env:GD32F303RE_creality_mfl]
extends                     = gd32_base
board                       = mfl_creality_v4
board_build.offset          = 0x7000
board_upload.offset_address = 0x08007000
board_build.rename          = firmware-{time}.bin
build_flags                 = ${gd32_base.build_flags}
                              -DMCU_GD32F303RE
                              -DGD32F303RE
                              -DTIMER_TONE=2
                              -DSS_TIMER=3
                              -DTIMER_SERVO=4
                              -DTRANSFER_CLOCK_DIV=8
                              -fsingle-precision-constant
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
