/*=========================================================================== F P U T C ---------------------------------------------------------------------------*/ #if defined ( __CC_ARM ) /*---------------RealView Compiler --------------*/ int fputc(int ch, FILE *f) { if(ch == '\n') { ITM_SendChar('\r'); } ITM_SendChar(ch); return (ch); }
void sendDebugData(unsigned int * arr, unsigned int size) { static unsigned int i; for(i=0;i<size;i++){ ITM_SendChar((arr[i]>>8 )& 0xFF); ITM_SendChar(arr[i] & 0xFF); ITM_SendChar(0xFF); GTimer_Reset(DBG_GTIMER); while(GTimer_Get(DBG_GTIMER<100)){ } } }
extern int hal_trace_puts(const char * str) { // return(0); uint32_t ch; int16_t num = 0; while('\0' != (ch = *str)) { ITM_SendChar(ch); str++; num++; } ITM_SendChar('\n'); return(++num); }
/* * Write to a file. Returns 0 on success, negative on error, and the number * of characters _not_ written on partial success. This implementation sends * a buffer of size 'len' to the UART. */ int _sys_write(FILEHANDLE fh, const unsigned char * buf, unsigned len, int mode) { if (fh!=DEFAULT_HANDLE) return 0; for(int i=0;i<len;i++) { ITM_SendChar(buf[i]); // Fix for HyperTerminal if(buf[i]=='\n') { ITM_SendChar('\r'); } } return 0; }
/*----------------------------------------------------------------------------- * SER_PutChar: Write a character to the Serial Port *----------------------------------------------------------------------------*/ int32_t SER_PutChar (int32_t ch) { #ifdef __DBG_ITM int i; ITM_SendChar (ch & 0xFF); for (i = 10000; i; i--); #else //while (!(UART1_S1 & UART_S1_TDRE_MASK)); //UART1_D = (ch & 0xFF); // Wait until space is available in the FIFO // // while (!(UART_S1_REG(TERM_PORT) & UART_S1_TDRE_MASK)) //{} // Now Send the character // //UART_D_REG(TERM_PORT) = (uint8)ch; if (TERM_PORT_NUM == 0) uart0_putchar(UART0_BASE_PTR, ch); else if (TERM_PORT_NUM == 1) uart_putchar(UART1_BASE_PTR, ch); else uart_putchar(UART2_BASE_PTR, ch); #endif return (ch & 0xFF); }
void printErrorMsg(const char * errMsg) { while(*errMsg != '\0'){ ITM_SendChar(*errMsg); ++errMsg; } }
extern int hal_trace_putchar(int ch) { if(hal_true != s_hal_trace_supported_is()) { return(-1); } return(ITM_SendChar(ch)); }
int sendchar(int ch) { // if (DEMCR & TRCENA) { // while (ITM_Port32(0) == 0); // ITM_Port8(0) = ch; // } // return(ch); return ITM_SendChar(ch); }
int _write(int32_t file, uint8_t *ptr, int32_t len) { /* Implement your write code here, this is used by puts and printf for example */ int i=0; for(i=0 ; i<len ; i++) ITM_SendChar((*ptr++)); return len; }
//Low level output routine for STM32. static int __SER_PutChar (int c) { #ifdef __DBG_ITM ITM_SendChar(c); #else while (!(DEFAULT_USART->SR & USART_SR_TXE)); DEFAULT_USART->DR = (c & 0x1FF); #endif return (c); }
void debug_output_ (const char *b) { do { ITM_SendChar(*b++); } while(*b!=0); }
int _write(int32_t file, uint8_t *ptr, int32_t len) { while(len--) { ITM_SendChar(*(ptr++)); } /* Implement your write code here, this is used by puts and printf for example */ return len; }
/*---------------------------------------------------------------------------- Write character to Serial Port *----------------------------------------------------------------------------*/ int SER_PutChar (int c) { #ifdef __DBG_ITM ITM_SendChar(c); #else while (!(USART1->SR & USART_FLAG_TXE)); USART1->DR = (c & 0x1FF); #endif return (c); }
extern int hal_trace_puts(const char * str) { if(hal_true != s_hal_trace_supported_is()) { return(0); } uint32_t ch; int16_t num = 0; while('\0' != (ch = *str)) { ITM_SendChar(ch); str++; num++; } ITM_SendChar('\n'); return(++num); }
/*---------------------------------------------------------------------------- Write character to Serial Port *----------------------------------------------------------------------------*/ int SER_PutChar (int c) { #ifdef __DBG_ITM ITM_SendChar(c); #else while (!(UART->LSR & 0x20)); UART->THR = c; #endif return (c); }
/* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf set to 'Yes') calls __io_putchar() */ int __io_putchar( int c ) #else /* __GNUC__ */ int fputc( int c, FILE *stream ) #endif { #if (__CORTEX_M == 0x00) // Use LE UART or other return( c ); #else return( ITM_SendChar( c ) ); #endif }
/*---------------------------------------------------------------------------- SER_PutChar: Write a character to the Serial Port *----------------------------------------------------------------------------*/ int32_t SER_PutChar (int32_t ch) { #if defined __DBG_ITM int i; ITM_SendChar (ch & 0xFF); for (i = 5000; i; i--) __NOP(); #endif return (ch); }
/*---------------------------------------------------------------------------- Write character to Serial Port *----------------------------------------------------------------------------*/ int sendchar (int c) { #ifdef __DBG_ITM ITM_SendChar(c); #else while (!(USARTx->SR & 0x0080)); USARTx->DR = (c & 0x1FF); #endif return (c); }
int32_t SER_PutChar1 (int32_t ch) { #ifdef __DBG_ITM int i; ITM_SendChar (ch & 0xFF); for (i = 10000; i; i--); #else while (!(USART1->SR & 0x0080)); USART1->DR = (ch & 0xFF); #endif return (ch); }
int _write(int file, char * ptr, int len) { int index; if (!ptr) { return 0; } for (index = 0; index < len; index++) { while (!(USART2->SR & 0x00000040)); USART_SendData(USART2, ptr[index]); ITM_SendChar((uint8_t)ptr[index]); // Sends it to ST-Link SWO as well so that it can be observed in ST-Link Utility } return len; }
void UARTSendChar( uint32_t portNum, uint8_t character) { #ifdef __RTGT_UART LPC_UART_TypeDef *LPC_UART; LPC_UART = (portNum == 0 ? (LPC_UART_TypeDef *)LPC_UART0 : (LPC_UART_TypeDef *)LPC_UART1 ); while (!(LPC_UART->LSR & 0x20)); LPC_UART->THR = character; #else ITM_SendChar(character); #endif }
/* * put a string * I re-define the puts, and will cause printf * to the real debug method */ int puts(const char *s) { int count = 0; do { #ifdef CONFIG_DEBUG_USE_UART uart_putchar(*s); if (*s == '\n') { uart_putchar('\r'); } #elif CONFIG_DEBUG_USE_ITM ITM_SendChar(*s); #endif count++; s++; } while (*s); return count; }
// This function is called by HAL_UART_Init(). void HAL_UART_MspInit(UART_HandleTypeDef *huart) { if (huart != &handle) { // !! harcoded only for USART1, like the rest of this file. ITM_SendChar('!'); return; } RCC_PeriphCLKInitTypeDef RCC_PeriphClkInit; /*##-1- Enable Clocks #################################*/ /* Select SysClk as source of USART1 clocks */ RCC_PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1; RCC_PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_SYSCLK; HAL_RCCEx_PeriphCLKConfig(&RCC_PeriphClkInit); /* Enable USARTx clock */ __HAL_RCC_USART1_CLK_ENABLE(); /*##-2- Make sure the irq handler is disabled for now */ /* NVIC for USARTx */ HAL_NVIC_DisableIRQ(USART1_IRQn); }
/** This fputc function redirects any printf messages */ int fputc(int c, FILE *f) { ITM_SendChar(c); return (c); }
int fputc(int c, FILE *stream) { return(ITM_SendChar(c)); }
int fputc (int ch, FILE *f) { ITM_SendChar(ch); return ch; }
int putchars(int ch){ return ITM_SendChar(ch); }
extern int hal_trace_putchar(int ch) { // return(-1); return(ITM_SendChar(ch)); }
void swoPlatformSendChar(char c){ ITM_SendChar(c); }
int fputc(int ch, FILE *f) { return (ITM_SendChar((uint32_t)ch)); }