diff --git a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_driver.cpp b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_driver.cpp index 830bcd3fd..0c29a9af8 100644 --- a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_driver.cpp +++ b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_driver.cpp @@ -228,7 +228,7 @@ void eth_resumeDmaReception() void eth_dmaInterruptHandler() { #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf("DMA Int:"); + hal_printf("DMA Int:"); #endif // Normal interrupt summary @@ -239,7 +239,7 @@ void eth_dmaInterruptHandler() { // Ethernet frame received #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" RS"); + hal_printf(" RS"); #endif // Clear interrupt flag @@ -257,7 +257,7 @@ void eth_dmaInterruptHandler() { // Ethernet frame sent #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" TS"); + hal_printf(" TS"); #endif // Clear interrupt flag @@ -269,7 +269,7 @@ void eth_dmaInterruptHandler() { // Transmit buffer unavailable #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" TBUS"); + hal_printf(" TBUS"); #endif // Clear interrupt flag, transmition is resumed after descriptors have been prepared @@ -281,7 +281,7 @@ void eth_dmaInterruptHandler() { // Early receive #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" ERS"); + hal_printf(" ERS"); #endif // Clear interrupt flag. Also cleared automatically by RI @@ -301,7 +301,7 @@ void eth_dmaInterruptHandler() { // Fatal bus error #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" FBES"); + hal_printf(" FBES"); #endif // Clear interrupt flag @@ -313,7 +313,7 @@ void eth_dmaInterruptHandler() { // Transmit process stopped #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" TPSS"); + hal_printf(" TPSS"); #endif // Clear interrupt flag @@ -325,7 +325,7 @@ void eth_dmaInterruptHandler() { // Transmit jabber timeout #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" TJTS"); + hal_printf(" TJTS"); #endif // Clear interrupt flag @@ -337,7 +337,7 @@ void eth_dmaInterruptHandler() { // Receive overflow #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" ROS"); + hal_printf(" ROS"); #endif // Clear interrupt flag @@ -349,7 +349,7 @@ void eth_dmaInterruptHandler() { // Transmit underflow #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" TUS"); + hal_printf(" TUS"); #endif // Clear interrupt flag @@ -361,7 +361,7 @@ void eth_dmaInterruptHandler() { // Receive buffer unavailable #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" RBUS"); + hal_printf(" RBUS"); #endif // Clear interrupt flag @@ -373,7 +373,7 @@ void eth_dmaInterruptHandler() { // Receive process stopped #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" RPSS"); + hal_printf(" RPSS"); #endif // Clear interrupt flag @@ -385,7 +385,7 @@ void eth_dmaInterruptHandler() { // Receive watchdog timeout #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" RWTS"); + hal_printf(" RWTS"); #endif // Clear interrupt flag @@ -397,7 +397,7 @@ void eth_dmaInterruptHandler() { // Early transmit interrupt #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf(" ETS"); + hal_printf(" ETS"); #endif // Clear interrupt flag @@ -410,7 +410,7 @@ void eth_dmaInterruptHandler() } #if defined (_DEBUG) && DEBUG_DMA_INT - debug_printf("\r\n"); + hal_printf("\r\n"); #endif } diff --git a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_lwip.cpp b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_lwip.cpp index 63f9906f8..d5d3ddf25 100644 --- a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_lwip.cpp +++ b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_lwip.cpp @@ -88,7 +88,7 @@ BOOL STM32F4_ETH_LWIP_open(Netif_t *const pNetif) if ( !initEthernet(pNetif) ) { #ifdef _DEBUG_TRACE - debug_printf("Ethernet driver cannot be opened\r\n"); + hal_printf("Ethernet driver cannot be opened\r\n"); #endif // Set flag as closed and abort @@ -107,7 +107,7 @@ BOOL STM32F4_ETH_LWIP_open(Netif_t *const pNetif) s_isDriverOpened = TRUE; #ifdef _DEBUG_TRACE - debug_printf("Ethernet driver opened\r\n"); + hal_printf("Ethernet driver opened\r\n"); #endif return TRUE; @@ -135,7 +135,7 @@ void STM32F4_ETH_LWIP_close(const BOOL disableClocks) } #ifdef _DEBUG_TRACE - debug_printf("Ethernet driver closed\r\n"); + hal_printf("Ethernet driver closed\r\n"); #endif } @@ -177,7 +177,7 @@ static uint32_t processFrame(Netif_t *const pNetif) if (frameLength == 0) { #ifdef _DEBUG_TRACE - debug_printf("%s: erroneous frame\r\n", __func__); + hal_printf("%s: erroneous frame\r\n", __func__); #endif return releaseRxDescUntilNextFrame(); @@ -188,7 +188,7 @@ static uint32_t processFrame(Netif_t *const pNetif) if (!pbuf) { #ifdef _DEBUG_TRACE - debug_printf("%s: pbuf_alloc failed, discard current frame\r\n", __func__); + hal_printf("%s: pbuf_alloc failed, discard current frame\r\n", __func__); #endif return releaseFrame(); @@ -218,7 +218,7 @@ static uint32_t copyFrameToPbuf(Pbuf_t *pbuf) while (!eth_isRxDescOwnedByDma() && !isLastDescProcessed) { #if DEBUG_RX_DESC - debug_printf("----- Before processing RX -----\r\n"); + hal_printf("----- Before processing RX -----\r\n"); eth_displayRxDescStatus(); #endif @@ -237,7 +237,7 @@ static uint32_t copyFrameToPbuf(Pbuf_t *pbuf) nRxDesc++; #if DEBUG_RX_DESC - debug_printf("----- After processing RX -----\r\n"); + hal_printf("----- After processing RX -----\r\n"); eth_displayRxDescStatus(); #endif } @@ -400,7 +400,7 @@ static BOOL waitForTxDescriptor(uint32_t timeout) if (nWait == timeout) { //#ifdef _DEBUG - //debug_printf("%s: TX descriptor owned by DMA\r\n", __func__); + //hal_printf("%s: TX descriptor owned by DMA\r\n", __func__); //#endif return FALSE; @@ -426,7 +426,7 @@ static BOOL copyFrameFromPbuf(const Pbuf_t *pbuf) if (frameLength > TX_BUFFER_LENGTH) { #ifdef _DEBUG_TRACE - debug_printf("%s: Frame larger than TX buffer (%d)\r\n", __func__, frameLength); + hal_printf("%s: Frame larger than TX buffer (%d)\r\n", __func__, frameLength); #endif return FALSE; diff --git a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_phy.cpp b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_phy.cpp index 0117aa4b3..7d0476224 100644 --- a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_phy.cpp +++ b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_phy.cpp @@ -55,7 +55,7 @@ static void findPhyAddr() if ((value == PHY_KENDIN_OUI_ID1) || (value == PHY_ST802RT1X_OUI_ID1)) { rc = phyAddress; - debug_printf( "Valid PHY Found: %x (%x)\r\n", rc, value); + hal_printf( "Valid PHY Found: %x (%x)\r\n", rc, value); g_foundPhyAddress = TRUE; g_phyAddress = phyAddress; @@ -189,7 +189,7 @@ EthMode eth_enableAutoNegotiation() return ETHMODE_FAIL; #if (DEBUG_TRACE) - debug_printf("PHY CR status 0x%x \n",status); + hal_printf("PHY CR status 0x%x \n",status); #endif // Start Auto Negotiation @@ -210,13 +210,13 @@ EthMode eth_enableAutoNegotiation() // Check auto negotiation completed if ((status & PHY_SR_ANEGC) != PHY_SR_ANEGC) { - debug_printf("autonegotiate failed. Status: %x\n", status); + hal_printf("autonegotiate failed. Status: %x\n", status); return ETHMODE_FAIL; } #if (DEBUG_TRACE) - debug_printf("Autonegotiate Complete SR:%x\n", status); + hal_printf("Autonegotiate Complete SR:%x\n", status); #endif #if STM32F4_ETH_PHY_MII diff --git a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_rx_desc.cpp b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_rx_desc.cpp index 31e2c490e..97fd689ad 100644 --- a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_rx_desc.cpp +++ b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_rx_desc.cpp @@ -122,7 +122,7 @@ void eth_initRxDescriptors() } #if DEBUG_RX_DESC - debug_printf("----- After init RX desc -----\r\n"); + hal_printf("----- After init RX desc -----\r\n"); eth_displayRxDescStatus(); #endif @@ -282,7 +282,7 @@ void eth_displayRxDescStatus() for (uint32_t i = 0; i < N_RX_DESC; i++) { - debug_printf("%d: 0x%08x %s\r\n", i, s_rxDescriptor[i].rdes0, + hal_printf("%d: 0x%08x %s\r\n", i, s_rxDescriptor[i].rdes0, s_pRxDesc == &s_rxDescriptor[i] ? "<===" : ""); } } diff --git a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_tx_desc.cpp b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_tx_desc.cpp index 0fbc32268..c768a55da 100644 --- a/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_tx_desc.cpp +++ b/DeviceCode/Targets/Native/STM32F4/DeviceCode/STM32F4_ETH_lwip_OS/STM32F4_ETH_tx_desc.cpp @@ -121,7 +121,7 @@ void eth_initTxDescriptor() } #if DEBUG_TX_DESC - debug_printf("----- After init TX desc -----\r\n"); + hal_printf("----- After init TX desc -----\r\n"); eth_displayTxDescStatus(); #endif @@ -220,9 +220,9 @@ void eth_displayTxDescStatus() for (uint32_t i = 0; i < N_TX_DESC; i++) { - debug_printf("tdes0: 0x%08x %s\r\n", s_txDescriptor[i].tdes0, + hal_printf("tdes0: 0x%08x %s\r\n", s_txDescriptor[i].tdes0, s_pTxDesc == &s_txDescriptor[i] ? "<===" : ""); - debug_printf("tdes1: 0x%08x\r\n", s_txDescriptor[i].tdes1); + hal_printf("tdes1: 0x%08x\r\n", s_txDescriptor[i].tdes1); } } #endif diff --git a/DeviceCode/Targets/OS/CMSIS_RTOS/DeviceCode/lwip_1_4_1_os/arch/cc.h b/DeviceCode/Targets/OS/CMSIS_RTOS/DeviceCode/lwip_1_4_1_os/arch/cc.h index a046ef323..fc61f51b6 100644 --- a/DeviceCode/Targets/OS/CMSIS_RTOS/DeviceCode/lwip_1_4_1_os/arch/cc.h +++ b/DeviceCode/Targets/OS/CMSIS_RTOS/DeviceCode/lwip_1_4_1_os/arch/cc.h @@ -70,13 +70,13 @@ typedef intptr_t mem_ptr_t; #define PACK_STRUCT_END /* Plaform specific diagnostic output */ -extern void debug_printf(const char *format, ...); +extern void hal_printf(const char *format, ...); #define LWIP_PLATFORM_DIAG(x) do {debug_printf x;} while(0) #ifndef LWIP_NOASSERT #define LWIP_PLATFORM_ASSERT(x) \ - do {debug_printf("LWIP Assertion \"%s\" failed at line %d in %s\n", \ + do {hal_printf("LWIP Assertion \"%s\" failed at line %d in %s\n", \ x, __LINE__, __FILE__); } while(0) #else #define LWIP_PLATFORM_ASSERT(x) diff --git a/DeviceCode/include/tinyhal.h b/DeviceCode/include/tinyhal.h index d0ffb014b..5342ef5ce 100644 --- a/DeviceCode/include/tinyhal.h +++ b/DeviceCode/include/tinyhal.h @@ -398,10 +398,17 @@ struct HAL_SYSTEM_CONFIG COM_HANDLE DebuggerPorts[c_MaxDebuggers]; COM_HANDLE MessagingPorts[c_MaxMessaging]; - + // communication channel for debug messages in the debugger + // which may be VS, MFDEPLOY, etc... Accessed via debug_printf + // in the HAL/PAL and System.Diagnostics.Debug.Print() in managed + // applications COM_HANDLE DebugTextPort; UINT32 USART_DefaultBaudRate; + // internal HAL/PAL debug/tracing channel, this is seperate + // to allow tracing messages in the driver that implements + // the transport for the Debugger and DebugTextPort. This + // channel is accessed via hal_printf() in the HAL/PAL COM_HANDLE stdio; HAL_SYSTEM_MEMORY_CONFIG RAM1; @@ -1449,16 +1456,16 @@ extern const ConfigurationSector g_ConfigurationSector; #if !defined(BUILD_RTM) -#define DEBUG_TRACE0(t, s) if(((t) & DEBUG_TRACE) != 0) debug_printf( (s) ) -#define DEBUG_TRACE1(t, s, p1) if(((t) & DEBUG_TRACE) != 0) debug_printf( (s), (p1) ) -#define DEBUG_TRACE2(t, s, p1,p2) if(((t) & DEBUG_TRACE) != 0) debug_printf( (s), (p1),(p2) ) -#define DEBUG_TRACE3(t, s, p1,p2,p3) if(((t) & DEBUG_TRACE) != 0) debug_printf( (s), (p1),(p2),(p3) ) -#define DEBUG_TRACE4(t, s, p1,p2,p3,p4) if(((t) & DEBUG_TRACE) != 0) debug_printf( (s), (p1),(p2),(p3),(p4) ) -#define DEBUG_TRACE5(t, s, p1,p2,p3,p4,p5) if(((t) & DEBUG_TRACE) != 0) debug_printf( (s), (p1),(p2),(p3),(p4),(p5) ) -#define DEBUG_TRACE6(t, s, p1,p2,p3,p4,p5,p6) if(((t) & DEBUG_TRACE) != 0) debug_printf( (s), (p1),(p2),(p3),(p4),(p5),(p6) ) -#define DEBUG_TRACE7(t, s, p1,p2,p3,p4,p5,p6,p7) if(((t) & DEBUG_TRACE) != 0) debug_printf( (s), (p1),(p2),(p3),(p4),(p5),(p6),(p7) ) -#define DEBUG_TRACE8(t, s, p1,p2,p3,p4,p5,p6,p7,p8) if(((t) & DEBUG_TRACE) != 0) debug_printf( (s), (p1),(p2),(p3),(p4),(p5),(p6),(p7),(p8) ) -#define DEBUG_TRACE9(t, s, p1,p2,p3,p4,p5,p6,p7,p8,p9) if(((t) & DEBUG_TRACE) != 0) debug_printf( (s), (p1),(p2),(p3),(p4),(p5),(p6),(p7),(p8),(p9) ) +#define DEBUG_TRACE0(t, s) if(((t) & DEBUG_TRACE) != 0) hal_printf( (s) ) +#define DEBUG_TRACE1(t, s, p1) if(((t) & DEBUG_TRACE) != 0) hal_printf( (s), (p1) ) +#define DEBUG_TRACE2(t, s, p1,p2) if(((t) & DEBUG_TRACE) != 0) hal_printf( (s), (p1),(p2) ) +#define DEBUG_TRACE3(t, s, p1,p2,p3) if(((t) & DEBUG_TRACE) != 0) hal_printf( (s), (p1),(p2),(p3) ) +#define DEBUG_TRACE4(t, s, p1,p2,p3,p4) if(((t) & DEBUG_TRACE) != 0) hal_printf( (s), (p1),(p2),(p3),(p4) ) +#define DEBUG_TRACE5(t, s, p1,p2,p3,p4,p5) if(((t) & DEBUG_TRACE) != 0) hal_printf( (s), (p1),(p2),(p3),(p4),(p5) ) +#define DEBUG_TRACE6(t, s, p1,p2,p3,p4,p5,p6) if(((t) & DEBUG_TRACE) != 0) hal_printf( (s), (p1),(p2),(p3),(p4),(p5),(p6) ) +#define DEBUG_TRACE7(t, s, p1,p2,p3,p4,p5,p6,p7) if(((t) & DEBUG_TRACE) != 0) hal_printf( (s), (p1),(p2),(p3),(p4),(p5),(p6),(p7) ) +#define DEBUG_TRACE8(t, s, p1,p2,p3,p4,p5,p6,p7,p8) if(((t) & DEBUG_TRACE) != 0) hal_printf( (s), (p1),(p2),(p3),(p4),(p5),(p6),(p7),(p8) ) +#define DEBUG_TRACE9(t, s, p1,p2,p3,p4,p5,p6,p7,p8,p9) if(((t) & DEBUG_TRACE) != 0) hal_printf( (s), (p1),(p2),(p3),(p4),(p5),(p6),(p7),(p8),(p9) ) #else diff --git a/Support/WireProtocol/WireProtocol.cpp b/Support/WireProtocol/WireProtocol.cpp index eb0442d1a..5ffbe847b 100644 --- a/Support/WireProtocol/WireProtocol.cpp +++ b/Support/WireProtocol/WireProtocol.cpp @@ -7,8 +7,8 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// #if 0 -#define TRACE0( msg, ...) debug_printf( msg ) -#define TRACE( msg, ...) debug_printf( msg, __VA_ARGS__ ) +#define TRACE0( msg, ...) hal_printf( msg ) +#define TRACE( msg, ...) hal_printf( msg, __VA_ARGS__ ) #else #define TRACE0(msg,...) #define TRACE(msg,...)