Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Add" support for gd32f10x board #109

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,894 changes: 986 additions & 908 deletions boards.txt

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion cores/arduino/analog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ OF SUCH DAMAGE.
#define ADC_NUMS 1
#elif defined(GD32E23x)
#define ADC_NUMS 1
#elif defined(GD32F10x)
#define ADC_NUMS 3
#elif defined(GD32E50X)
#ifdef ADC2
#define ADC_NUMS 3
Expand Down Expand Up @@ -116,7 +118,7 @@ void set_dac_value(PinName pinname, uint16_t value)
#if defined(GD32F30x) || (defined(GD32F1x0) && defined(GD32F170_190)) || defined(GD32E50X)
dac_data_set(dac_periph, DAC_ALIGN_12B_R, value);
#elif defined(GD32F10x) && !defined(GD32F170_190)
dac0_data_set(DAC_ALIGN_12B_R, value);
// dac0_data_set(DAC_ALIGN_12B_R, value);
dmlambo marked this conversation as resolved.
Show resolved Hide resolved
#elif defined(GD32F3x0)
dac_data_set(DAC_ALIGN_12B_R, value);
#endif
Expand Down
24 changes: 24 additions & 0 deletions cores/arduino/gd32/Source/gd32xxyy_src.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,30 @@
#include "gd32f1x0_ivref.c"
#include "gd32f1x0_can.c"
#endif /* GD32F170_190 */
#elif defined(GD32F10x)
#include "gd32f10x_adc.c"
#include "gd32f10x_bkp.c"
#include "gd32f10x_can.c"
#include "gd32f10x_crc.c"
#include "gd32f10x_dac.c"
#include "gd32f10x_dbg.c"
#include "gd32f10x_dma.c"
#include "gd32f10x_enet.c"
#include "gd32f10x_exmc.c"
#include "gd32f10x_exti.c"
#include "gd32f10x_fmc.c"
#include "gd32f10x_fwdgt.c"
#include "gd32f10x_gpio.c"
#include "gd32f10x_i2c.c"
#include "gd32f10x_misc.c"
#include "gd32f10x_pmu.c"
#include "gd32f10x_rcu.c"
#include "gd32f10x_rtc.c"
#include "gd32f10x_sdio.c"
#include "gd32f10x_spi.c"
#include "gd32f10x_timer.c"
#include "gd32f10x_usart.c"
#include "gd32f10x_wwdgt.c"
#elif defined(GD32E23x)
#include "gd32e23x_adc.c"
#include "gd32e23x_cmp.c"
Expand Down
66 changes: 66 additions & 0 deletions cores/arduino/gd32/gd32f10x_libopt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*!
\file gd32f10x_libopt.h
\brief library optional for gd32f10x

\version 2014-12-26, V1.0.0, firmware for GD32F10x
\version 2017-06-20, V2.0.0, firmware for GD32F10x
\version 2018-07-31, V2.1.0, firmware for GD32F10x
*/

/*
Copyright (c) 2018, GigaDevice Semiconductor Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/

#ifndef GD32F10X_LIBOPT_H
#define GD32F10X_LIBOPT_H

#include "gd32f10x_adc.h"
#include "gd32f10x_bkp.h"
#include "gd32f10x_can.h"
#include "gd32f10x_crc.h"
#include "gd32f10x_dac.h"
#include "gd32f10x_dma.h"
#include "gd32f10x_enet.h"
#include "gd32f10x_exmc.h"
#include "gd32f10x_exti.h"
#include "gd32f10x_fmc.h"
#include "gd32f10x_gpio.h"
#include "gd32f10x_i2c.h"
#include "gd32f10x_fwdgt.h"
#include "gd32f10x_dbg.h"
#include "gd32f10x_misc.h"
#include "gd32f10x_pmu.h"
#include "gd32f10x_rcu.h"
#include "gd32f10x_rtc.h"
#include "gd32f10x_sdio.h"
#include "gd32f10x_spi.h"
#include "gd32f10x_timer.h"
#include "gd32f10x_usart.h"
#include "gd32f10x_wwdgt.h"

#endif /* GD32F10X_LIBOPT_H */
8 changes: 8 additions & 0 deletions cores/arduino/gd32/startup_gd32xxyy.S
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
#include "startup_gd32f3x0.S"
#elif defined(GD32F1x0)
#include "startup_gd32f1x0.S"
#elif defined(GD32F10X_CL)
#include "startup_gd32f10x_cl.S"
#elif defined(GD32F10X_HD)
#include "startup_gd32f10x_hd.S"
#elif defined(GD32F10X_MD)
#include "startup_gd32f10x_md.S"
#elif defined(GD32F10X_XD)
#include "startup_gd32f10x_xd.S"
#elif defined(GD32E23x)
#include "startup_gd32e23x.S"
#elif defined(GD32E50X_HD)
Expand Down
2 changes: 2 additions & 0 deletions cores/arduino/gd32/system_gd32xxyy.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "system_gd32f3x0.c"
#elif defined(GD32F1x0)
#include "system_gd32f1x0.c"
#elif defined(GD32F10x)
#include "system_gd32f10x.c"
#elif defined(GD32E23x)
#include "system_gd32e23x.c"
#elif defined(GD32E50X)
Expand Down
13 changes: 12 additions & 1 deletion cores/arduino/gd32/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ OF SUCH DAMAGE.
#define TIMER0_Update_IRQ_Name TIMER0_UP_TIMER9_IRQn
#define TIMER9_IRQ_NAME TIMER0_UP_TIMER9_IRQn
#endif
#elif defined(GD32F10x)
#define NO_TIMER_0
#define NO_TIMER_9
#define NO_TIMER_10
#define NO_TIMER_11
#define NO_TIMER_12
#define NO_TIMER_13
#define TIMER0_Update_IRQ_Name TIMER0_UP_IRQn
#endif

#if defined(GD32E50X)
Expand All @@ -72,7 +80,10 @@ OF SUCH DAMAGE.
#define NO_TIMER_12
#define NO_TIMER_13
#endif
#else
#elif defined(GD32F10x)
#define TIMER7_IRQ_NAME TIMER7_UP_IRQn
#define TIMER7_UP_IRQ_NAME TIMER7_UP_IRQn
#else
#define TIMER7_IRQ_NAME TIMER7_IRQn
#define TIMER7_UP_IRQ_NAME TIMER7_IRQn
#endif
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/gd32/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ OF SUCH DAMAGE.
#if defined(USART_DATA)
#define GD32_USART_TX_DATA USART_DATA
#define GD32_USART_RX_DATA USART_DATA
#define GD32_USART_STAT USART_STAT0
#define GD32_USART_STAT USART_STAT
dmlambo marked this conversation as resolved.
Show resolved Hide resolved
#elif defined(USART_RDATA) && defined(USART_TDATA)
#define GD32_USART_TX_DATA USART_TDATA
#define GD32_USART_RX_DATA USART_RDATA
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/wiring_digital_extra.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void digitalToggle(pin_size_t ulPin);
*****************************************************************************/
typedef enum afio_debug_cfg {
/** Full Serial Wire and JTAG debug */
AFIO_DEBUG_FULL_SWJ = ((uint32_t)0x00300000U | (PCF0_SWJ_CFG(0) >> 16)),
AFIO_DEBUG_FULL_SWJ = ((uint32_t)0x00300000U | (AFIO_PCF0_SWJ_CFG >> 16)),
dmlambo marked this conversation as resolved.
Show resolved Hide resolved
/** Full Serial Wire and JTAG, but no NJTRST. */
AFIO_DEBUG_FULL_SWJ_NO_NJRST = GPIO_SWJ_NONJTRST_REMAP,
/** Serial Wire debug only (JTAG-DP disabled, SW-DP enabled) */
Expand Down
Loading