#error freertos.h must be included before timer.h

Which compilation unit (i.e. C file) this error is coming from? Can you paste the complete error log?