| 1 |
#include <avr/io.h> |
| 2 |
#include <stdio.h> |
| 3 |
|
| 4 |
char buffer[30]; |
| 5 |
|
| 6 |
volatile char buf[3]; |
| 7 |
|
| 8 |
static int uart_putchar(char c, FILE *stream); |
| 9 |
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, |
| 10 |
_FDEV_SETUP_WRITE); |
| 11 |
static int |
| 12 |
uart_putchar(char c, FILE *stream) |
| 13 |
{ |
| 14 |
UDR = c; |
| 15 |
return 0; |
| 16 |
} |
| 17 |
|
| 18 |
|
| 19 |
int |
| 20 |
main(void) |
| 21 |
{ |
| 22 |
stdout = &mystdout; |
| 23 |
|
| 24 |
buf[0] = 'x'; |
| 25 |
buf[1] = 'y'; |
| 26 |
buf[2] = '\0'; |
| 27 |
|
| 28 |
puts(buf); |
| 29 |
|
| 30 |
|
| 31 |
asm volatile("break;"); |
| 32 |
|
| 33 |
printf(":%c", buf[0]); |
| 34 |
|
| 35 |
asm volatile("break;"); |
| 36 |
|
| 37 |
printf(":%d:", buf[1]); |
| 38 |
|
| 39 |
asm volatile("break;"); |
| 40 |
|
| 41 |
volatile float x=0.23; |
| 42 |
printf(":%.2f:", x); |
| 43 |
|
| 44 |
asm volatile("break;"); |
| 45 |
|
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
/** |
| 51 |
check-name: Print to Stdout |
| 52 |
compiler-opts: -Wl,-u,vfprintf -lm -lprintf_flt |
| 53 |
check-start: |
| 54 |
|
| 55 |
\avr@instr@stepn{100000} |
| 56 |
\avr@test@UDR{xy^10} % ^10 == \n |
| 57 |
\def\avr@UDR{} |
| 58 |
|
| 59 |
\avr@instr@stepn{100000} |
| 60 |
\avr@test@UDR{:x} |
| 61 |
|
| 62 |
\avr@instr@stepn{100000} |
| 63 |
\avr@test@UDR{:121:} |
| 64 |
|
| 65 |
\avr@instr@stepn{100000} |
| 66 |
\avr@test@UDR{:0.23:} |
| 67 |
|
| 68 |
check-end: |
| 69 |
**/ |