| 1 |
#include <avr/io.h> |
| 2 |
#include <stdio.h> |
| 3 |
|
| 4 |
static int uart_putchar(char c, FILE *stream); |
| 5 |
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, |
| 6 |
_FDEV_SETUP_WRITE); |
| 7 |
static int |
| 8 |
uart_putchar(char c, FILE *stream) |
| 9 |
{ |
| 10 |
UDR = c; |
| 11 |
return 0; |
| 12 |
} |
| 13 |
|
| 14 |
volatile uint16_t xxx = 65; |
| 15 |
|
| 16 |
int |
| 17 |
main(void) |
| 18 |
{ |
| 19 |
stdout = &mystdout; |
| 20 |
|
| 21 |
volatile float a = 0.23; |
| 22 |
volatile float b = 0.43; |
| 23 |
|
| 24 |
printf("%.2f", 1/ (a * b * 3)); |
| 25 |
asm volatile("break;"); |
| 26 |
|
| 27 |
return 0; |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
/** |
| 32 |
check-name: Calculate with floats |
| 33 |
compiler-opts: -Wl,-u,vfprintf -lm -lprintf_flt |
| 34 |
|
| 35 |
check-start: |
| 36 |
|
| 37 |
\avr@instr@stepn{100000} |
| 38 |
\avr@test@UDR{3.37} |
| 39 |
|
| 40 |
check-end: |
| 41 |
**/ |