cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 / Olimex H103 and debug Printf in Keil

longchair
Associate III
Posted on August 22, 2012 at 14:17

Hello everyone.

I am currently on a project involving STM32F103, and for this I have the following hardware :

- STM32-H103 Olimex board

- Ulink2 interface

- Keil uVison 4.54.

I have been trying recently to setup properly the debuging platform and it goes fine except for one thing. I can flash debug put breakpoints etc .. but I cannnot have printf come to the debug printf window in Keil.

I have checked all the tutorials and documentations that I have found, browsed many forums without being able to find a proper solution.

So I will sum up here what I have done. If any of you can figure out what I did wrong that would be great 🙂

First of all debugging window :

0690X00000602lhQAA.jpg

0690X00000602fqQAA.jpg

0690X00000602dyQAA.jpg

Added to this configuration I have inserted the redirection of fputc :

struct __FILE { int handle; /* Add whatever needed */ };

 

FILE __stdout;

 

FILE __stdin;

int fputc(int ch, FILE *f) {

 

 ITM_SendChar(ch);

 

 return(ch);

 

} Finally after checking many samples and the documentation, I have made an .ini File (see above) which is used at debug startup :

FUNC void DebugSetup (void) {

 

// <h> Debug MCU Configuration

 

//   <o1.0>    DBG_SLEEP     <i> Debug Sleep Mode

 

//   <o1.1>    DBG_STOP      <i> Debug Stop Mode

 

//   <o1.2>    DBG_STANDBY   <i> Debug Standby Mode

 

//   <o1.5>    TRACE_IOEN    <i> Trace I/O Enable

 

//   <o1.6..7> TRACE_MODE    <i> Trace Mode

 

//             <0=> Asynchronous

 

//             <1=> Synchronous: TRACEDATA Size 1

 

//             <2=> Synchronous: TRACEDATA Size 2

 

//             <3=> Synchronous: TRACEDATA Size 4

 

//   <o1.8>    DBG_IWDG_STOP <i> Independant Watchdog Stopped when Core is halted

 

//   <o1.9>    DBG_WWDG_STOP <i> Window Watchdog Stopped when Core is halted

 

//   <o1.10>   DBG_TIM1_STOP <i> Timer 1 Stopped when Core is halted

 

//   <o1.11>   DBG_TIM2_STOP <i> Timer 2 Stopped when Core is halted

 

//   <o1.12>   DBG_TIM3_STOP <i> Timer 3 Stopped when Core is halted

 

//   <o1.13>   DBG_TIM4_STOP <i> Timer 4 Stopped when Core is halted

 

//   <o1.14>   DBG_CAN_STOP  <i> CAN Stopped when Core is halted

 

// </h>

 

 

 

 _WDWORD(0xE0042004, 0x00000027);  // DBGMCU_CR

 

 

 

}

 

DebugSetup();                       // Debugger Setup

 

 

Now when I use printf in my software, it will pass on the instruction and get into putc function, but nothing will come out on the debug printf in Keil.

If anyone has an idea of what could cause this, that would be VERY appreciated 🙂

Thanks,

LongChair

0 REPLIES 0