Update toolchain macros.

The updates allow ContextHub to build in other environments (such as
testing).

Change-Id: I69f911412b8161b1e6c53f440b9dfe6571847ba7
diff --git a/firmware/inc/seos.h b/firmware/inc/seos.h
index 23d4e9c..fd15e73 100644
--- a/firmware/inc/seos.h
+++ b/firmware/inc/seos.h
@@ -152,7 +152,7 @@
 };
 
 void osLogv(enum LogLevel level, const char *str, va_list vl);
-void osLog(enum LogLevel level, const char *str, ...) PRINTF_ATTRIBUTE;
+void osLog(enum LogLevel level, const char *str, ...) PRINTF_ATTRIBUTE(2, 3);
 
 #ifndef INTERNAL_APP_INIT
 #define INTERNAL_APP_INIT(_id, _ver, _init, _end, _event)                                   \
diff --git a/firmware/inc/toolchain.h b/firmware/inc/toolchain.h
index 332edab..d682958 100644
--- a/firmware/inc/toolchain.h
+++ b/firmware/inc/toolchain.h
@@ -50,13 +50,16 @@
 
 #define STACKLESS      __stackless
 
-
-#define PRINTF_ATTRIBUTE
+#ifndef PRINTF_ATTRIBUTE
+#define PRINTF_ATTRIBUTE(string_index, first_to_check)
+#endif
 
 #define SET_PACKED_STRUCT_MODE_ON       _Pragma("pack(push, 1)")
 #define SET_PACKED_STRUCT_MODE_OFF      _Pragma("pack(pop)")
 
+#ifndef ATTRIBUTE_PACKED
 #define ATTRIBUTE_PACKED
+#endif
 
 #define UNROLLED
 
@@ -89,12 +92,17 @@
 
 #define STACKLESS __attribute__((naked))
 
-#define PRINTF_ATTRIBUTE __attribute__((format(printf, 2, 3)))
+#ifndef PRINTF_ATTRIBUTE
+#define PRINTF_ATTRIBUTE(string_index, first_to_check) \
+    __attribute__((format(printf, string_index, first_to_check)))
+#endif
 
 #define SET_PACKED_STRUCT_MODE_ON
 #define SET_PACKED_STRUCT_MODE_OFF
 
+#ifndef ATTRIBUTE_PACKED
 #define ATTRIBUTE_PACKED __attribute__((packed))
+#endif
 
 #define UNROLLED   __attribute__((optimize("unroll-loops")))