#ifndef F_CPU
#define F_CPU 16000000UL
#endif
//#include <stdlib.h>
#include <avr/io.h>
#include <stdio.h>
#include <util/delay.h>
#include "main.h"
#include "uart.h"
#ifdef __GNUC__
#pragma GCC poison putchar vfprintf
//#pragma GCC optimize("O3,inline") // "inline" won't happen without it
#pragma GCC optimize("O3,fast-math,inline") // "fast-math" helps auto-vectorize loops
//#pragma GCC optimize("Ofast,inline") // "Ofast" = "O3,fast-math,allow-store-data-races,no-protect-parens"
#endif
int main(void)
{
uart_init();
stdout = &uart_output;
stdin = &uart_input;
printf("%d\n", 12345);
printf("%.2f\n", 123.456); // -Wl,-u,vfprintf -lprintf_flt -lm
while (1) {
/* Blink led by toggling state of PORTB5 (Arduino digital 13). */
PORTB ^= _BV(PORTB5);
puts("Hello world!");
_delay_ms(500);
}
return 0;
}