From 13e0fafc140c16539691d26afafaca417e7e2fbc Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期四, 16 一月 2025 09:43:45 +0800 Subject: [PATCH] 更新为sdk0.7.0版本 --- 01_SDK/modules/hal/panchip/panplat/pan1070/bsp/device/Source/retarget.c | 49 ++++++++++++++++++++----------------------------- 1 files changed, 20 insertions(+), 29 deletions(-) diff --git a/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/device/Source/retarget.c b/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/device/Source/retarget.c index 51ec47f..e860bb5 100644 --- a/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/device/Source/retarget.c +++ b/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/device/Source/retarget.c @@ -10,8 +10,12 @@ *****************************************************************************/ #include <stdio.h> #include "PanSeries.h" +#if CONFIG_RTT_LOG_ENABLE +#include "SEGGER_RTT.h" +#endif -#define UART0_ENABLE (1) +/* Suppress the build warning #111-D: statement is unreachable */ +#pragma diag_suppress 111 #if defined ( __CC_ARM ) #if (__ARMCC_VERSION < 400000) @@ -28,14 +32,6 @@ #else #define DEBUG_PORT UART0 #endif - -/* Un-comment this line to disable all printf and getchar. getchar() will always return 0x00*/ -//#define DISABLE_UART - -/*---------------------------------------------------------------------------------------------------------*/ -/* Global variables */ -/*---------------------------------------------------------------------------------------------------------*/ - //#if !(defined(__ICCARM__) && (__VER__ >= 6010000)) //struct __FILE { int handle; /* Add whatever you need here */ }; @@ -334,14 +330,8 @@ void SendChar_ToUART(int ch) { -#ifndef DISABLE_UART - -#if (UART0_ENABLE) - while(UART_IsTxFifoFull(DEBUG_PORT)); - DEBUG_PORT->RBR_THR_DLL = ch; -#endif //UART0_ENABLE - -#endif //DISABLE_UART + while(UART_IsTxFifoFull(DEBUG_PORT)); + DEBUG_PORT->RBR_THR_DLL = ch; } @@ -374,7 +364,13 @@ g_buf_len = 0; } } -#else +#endif + +#if CONFIG_RTT_LOG_ENABLE + SEGGER_RTT_PutCharSkipNoLock(0, ch); +#endif + +#if CONFIG_UART_LOG_ENABLE SendChar_ToUART(ch); #endif } @@ -409,7 +405,8 @@ } #endif #endif -#ifndef DISABLE_UART + +#if CONFIG_UART_LOG_ENABLE while (1) { if((DEBUG_PORT->USR & UART_USR_RFNE_Msk)) @@ -417,8 +414,10 @@ return (DEBUG_PORT->RBR_THR_DLL); } } -#else - return(0); +#endif + +#if CONFIG_RTT_LOG_ENABLE + return SEGGER_RTT_WaitKey(); #endif } @@ -432,11 +431,7 @@ */ int kbhit(void) { -#ifndef DISABLE_UART return (DEBUG_PORT->USR & UART_USR_RFNE_Msk); -#else - return(0); -#endif } /** @@ -448,11 +443,7 @@ */ int IsDebugFifoEmpty(void) { -#ifndef DISABLE_UART return (DEBUG_PORT->USR & UART_USR_TFE_Msk) ? 1 : 0; -#else - return(1); -#endif } /*---------------------------------------------------------------------------------------------------------*/ -- Gitblit v1.9.3