The most interesting files are:
main.c
gyro.c
andcompass.c
handle the sensor stuff, (but some of the compass heading calculation is still done inmain.c
)interrupts.c
is actually just renamed, it was (confusingly) calledstm32f30x_it.c
, but it contains most of the interrupt handlers.usart.c
contains USART output routines The USART interrupt lives here, not interrupts.c.newlib.c
contains all the newlib (libc) interfacing stuff, including system call stubs, etc.newlib.c
allows you to use printf as usual, whilst having the output come out of USART. Obviouslynewlib.c
assumes that you're using the newlib library, which you need to have configure'd with--disable-newlib-supplied-syscalls
.
If you get a hard fault exception when printf
ing a %d
bigger than 10, you have to re-configure and recompile both gcc and newlib with hard floats:
--with-cpu=cortex-m4
--with-float=hard
--with-fpu=fpv4-sp-d16
--with-mode=thumb