From ca994901dbdb100bba05a3c11e8247c0783dc92e Mon Sep 17 00:00:00 2001 From: supowang Date: Wed, 30 Oct 2019 17:44:37 +0800 Subject: [PATCH] add GD32E230C_START support --- arch/arm/arm-v8m/cortex-m23/armcc/port_c.c | 2 +- .../BSP/Inc/gd32e230c_start.h | 117 +++ .../BSP/Inc/gd32e23x_it.h | 62 ++ .../BSP/Inc/gd32e23x_libopt.h | 60 ++ .../BSP/Inc/systick.h | 49 + .../BSP/Src/gd32e230c_start.c | 182 ++++ .../BSP/Src/gd32e23x_it.c | 139 +++ .../GigaDevice_GD32E230C_START/BSP/Src/main.c | 143 +++ .../BSP/Src/readme.txt | 42 + .../BSP/Src/systick.c | 85 ++ .../KEIL/hello_world/TencentOS_tiny.uvoptx | 910 ++++++++++++++++++ .../KEIL/hello_world/TencentOS_tiny.uvprojx | 702 ++++++++++++++ .../TOS_CONFIG/tos_config.h | 56 ++ board/Nuvoton_M251/BSP/Inc/M251.h | 2 +- 14 files changed, 2549 insertions(+), 2 deletions(-) create mode 100644 board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e230c_start.h create mode 100644 board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e23x_it.h create mode 100644 board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e23x_libopt.h create mode 100644 board/GigaDevice_GD32E230C_START/BSP/Inc/systick.h create mode 100644 board/GigaDevice_GD32E230C_START/BSP/Src/gd32e230c_start.c create mode 100644 board/GigaDevice_GD32E230C_START/BSP/Src/gd32e23x_it.c create mode 100644 board/GigaDevice_GD32E230C_START/BSP/Src/main.c create mode 100644 board/GigaDevice_GD32E230C_START/BSP/Src/readme.txt create mode 100644 board/GigaDevice_GD32E230C_START/BSP/Src/systick.c create mode 100644 board/GigaDevice_GD32E230C_START/KEIL/hello_world/TencentOS_tiny.uvoptx create mode 100644 board/GigaDevice_GD32E230C_START/KEIL/hello_world/TencentOS_tiny.uvprojx create mode 100644 board/GigaDevice_GD32E230C_START/TOS_CONFIG/tos_config.h diff --git a/arch/arm/arm-v8m/cortex-m23/armcc/port_c.c b/arch/arm/arm-v8m/cortex-m23/armcc/port_c.c index 70189783..c27b22b1 100644 --- a/arch/arm/arm-v8m/cortex-m23/armcc/port_c.c +++ b/arch/arm/arm-v8m/cortex-m23/armcc/port_c.c @@ -16,7 +16,7 @@ *---------------------------------------------------------------------------*/ #include "tos.h" -#include "core_armv8mbl.h" +#include "core_cm23.h" __PORT__ void port_cpu_reset(void) { diff --git a/board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e230c_start.h b/board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e230c_start.h new file mode 100644 index 00000000..1e913f58 --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e230c_start.h @@ -0,0 +1,117 @@ +/*! + \file gd32e230c_start.h + \brief definitions for GD32E230C_START's leds, keys and COM ports hardware resources + + \version 2019-02-19, V1.0.0, firmware for GD32E23x +*/ + +/* + Copyright (c) 2019, 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 GD32E230C_START_H +#define GD32E230C_START_H + +#ifdef __cplusplus + extern "C" { +#endif + +#include "gd32e23x.h" + +/* exported types */ +typedef enum +{ + LED1 = 0, + LED2 = 1, + LED3 = 2, + LED4 = 3 +}led_typedef_enum; + +typedef enum +{ + KEY_WAKEUP = 0, +}key_typedef_enum; + +typedef enum +{ + KEY_MODE_GPIO = 0, + KEY_MODE_EXTI = 1 +}keymode_typedef_enum; + + +/* eval board low layer led */ +#define LEDn 4U + +#define LED1_PIN GPIO_PIN_7 +#define LED1_GPIO_PORT GPIOA +#define LED1_GPIO_CLK RCU_GPIOA + +#define LED2_PIN GPIO_PIN_8 +#define LED2_GPIO_PORT GPIOA +#define LED2_GPIO_CLK RCU_GPIOA + +#define LED3_PIN GPIO_PIN_11 +#define LED3_GPIO_PORT GPIOA +#define LED3_GPIO_CLK RCU_GPIOA + +#define LED4_PIN GPIO_PIN_12 +#define LED4_GPIO_PORT GPIOA +#define LED4_GPIO_CLK RCU_GPIOA + +/* eval board low layer button */ +#define KEYn 1U + +/* wakeup push-button */ +#define WAKEUP_KEY_PIN GPIO_PIN_0 +#define WAKEUP_KEY_GPIO_PORT GPIOA +#define WAKEUP_KEY_GPIO_CLK RCU_GPIOA +#define WAKEUP_KEY_EXTI_LINE EXTI_0 +#define WAKEUP_KEY_EXTI_PORT_SOURCE EXTI_SOURCE_GPIOA +#define WAKEUP_KEY_EXTI_PIN_SOURCE EXTI_SOURCE_PIN0 +#define WAKEUP_KEY_EXTI_IRQn EXTI0_1_IRQn + +/* function declarations */ +/* configure led GPIO */ +void gd_eval_led_init(led_typedef_enum lednum); +/* turn on selected led */ +void gd_eval_led_on(led_typedef_enum lednum); +/* turn off selected led */ +void gd_eval_led_off(led_typedef_enum lednum); +/* toggle the selected led */ +void gd_eval_led_toggle(led_typedef_enum lednum); +/* configure key */ +void gd_eval_key_init(key_typedef_enum keynum, keymode_typedef_enum keymode); +/* return the selected key state */ +uint8_t gd_eval_key_state_get(key_typedef_enum keynum); + +#ifdef __cplusplus +} +#endif + +#endif /* GD32E230C_START_H */ + diff --git a/board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e23x_it.h b/board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e23x_it.h new file mode 100644 index 00000000..f995d4f0 --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e23x_it.h @@ -0,0 +1,62 @@ +/*! + \file gd32e23x_it.h + \brief the header file of the ISR + + \version 2019-02-19, V1.0.0, firmware for GD32E23x +*/ + +/* + Copyright (c) 2019, 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 GD32E23X_IT_H +#define GD32E23X_IT_H + +#include "gd32e23x.h" + +/* function declarations */ +/* this function handles NMI exception */ +void NMI_Handler(void); +/* this function handles HardFault exception */ +void HardFault_Handler(void); +/* this function handles MemManage exception */ +void MemManage_Handler(void); +/* this function handles BusFault exception */ +void BusFault_Handler(void); +/* this function handles UsageFault exception */ +void UsageFault_Handler(void); +/* this function handles SVC exception */ +void SVC_Handler(void); +/* this function handles DebugMon exception */ +void DebugMon_Handler(void); +/* this function handles PendSV exception */ +void PendSV_Handler(void); +/* this function handles SysTick exception */ +void SysTick_Handler(void); + +#endif /* GD32E23X_IT_H */ diff --git a/board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e23x_libopt.h b/board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e23x_libopt.h new file mode 100644 index 00000000..362015b3 --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/BSP/Inc/gd32e23x_libopt.h @@ -0,0 +1,60 @@ +/*! + \file gd32e23x_libopt.h + \brief library optional for gd32e23x + + \version 2019-02-19, V1.0.0, firmware for GD32E23x +*/ + +/* + Copyright (c) 2019, 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 GD32E23X_LIBOPT_H +#define GD32E23X_LIBOPT_H + +#include "gd32e23x_adc.h" +#include "gd32e23x_crc.h" +#include "gd32e23x_dbg.h" +#include "gd32e23x_dma.h" +#include "gd32e23x_exti.h" +#include "gd32e23x_fmc.h" +#include "gd32e23x_gpio.h" +#include "gd32e23x_syscfg.h" +#include "gd32e23x_i2c.h" +#include "gd32e23x_fwdgt.h" +#include "gd32e23x_pmu.h" +#include "gd32e23x_rcu.h" +#include "gd32e23x_rtc.h" +#include "gd32e23x_spi.h" +#include "gd32e23x_timer.h" +#include "gd32e23x_usart.h" +#include "gd32e23x_wwdgt.h" +#include "gd32e23x_misc.h" +#include "gd32e23x_cmp.h" + +#endif /* GD32E23X_LIBOPT_H */ diff --git a/board/GigaDevice_GD32E230C_START/BSP/Inc/systick.h b/board/GigaDevice_GD32E230C_START/BSP/Inc/systick.h new file mode 100644 index 00000000..8496112e --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/BSP/Inc/systick.h @@ -0,0 +1,49 @@ +/*! + \file systick.h + \brief the header file of systick + + \version 2019-02-19, V1.0.0, firmware for GD32E23x +*/ + +/* + Copyright (c) 2019, 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 SYS_TICK_H +#define SYS_TICK_H + +#include + +/* configure systick */ +void systick_config(void); +/* delay a time in milliseconds */ +void delay_1ms(uint32_t count); +/* delay decrement */ +void delay_decrement(void); + +#endif /* SYS_TICK_H */ diff --git a/board/GigaDevice_GD32E230C_START/BSP/Src/gd32e230c_start.c b/board/GigaDevice_GD32E230C_START/BSP/Src/gd32e230c_start.c new file mode 100644 index 00000000..0526d708 --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/BSP/Src/gd32e230c_start.c @@ -0,0 +1,182 @@ +/*! + \file gd32e230c_start.c + \brief firmware functions to manage leds, keys, COM ports + + \version 2019-02-19, V1.0.0, firmware for GD32E23x +*/ + +/* + Copyright (c) 2019, 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. +*/ + +#include "gd32e230c_start.h" + +/* private variables */ +static const uint32_t GPIO_PORT[LEDn] = {LED1_GPIO_PORT, + LED2_GPIO_PORT, + LED3_GPIO_PORT, + LED4_GPIO_PORT}; + +static const uint32_t GPIO_PIN[LEDn] = {LED1_PIN, + LED2_PIN, + LED3_PIN, + LED4_PIN}; + +static const rcu_periph_enum GPIO_CLK[LEDn] = {LED1_GPIO_CLK, + LED2_GPIO_CLK, + LED3_GPIO_CLK, + LED4_GPIO_CLK}; + +static const uint32_t KEY_PORT[KEYn] = {WAKEUP_KEY_GPIO_PORT}; + +static const uint32_t KEY_PIN[KEYn] = {WAKEUP_KEY_PIN}; + +static const rcu_periph_enum KEY_CLK[KEYn] = {WAKEUP_KEY_GPIO_CLK}; + +static const exti_line_enum KEY_EXTI_LINE[KEYn] = {WAKEUP_KEY_EXTI_LINE}; + +static const uint8_t KEY_PORT_SOURCE[KEYn] = {WAKEUP_KEY_EXTI_PORT_SOURCE}; + +static const uint8_t KEY_PIN_SOURCE[KEYn] = {WAKEUP_KEY_EXTI_PIN_SOURCE}; + +static const uint8_t KEY_IRQn[KEYn] = {WAKEUP_KEY_EXTI_IRQn}; + +/* eval board low layer private functions */ +/*! + \brief configure led GPIO + \param[in] lednum: specify the led to be configured + \arg LED1 + \arg LED2 + \arg LED3 + \arg LED4 + \param[out] none + \retval none +*/ +void gd_eval_led_init(led_typedef_enum lednum) +{ + /* enable the led clock */ + rcu_periph_clock_enable(GPIO_CLK[lednum]); + /* configure led GPIO port */ + gpio_mode_set(GPIO_PORT[lednum], GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN[lednum]); + gpio_output_options_set(GPIO_PORT[lednum], GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN[lednum]); + + GPIO_BC(GPIO_PORT[lednum]) = GPIO_PIN[lednum]; +} + +/*! + \brief turn on selected led + \param[in] lednum: specify the led to be turned on + \arg LED1 + \arg LED2 + \arg LED3 + \arg LED4 + \param[out] none + \retval none +*/ +void gd_eval_led_on(led_typedef_enum lednum) +{ + GPIO_BOP(GPIO_PORT[lednum]) = GPIO_PIN[lednum]; +} + +/*! + \brief turn off selected led + \param[in] lednum: specify the led to be turned off + \arg LED1 + \arg LED2 + \arg LED3 + \arg LED4 + \param[out] none + \retval none +*/ +void gd_eval_led_off(led_typedef_enum lednum) +{ + GPIO_BC(GPIO_PORT[lednum]) = GPIO_PIN[lednum]; +} + +/*! + \brief toggle selected led + \param[in] lednum: specify the led to be toggled + \arg LED1 + \arg LED2 + \arg LED3 + \arg LED4 + \param[out] none + \retval none +*/ +void gd_eval_led_toggle(led_typedef_enum lednum) +{ + GPIO_TG(GPIO_PORT[lednum]) = GPIO_PIN[lednum]; +} + +/*! + \brief configure key + \param[in] keynum: specify the key to be configured + \arg KEY_TAMPER: tamper key + \arg KEY_WAKEUP: wakeup key + \arg KEY_USER: user key + \param[in] keymode: specify button mode + \arg KEY_MODE_GPIO: key will be used as simple IO + \arg KEY_MODE_EXTI: key will be connected to EXTI line with interrupt + \param[out] none + \retval none +*/ +void gd_eval_key_init(key_typedef_enum keynum, keymode_typedef_enum keymode) +{ + /* enable the key clock */ + rcu_periph_clock_enable(KEY_CLK[keynum]); + rcu_periph_clock_enable(RCU_CFGCMP); + + /* configure button pin as input */ + gpio_mode_set(KEY_PORT[keynum], GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, KEY_PIN[keynum]); + + if (keymode == KEY_MODE_EXTI) { + /* enable and set key EXTI interrupt to the lowest priority */ + nvic_irq_enable(KEY_IRQn[keynum], 2U); + + /* connect key EXTI line to key GPIO pin */ + syscfg_exti_line_config(KEY_PORT_SOURCE[keynum], KEY_PIN_SOURCE[keynum]); + + /* configure key EXTI line */ + exti_init(KEY_EXTI_LINE[keynum], EXTI_INTERRUPT, EXTI_TRIG_FALLING); + exti_interrupt_flag_clear(KEY_EXTI_LINE[keynum]); + } +} + +/*! + \brief return the selected key state + \param[in] keynum: specify the key to be checked + \arg KEY_TAMPER: tamper key + \arg KEY_WAKEUP: wakeup key + \arg KEY_USER: user key + \param[out] none + \retval the key's GPIO pin value +*/ +uint8_t gd_eval_key_state_get(key_typedef_enum keynum) +{ + return gpio_input_bit_get(KEY_PORT[keynum], KEY_PIN[keynum]); +} diff --git a/board/GigaDevice_GD32E230C_START/BSP/Src/gd32e23x_it.c b/board/GigaDevice_GD32E230C_START/BSP/Src/gd32e23x_it.c new file mode 100644 index 00000000..df9b2caf --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/BSP/Src/gd32e23x_it.c @@ -0,0 +1,139 @@ +/*! + \file gd32e23x_it.c + \brief interrupt service routines + + \version 2019-02-19, V1.0.0, firmware for GD32E23x +*/ + +/* + Copyright (c) 2019, 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. +*/ + +#include "gd32e23x_it.h" +#include "systick.h" +#include "tos.h" +/*! + \brief this function handles NMI exception + \param[in] none + \param[out] none + \retval none +*/ +void NMI_Handler(void) +{ +} + +/*! + \brief this function handles HardFault exception + \param[in] none + \param[out] none + \retval none +*/ +void HardFault_Handler(void) +{ + /* if Hard Fault exception occurs, go to infinite loop */ + while (1){ + } +} + +/*! + \brief this function handles MemManage exception + \param[in] none + \param[out] none + \retval none +*/ +void MemManage_Handler(void) +{ + /* if Memory Manage exception occurs, go to infinite loop */ + while (1){ + } +} + +/*! + \brief this function handles BusFault exception + \param[in] none + \param[out] none + \retval none +*/ +void BusFault_Handler(void) +{ + /* if Bus Fault exception occurs, go to infinite loop */ + while (1){ + } +} + +/*! + \brief this function handles UsageFault exception + \param[in] none + \param[out] none + \retval none +*/ +void UsageFault_Handler(void) +{ + /* if Usage Fault exception occurs, go to infinite loop */ + while (1){ + } +} + +/*! + \brief this function handles SVC exception + \param[in] none + \param[out] none + \retval none +*/ +void SVC_Handler(void) +{ +} + +/*! + \brief this function handles DebugMon exception + \param[in] none + \param[out] none + \retval none +*/ +void DebugMon_Handler(void) +{ +} + + + +/*! + \brief this function handles SysTick exception + \param[in] none + \param[out] none + \retval none +*/ +void SysTick_Handler(void) +{ + if(tos_knl_is_running()) //OS开始跑了,才执行正常的调度处理 + { + tos_knl_irq_enter(); //进入中断 + tos_tick_handler(); //调用TencentOS tiny的时钟服务程序 + tos_knl_irq_leave(); //触发任务切换软中断 + } + delay_decrement(); +} diff --git a/board/GigaDevice_GD32E230C_START/BSP/Src/main.c b/board/GigaDevice_GD32E230C_START/BSP/Src/main.c new file mode 100644 index 00000000..bdaffb47 --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/BSP/Src/main.c @@ -0,0 +1,143 @@ +/*! + \file main.c + \brief running LED + + \version 2019-02-19, V1.0.0, firmware for GD32E23x +*/ + +/* + Copyright (c) 2019, 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. +*/ + +#include "gd32e23x.h" +#include "gd32e230c_start.h" +#include "systick.h" +#include +#include "cmsis_os.h" + + +#define TASK1_STK_SIZE 512 +void task1(void *arg); +osThreadDef(task1, osPriorityNormal, 2, TASK1_STK_SIZE); + +#define TASK2_STK_SIZE 512 +void task2(void *arg); +osThreadDef(task2, osPriorityNormal, 1, TASK2_STK_SIZE); + +int fputc(int ch, FILE *f) +{ + return ch; +} + +void board_init(void) +{ + systick_config(); + + /* enable the LED1 GPIO clock */ + rcu_periph_clock_enable(RCU_GPIOA); + /* configure LED1 GPIO port */ + gpio_mode_set(GPIOA, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_7); + gpio_output_options_set(GPIOA, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_7); + /* reset LED1 GPIO pin */ + gpio_bit_reset(GPIOA,GPIO_PIN_7); + + /* enable the LED2 GPIO clock */ + /* configure LED2 GPIO port */ + gpio_mode_set(GPIOA, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_8); + gpio_output_options_set(GPIOA, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_8); + /* reset LED2 GPIO pin */ + gpio_bit_reset(GPIOA,GPIO_PIN_8); + + /* enable the LED3 GPIO clock */ + /* configure LED3 GPIO port */ + gpio_mode_set(GPIOA, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_11); + gpio_output_options_set(GPIOA, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_11); + /* reset LED3 GPIO pin */ + gpio_bit_reset(GPIOA,GPIO_PIN_11); + + /* enable the LED4 GPIO clock */ + /* configure LED4 GPIO port */ + gpio_mode_set(GPIOA, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_12); + gpio_output_options_set(GPIOA, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_12); + /* reset LED4 GPIO pin */ + gpio_bit_reset(GPIOA,GPIO_PIN_12); + +// while(1){ +// /* turn on LED1, turn off LED4 */ +// gpio_bit_set(GPIOA,GPIO_PIN_7); +// gpio_bit_reset(GPIOA,GPIO_PIN_12); +// delay_1ms(1000); +// /* turn on LED2, turn off LED1 */ +// gpio_bit_set(GPIOA,GPIO_PIN_8); +// gpio_bit_reset(GPIOA,GPIO_PIN_7); +// delay_1ms(1000); +// /* turn on LED3, turn off LED2 */ +// gpio_bit_set(GPIOA,GPIO_PIN_11); +// gpio_bit_reset(GPIOA,GPIO_PIN_8); +// delay_1ms(1000); +// /* turn on LED4, turn off LED3 */ +// gpio_bit_set(GPIOA,GPIO_PIN_12); +// gpio_bit_reset(GPIOA,GPIO_PIN_11); +// delay_1ms(1000); +// } +} + +void task1(void *arg) +{ + int count = 1; + while (1) { + gd_eval_led_toggle(LED1); + gd_eval_led_toggle(LED2); + //printf("###This is task1, %d\r\n", count++); + osDelay(2000); + } +} + +void task2(void *arg) +{ + int count = 1; + while (1) { + //printf("***This is task2, %d\r\n", count++); + gd_eval_led_toggle(LED3); + gd_eval_led_toggle(LED4); + osDelay(1000); + } +} + + + +int main(void) +{ + board_init(); + //printf("Welcome to TencentOS tiny\r\n"); + osKernelInitialize(); + osThreadCreate(osThread(task1), NULL); // Create task1 + osThreadCreate(osThread(task2), NULL); // Create task2 + osKernelStart(); +} + diff --git a/board/GigaDevice_GD32E230C_START/BSP/Src/readme.txt b/board/GigaDevice_GD32E230C_START/BSP/Src/readme.txt new file mode 100644 index 00000000..e5898b10 --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/BSP/Src/readme.txt @@ -0,0 +1,42 @@ +/*! + \file readme.txt + \brief description of running led example + + \version 2019-02-19, V1.0.0, firmware for GD32E23x +*/ + +/* + Copyright (c) 2019, 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. +*/ + + This example is based on the GD32E230C-START-V1.0 board, it provides a description +of Running_led. After system start-up, firstly, LED1 on, then, LED2 on, four +LEDs can light periodically. + + On the GD32E230C-START board, LED1 is connected to PA7, LED2 is connected to PA8, LED3 +is connected to PA11, LED4 is connected to PA12. diff --git a/board/GigaDevice_GD32E230C_START/BSP/Src/systick.c b/board/GigaDevice_GD32E230C_START/BSP/Src/systick.c new file mode 100644 index 00000000..db5fb204 --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/BSP/Src/systick.c @@ -0,0 +1,85 @@ +/*! + \file systick.c + \brief the systick configuration file + + \version 2019-02-19, V1.0.0, firmware for GD32E23x +*/ + +/* + Copyright (c) 2019, 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. +*/ + +#include "gd32e23x.h" +#include "systick.h" + +volatile static uint32_t delay; + +/*! + \brief configure systick + \param[in] none + \param[out] none + \retval none +*/ +void systick_config(void) +{ + /* setup systick timer for 1000Hz interrupts */ + if (SysTick_Config(SystemCoreClock / 1000U)){ + /* capture error */ + while (1){ + } + } + /* configure the systick handler priority */ + NVIC_SetPriority(SysTick_IRQn, 0x00U); +} + +/*! + \brief delay a time in milliseconds + \param[in] count: count in milliseconds + \param[out] none + \retval none +*/ +void delay_1ms(uint32_t count) +{ + delay = count; + + while(0U != delay){ + } +} + +/*! + \brief delay decrement + \param[in] none + \param[out] none + \retval none +*/ +void delay_decrement(void) +{ + if (0U != delay){ + delay--; + } +} diff --git a/board/GigaDevice_GD32E230C_START/KEIL/hello_world/TencentOS_tiny.uvoptx b/board/GigaDevice_GD32E230C_START/KEIL/hello_world/TencentOS_tiny.uvoptx new file mode 100644 index 00000000..9d07d987 --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/KEIL/hello_world/TencentOS_tiny.uvoptx @@ -0,0 +1,910 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + GD32E230C_START + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\list\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 15 + + + + + + + + + + + BIN\CMSIS_AGDI_V8M.DLL + + + + 0 + CMSIS_AGDI_V8M + -X"Any" -UAny -O206 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(0BF11477) -L00(0) -TO0 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0GD32E23x.FLM -FS08000000 -FL010000 -FP0($$Device:GD32E230C8$Flash\GD32E23x.FLM) + + + 0 + PWSTATINFO + 200,50,700 + + + 0 + UL2V8M + -UAny -O206 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(0BF11477) -L00(0) -TO0 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0GD32E230.FLM -FS08000000 -FL010000 -FP0($$Device:GD32E230C8$Flash\GD32E230.FLM) + + + 0 + DLGUARM + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (6010=-1,-1,-1,-1,0)(6018=-1,-1,-1,-1,0)(6019=-1,-1,-1,-1,0)(6008=-1,-1,-1,-1,0)(6009=-1,-1,-1,-1,0)(6014=-1,-1,-1,-1,0)(6015=-1,-1,-1,-1,0)(6003=-1,-1,-1,-1,0)(6000=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 1 + 0 + 40015804 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + Application + 1 + 0 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\gd32e23x_it.c + gd32e23x_it.c + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\gd32e230c_start.c + gd32e230c_start.c + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\main.c + main.c + 0 + 0 + + + 1 + 4 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\systick.c + systick.c + 0 + 0 + + + + + CMSIS + 0 + 0 + 0 + 0 + + 2 + 5 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\CMSIS\GD\GD32E23x\Source\system_gd32e23x.c + system_gd32e23x.c + 0 + 0 + + + + + GD32E23x_Peripherals + 0 + 0 + 0 + 0 + + 3 + 6 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_adc.c + gd32e23x_adc.c + 0 + 0 + + + 3 + 7 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_cmp.c + gd32e23x_cmp.c + 0 + 0 + + + 3 + 8 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_crc.c + gd32e23x_crc.c + 0 + 0 + + + 3 + 9 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_dbg.c + gd32e23x_dbg.c + 0 + 0 + + + 3 + 10 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_dma.c + gd32e23x_dma.c + 0 + 0 + + + 3 + 11 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_exti.c + gd32e23x_exti.c + 0 + 0 + + + 3 + 12 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_fmc.c + gd32e23x_fmc.c + 0 + 0 + + + 3 + 13 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_fwdgt.c + gd32e23x_fwdgt.c + 0 + 0 + + + 3 + 14 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_gpio.c + gd32e23x_gpio.c + 0 + 0 + + + 3 + 15 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_i2c.c + gd32e23x_i2c.c + 0 + 0 + + + 3 + 16 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_misc.c + gd32e23x_misc.c + 0 + 0 + + + 3 + 17 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_pmu.c + gd32e23x_pmu.c + 0 + 0 + + + 3 + 18 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_rcu.c + gd32e23x_rcu.c + 0 + 0 + + + 3 + 19 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_rtc.c + gd32e23x_rtc.c + 0 + 0 + + + 3 + 20 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_spi.c + gd32e23x_spi.c + 0 + 0 + + + 3 + 21 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_syscfg.c + gd32e23x_syscfg.c + 0 + 0 + + + 3 + 22 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_timer.c + gd32e23x_timer.c + 0 + 0 + + + 3 + 23 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_usart.c + gd32e23x_usart.c + 0 + 0 + + + 3 + 24 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_wwdgt.c + gd32e23x_wwdgt.c + 0 + 0 + + + + + Startup + 0 + 0 + 0 + 0 + + 4 + 25 + 2 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\CMSIS\GD\GD32E23x\Source\ARM\startup_gd32e23x.s + startup_gd32e23x.s + 0 + 0 + + + + + tos/arch + 0 + 0 + 0 + 0 + + 5 + 26 + 1 + 0 + 0 + 0 + ..\..\..\..\arch\arm\arm-v8m\common\tos_cpu.c + tos_cpu.c + 0 + 0 + + + 5 + 27 + 1 + 0 + 0 + 0 + ..\..\..\..\arch\arm\arm-v8m\cortex-m23\armcc\port_c.c + port_c.c + 0 + 0 + + + 5 + 28 + 2 + 0 + 0 + 0 + ..\..\..\..\arch\arm\arm-v8m\cortex-m23\armcc\port_s.S + port_s.S + 0 + 0 + + + + + tos/kernel + 0 + 0 + 0 + 0 + + 6 + 29 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_binary_heap.c + tos_binary_heap.c + 0 + 0 + + + 6 + 30 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_char_fifo.c + tos_char_fifo.c + 0 + 0 + + + 6 + 31 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_completion.c + tos_completion.c + 0 + 0 + + + 6 + 32 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_countdownlatch.c + tos_countdownlatch.c + 0 + 0 + + + 6 + 33 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_event.c + tos_event.c + 0 + 0 + + + 6 + 34 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_global.c + tos_global.c + 0 + 0 + + + 6 + 35 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_mail_queue.c + tos_mail_queue.c + 0 + 0 + + + 6 + 36 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_message_queue.c + tos_message_queue.c + 0 + 0 + + + 6 + 37 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_mmblk.c + tos_mmblk.c + 0 + 0 + + + 6 + 38 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_mmheap.c + tos_mmheap.c + 0 + 0 + + + 6 + 39 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_mutex.c + tos_mutex.c + 0 + 0 + + + 6 + 40 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_pend.c + tos_pend.c + 0 + 0 + + + 6 + 41 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_priority_mail_queue.c + tos_priority_mail_queue.c + 0 + 0 + + + 6 + 42 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_priority_message_queue.c + tos_priority_message_queue.c + 0 + 0 + + + 6 + 43 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_priority_queue.c + tos_priority_queue.c + 0 + 0 + + + 6 + 44 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_ring_queue.c + tos_ring_queue.c + 0 + 0 + + + 6 + 45 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_robin.c + tos_robin.c + 0 + 0 + + + 6 + 46 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_sched.c + tos_sched.c + 0 + 0 + + + 6 + 47 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_sem.c + tos_sem.c + 0 + 0 + + + 6 + 48 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_sys.c + tos_sys.c + 0 + 0 + + + 6 + 49 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_task.c + tos_task.c + 0 + 0 + + + 6 + 50 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_tick.c + tos_tick.c + 0 + 0 + + + 6 + 51 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_time.c + tos_time.c + 0 + 0 + + + 6 + 52 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_timer.c + tos_timer.c + 0 + 0 + + + + + tos/cmsis + 0 + 0 + 0 + 0 + + 7 + 53 + 1 + 1 + 0 + 0 + ..\..\..\..\osal\cmsis_os\cmsis_os.c + cmsis_os.c + 0 + 0 + + + + + ::CMSIS + 0 + 0 + 0 + 1 + + +
diff --git a/board/GigaDevice_GD32E230C_START/KEIL/hello_world/TencentOS_tiny.uvprojx b/board/GigaDevice_GD32E230C_START/KEIL/hello_world/TencentOS_tiny.uvprojx new file mode 100644 index 00000000..0d1d08fb --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/KEIL/hello_world/TencentOS_tiny.uvprojx @@ -0,0 +1,702 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + GD32E230C_START + 0x4 + ARM-ADS + 6100001::V6.10.1::.\ARMCLANG + 1 + + + GD32E230C8 + GigaDevice + GigaDevice.GD32E23x_DFP.1.0.0 + http://gd32mcu.21ic.com/data/documents/yingyongruanjian/ + IRAM(0x20000000,0x0002000) IROM(0x08000000,0x0010000) CPUTYPE("Cortex-M23") CLOCK(12000000) ELITTLE + + + UL2V8M(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0GD32E230 -FS08000000 -FL010000 -FP0($$Device:GD32E230C8$Flash\GD32E230.FLM)) + 0 + $$Device:GD32E230C8$Device\Include\gd32e230.h + + + + + + + + + + $$Device:GD32E230C8$SVD\GD32E230.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + GD32E230C_START + 1 + 0 + 0 + 1 + 1 + .\list\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + + + + + SARMV8M.DLL + -MPU + TCM.DLL + -pCM23 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4098 + + 1 + BIN\UL2V8M.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M23" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 8 + 1 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x2000 + + + 1 + 0x8000000 + 0x10000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x10000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x2000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 3 + 3 + 1 + 1 + 0 + 0 + 0 + + + GD32E230 + + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\CMSIS\GD\GD32E23x\Include;..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\CMSIS;..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Include;..\..\BSP\Inc;..\..\..\..\arch\arm\arm-v8m\common\include;..\..\..\..\arch\arm\arm-v8m\cortex-m23\armcc;..\..\..\..\kernel\core\include;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\TOS_CONFIG + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + .\output\Project.sct + + + + + + + + + + + Application + + + gd32e23x_it.c + 1 + ..\..\BSP\Src\gd32e23x_it.c + + + gd32e230c_start.c + 1 + ..\..\BSP\Src\gd32e230c_start.c + + + main.c + 1 + ..\..\BSP\Src\main.c + + + systick.c + 1 + ..\..\BSP\Src\systick.c + + + + + CMSIS + + + system_gd32e23x.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\CMSIS\GD\GD32E23x\Source\system_gd32e23x.c + + + + + GD32E23x_Peripherals + + + gd32e23x_adc.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_adc.c + + + gd32e23x_cmp.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_cmp.c + + + gd32e23x_crc.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_crc.c + + + gd32e23x_dbg.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_dbg.c + + + gd32e23x_dma.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_dma.c + + + gd32e23x_exti.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_exti.c + + + gd32e23x_fmc.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_fmc.c + + + gd32e23x_fwdgt.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_fwdgt.c + + + gd32e23x_gpio.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_gpio.c + + + gd32e23x_i2c.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_i2c.c + + + gd32e23x_misc.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_misc.c + + + gd32e23x_pmu.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_pmu.c + + + gd32e23x_rcu.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_rcu.c + + + gd32e23x_rtc.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_rtc.c + + + gd32e23x_spi.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_spi.c + + + gd32e23x_syscfg.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_syscfg.c + + + gd32e23x_timer.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_timer.c + + + gd32e23x_usart.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_usart.c + + + gd32e23x_wwdgt.c + 1 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\GD32E23x_standard_peripheral\Source\gd32e23x_wwdgt.c + + + + + Startup + + + startup_gd32e23x.s + 2 + ..\..\..\..\platform\vendor_bsp\gd\GD32E23x_Firmware_Library\CMSIS\GD\GD32E23x\Source\ARM\startup_gd32e23x.s + + + + + tos/arch + + + tos_cpu.c + 1 + ..\..\..\..\arch\arm\arm-v8m\common\tos_cpu.c + + + port_c.c + 1 + ..\..\..\..\arch\arm\arm-v8m\cortex-m23\armcc\port_c.c + + + port_s.S + 2 + ..\..\..\..\arch\arm\arm-v8m\cortex-m23\armcc\port_s.S + + + + + tos/kernel + + + tos_binary_heap.c + 1 + ..\..\..\..\kernel\core\tos_binary_heap.c + + + tos_char_fifo.c + 1 + ..\..\..\..\kernel\core\tos_char_fifo.c + + + tos_completion.c + 1 + ..\..\..\..\kernel\core\tos_completion.c + + + tos_countdownlatch.c + 1 + ..\..\..\..\kernel\core\tos_countdownlatch.c + + + tos_event.c + 1 + ..\..\..\..\kernel\core\tos_event.c + + + tos_global.c + 1 + ..\..\..\..\kernel\core\tos_global.c + + + tos_mail_queue.c + 1 + ..\..\..\..\kernel\core\tos_mail_queue.c + + + tos_message_queue.c + 1 + ..\..\..\..\kernel\core\tos_message_queue.c + + + tos_mmblk.c + 1 + ..\..\..\..\kernel\core\tos_mmblk.c + + + tos_mmheap.c + 1 + ..\..\..\..\kernel\core\tos_mmheap.c + + + tos_mutex.c + 1 + ..\..\..\..\kernel\core\tos_mutex.c + + + tos_pend.c + 1 + ..\..\..\..\kernel\core\tos_pend.c + + + tos_priority_mail_queue.c + 1 + ..\..\..\..\kernel\core\tos_priority_mail_queue.c + + + tos_priority_message_queue.c + 1 + ..\..\..\..\kernel\core\tos_priority_message_queue.c + + + tos_priority_queue.c + 1 + ..\..\..\..\kernel\core\tos_priority_queue.c + + + tos_ring_queue.c + 1 + ..\..\..\..\kernel\core\tos_ring_queue.c + + + tos_robin.c + 1 + ..\..\..\..\kernel\core\tos_robin.c + + + tos_sched.c + 1 + ..\..\..\..\kernel\core\tos_sched.c + + + tos_sem.c + 1 + ..\..\..\..\kernel\core\tos_sem.c + + + tos_sys.c + 1 + ..\..\..\..\kernel\core\tos_sys.c + + + tos_task.c + 1 + ..\..\..\..\kernel\core\tos_task.c + + + tos_tick.c + 1 + ..\..\..\..\kernel\core\tos_tick.c + + + tos_time.c + 1 + ..\..\..\..\kernel\core\tos_time.c + + + tos_timer.c + 1 + ..\..\..\..\kernel\core\tos_timer.c + + + + + tos/cmsis + + + cmsis_os.c + 1 + ..\..\..\..\osal\cmsis_os\cmsis_os.c + + + + + ::CMSIS + + + + + + + + + + + + + + + + + + +
diff --git a/board/GigaDevice_GD32E230C_START/TOS_CONFIG/tos_config.h b/board/GigaDevice_GD32E230C_START/TOS_CONFIG/tos_config.h new file mode 100644 index 00000000..1922bf0f --- /dev/null +++ b/board/GigaDevice_GD32E230C_START/TOS_CONFIG/tos_config.h @@ -0,0 +1,56 @@ +#ifndef _TOS_CONFIG_H_ +#define _TOS_CONFIG_H_ + +#include "gd32e23x.h" +#include "stdio.h" + +#define TOS_CFG_TASK_PRIO_MAX 10u + +#define TOS_CFG_ROUND_ROBIN_EN 0u + +#define TOS_CFG_OBJECT_VERIFY_EN 1u + +#define TOS_CFG_TASK_DYNAMIC_CREATE_EN 1u + +#define TOS_CFG_EVENT_EN 1u + +#define TOS_CFG_MMBLK_EN 1u + +#define TOS_CFG_MMHEAP_EN 1u + +#define TOS_CFG_MMHEAP_DEFAULT_POOL_EN 1u + +#define TOS_CFG_MMHEAP_DEFAULT_POOL_SIZE 0x100 + +#define TOS_CFG_MUTEX_EN 1u + +#define TOS_CFG_MESSAGE_QUEUE_EN 1u + +#define TOS_CFG_MAIL_QUEUE_EN 1u + +#define TOS_CFG_PRIORITY_MESSAGE_QUEUE_EN 1u + +#define TOS_CFG_PRIORITY_MAIL_QUEUE_EN 1u + +#define TOS_CFG_TIMER_EN 0u + +#define TOS_CFG_PWR_MGR_EN 0u + +#define TOS_CFG_TICKLESS_EN 0u + +#define TOS_CFG_SEM_EN 1u + +#define TOS_CFG_TASK_STACK_DRAUGHT_DEPTH_DETACT_EN 1u + +#define TOS_CFG_FAULT_BACKTRACE_EN 0u + +#define TOS_CFG_IDLE_TASK_STK_SIZE 128u + +#define TOS_CFG_CPU_TICK_PER_SECOND 1000u + +#define TOS_CFG_CPU_CLOCK (SystemCoreClock) + +#define TOS_CFG_TIMER_AS_PROC 1u + +#endif + diff --git a/board/Nuvoton_M251/BSP/Inc/M251.h b/board/Nuvoton_M251/BSP/Inc/M251.h index 763fdffb..14dc3743 100644 --- a/board/Nuvoton_M251/BSP/Inc/M251.h +++ b/board/Nuvoton_M251/BSP/Inc/M251.h @@ -185,7 +185,7 @@ typedef enum IRQn /*@}*/ /* end of group CMSIS_Device */ -#include "core_armv8mbl.h" /* Processor and core peripherals */ +#include "core_cm23.h" /* Processor and core peripherals */ #include "system_M251.h" /* System Header */ /**