[修改] 增加CONFIG_GY3513定制内容

[详细说明]
    1. 增加LED任务;
    2. 修复LED3配置错误问题;
This commit is contained in:
2023-06-14 16:01:34 +00:00
parent 242a8865ae
commit 853a9461a0
5 changed files with 68 additions and 6 deletions

View File

@ -5,6 +5,7 @@ project(GD32W51X LANGUAGES C ASM)
set(CONFIG_TZ_ENABLED OFF CACHE BOOL "Whether to enable trustzone") set(CONFIG_TZ_ENABLED OFF CACHE BOOL "Whether to enable trustzone")
set(CONFIG_OS "FREERTOS" CACHE STRING "Select which OS") set(CONFIG_OS "FREERTOS" CACHE STRING "Select which OS")
set(CONFIG_STATIC_LIB_BUILDED ON CACHE BOOL "Whether static lib builded, like wlan, iperf3 lib") set(CONFIG_STATIC_LIB_BUILDED ON CACHE BOOL "Whether static lib builded, like wlan, iperf3 lib")
set(CONFIG_GY3513 ON CACHE BOOL "Whether to allow gaoyang3513's modification or not.")
include(${CMAKE_TOOLCHAIN_FILE}) include(${CMAKE_TOOLCHAIN_FILE})
toolchain_reload_compiler() toolchain_reload_compiler()
@ -23,6 +24,14 @@ include_directories(
ROM-EXPORT/mbedtls-2.17.0-rom/include ROM-EXPORT/mbedtls-2.17.0-rom/include
) )
if(CONFIG_GY3513)
add_definitions(-DCONFIG_GY3513)
include_directories(
NSPE/Utilities
)
endif(CONFIG_GY3513)
if (CONFIG_TZ_ENABLED) if (CONFIG_TZ_ENABLED)
add_subdirectory(MBL/source) add_subdirectory(MBL/source)
include_directories(MBL/source) include_directories(MBL/source)
@ -31,5 +40,4 @@ else()
add_subdirectory(MBL/source_ns) add_subdirectory(MBL/source_ns)
endif() endif()
add_subdirectory(NSPE) add_subdirectory(NSPE)

View File

@ -71,9 +71,9 @@ typedef enum
#define LED2_GPIO_PORT GPIOA #define LED2_GPIO_PORT GPIOA
#define LED2_GPIO_CLK RCU_GPIOA #define LED2_GPIO_CLK RCU_GPIOA
#define LED3_PIN GPIO_PIN_8 #define LED3_PIN GPIO_PIN_6
#define LED3_GPIO_PORT GPIOB #define LED3_GPIO_PORT GPIOA
#define LED3_GPIO_CLK RCU_GPIOB #define LED3_GPIO_CLK RCU_GPIOA
#define COMn 1U #define COMn 1U
#define EVAL_COM0 USART2 #define EVAL_COM0 USART2

View File

@ -32,6 +32,13 @@ target_sources(app
../demo/cmsis_os_demo.c ../demo/cmsis_os_demo.c
) )
if(CONFIG_GY3513)
target_sources(app
PRIVATE
../../Utilities/gd32w515p_eval.c
)
endif(CONFIG_GY3513)
target_link_libraries(app target_link_libraries(app
gd32w51x_peripheral_api gd32w51x_peripheral_api
gd32w51x_wifi_api gd32w51x_wifi_api

View File

@ -33,6 +33,7 @@ OF SUCH DAMAGE.
*/ */
/*============================ INCLUDES ======================================*/ /*============================ INCLUDES ======================================*/
#include "wrapper_freertos.h"
#include "wrapper_os.h" #include "wrapper_os.h"
#include "debug_print.h" #include "debug_print.h"
#include "bsp_inc.h" #include "bsp_inc.h"
@ -48,6 +49,10 @@ OF SUCH DAMAGE.
#ifdef CONFIG_FATFS_SUPPORT #ifdef CONFIG_FATFS_SUPPORT
#include "fatfs.h" #include "fatfs.h"
#endif #endif
#if defined (CONFIG_GY3513)
#include <gd32w515p_eval.h>
#endif // CONFIG_GY3513
/*============================ MACROS ========================================*/ /*============================ MACROS ========================================*/
/*============================ MACRO FUNCTIONS ===============================*/ /*============================ MACRO FUNCTIONS ===============================*/
/*============================ TYPES =========================================*/ /*============================ TYPES =========================================*/
@ -74,6 +79,31 @@ void do_ram_code_copy(void)
} }
#endif #endif
#if defined (CONFIG_GY3513)
static int32_t led_init(void)
{
gd_eval_led_init(LED1);
gd_eval_led_init(LED2);
gd_eval_led_init(LED3);
return 0;
}
void led_task(void *p_arg)
{
while (1) {
gd_eval_led_toggle(LED1);
sys_ms_sleep(200);
gd_eval_led_toggle(LED2);
sys_ms_sleep(200);
gd_eval_led_toggle(LED3);
sys_ms_sleep(200);
}
sys_task_delete(NULL);
}
#endif // CONFIG_GY3513
/*! /*!
\brief initialize application \brief initialize application
\param[in] none \param[in] none
@ -121,7 +151,14 @@ void start_task(void *p_arg)
*/ */
int main(void) int main(void)
{ {
#if defined (CONFIG_GY3513)
TaskHandle_t *stTaskHndl_led = NULL;
#endif // CONFIG_GY3513
platform_init(); platform_init();
#if defined (CONFIG_GY3513)
led_init();
#endif // CONFIG_GY3513
DEBUGPRINT("SDK git revision: "WIFI_GIT_REVISION" \r\n"); DEBUGPRINT("SDK git revision: "WIFI_GIT_REVISION" \r\n");
DEBUGPRINT("SDK version: V%d.%d.%d\r\n", (RE_NSPE_VERSION >> 24), ((RE_NSPE_VERSION & 0xFF0000) >> 16), (RE_NSPE_VERSION & 0xFFFF)); DEBUGPRINT("SDK version: V%d.%d.%d\r\n", (RE_NSPE_VERSION >> 24), ((RE_NSPE_VERSION & 0xFF0000) >> 16), (RE_NSPE_VERSION & 0xFFFF));
@ -129,8 +166,17 @@ int main(void)
sys_os_init(); sys_os_init();
if (NULL == sys_task_create(NULL, (const uint8_t *)"start_task", NULL, START_TASK_STK_SIZE, 0, #if defined (CONFIG_GY3513)
START_TASK_PRIO, start_task, NULL)) { #define LED_TASK_STK_SIZE 256
#define LED_TASK_PRIO (TASK_PRIO_APP_BASE + TASK_PRIO_HIGHER(1))
stTaskHndl_led = sys_task_create(NULL, (const uint8_t *)"led_task", NULL, LED_TASK_STK_SIZE, 0, LED_TASK_PRIO, led_task, NULL);
if (stTaskHndl_led == NULL) {
DEBUG_ERROR("Error, task create failed.\r\n");
}
#endif // CONFIG_GY3513
if (NULL == sys_task_create(NULL, (const uint8_t *)"start_task", NULL, START_TASK_STK_SIZE, 0, START_TASK_PRIO, start_task, NULL)) {
DEBUGPRINT("ERROR: create start task failed\r\n"); DEBUGPRINT("ERROR: create start task failed\r\n");
} }

View File

@ -735,5 +735,6 @@ void platform_init(void)
gdm3210x_fpga_init(); gdm3210x_fpga_init();
#elif CONFIG_PLATFORM == PLATFORM_ASIC_32W51X #elif CONFIG_PLATFORM == PLATFORM_ASIC_32W51X
gd32w51x_asic_init(); gd32w51x_asic_init();
#endif #endif
} }