Updates to allow building in a desktop environment.

The changes allow ContextHub codebase to be built outside of the Android
build environment. Useful for testing.

Test: manual

Change-Id: I51eb236823b4483a439ab26d58970ec9568161b6
diff --git a/firmware/os/core/nanohub_chre.c b/firmware/os/core/nanohub_chre.c
index b8e6825..f23f860 100644
--- a/firmware/os/core/nanohub_chre.c
+++ b/firmware/os/core/nanohub_chre.c
@@ -75,7 +75,7 @@
     va_list innerArgs;
     enum chreLogLevel level = va_arg(args, int /* enums promoted to ints in va_args in C */);
     const static char levels[] = "EWIDV";
-    char clevel = (level > CHRE_LOG_DEBUG || level < 0) ? 'V' : levels[level];
+    char clevel = (level > CHRE_LOG_DEBUG || (int) level < 0) ? 'V' : levels[level];
     const char *str = va_arg(args, const char*);
     uintptr_t inner = va_arg(args, uintptr_t);
 
@@ -89,7 +89,7 @@
     va_list innerArgs;
     enum chreLogLevel level = va_arg(args, int /* enums promoted to ints in va_args in C */);
     const static char levels[] = "EWIDV";
-    char clevel = (level > CHRE_LOG_DEBUG || level < 0) ? 'V' : levels[level];
+    char clevel = (level > CHRE_LOG_DEBUG || (int) level < 0) ? 'V' : levels[level];
     const char *str = va_arg(args, const char*);
     uintptr_t inner = va_arg(args, uintptr_t);
 
diff --git a/firmware/os/core/seos.c b/firmware/os/core/seos.c
index f220dc3..8d100f5 100644
--- a/firmware/os/core/seos.c
+++ b/firmware/os/core/seos.c
@@ -711,7 +711,8 @@
 
         // print external NanoApp info to facilitate NanoApp debugging
         if (!(task->app->hdr.fwFlags & FL_APP_HDR_INTERNAL))
-            osLog(LOG_INFO, "loaded app ID 0x%llx at flash base 0x%08x ram base 0x%08x; TID %04X\n",
+            osLog(LOG_INFO,
+                  "loaded app ID 0x%" PRIx64 " at flash base 0x%" PRIxPTR " ram base 0x%" PRIxPTR "; TID %04X\n",
                   task->app->hdr.appId, (uintptr_t) task->app, (uintptr_t) task->platInfo.data, task->tid);
 
         done = osTaskInit(task);
diff --git a/firmware/os/inc/chreApi.h b/firmware/os/inc/chreApi.h
index f494236..cf9bd49 100644
--- a/firmware/os/inc/chreApi.h
+++ b/firmware/os/inc/chreApi.h
@@ -20,6 +20,8 @@
 #include <stdarg.h>
 #include <stdint.h>
 
+#include "util.h"
+
 /* if va_list is passed by value it must fit in 32-bit register */
 #if !defined(SYSCALL_PARAMS_PASSED_AS_PTRS) || !defined(SYSCALL_VARARGS_PARAMS_PASSED_AS_PTRS)
 C_STATIC_ASSERT(va_list_size, sizeof(va_list) == sizeof(uint32_t));
diff --git a/firmware/os/inc/sensors_priv.h b/firmware/os/inc/sensors_priv.h
index 956c171..90a4c99 100644
--- a/firmware/os/inc/sensors_priv.h
+++ b/firmware/os/inc/sensors_priv.h
@@ -18,6 +18,7 @@
 #define __SENSORS_PRIV_H__
 
 #include <inttypes.h>
+#include <sensors.h>
 #include <seos.h>
 
 struct Sensor {
diff --git a/firmware/os/inc/util.h b/firmware/os/inc/util.h
index 155322b..b8674f4 100644
--- a/firmware/os/inc/util.h
+++ b/firmware/os/inc/util.h
@@ -36,7 +36,7 @@
  */
 #define C_STATIC_ASSERT(name, condition) \
     static const char __attribute__((used, section(".static_assert"))) \
-    static_assert_check_ ## name [(condition) ? 0 : -1]
+    static_assert_check_ ## name [(condition) ? 0 : -1] = {}
 
 #define unlikely(x) (x)
 #define likely(x) (x)
diff --git a/firmware/os/platform/native/inc/plat/app.h b/firmware/os/platform/native/inc/plat/app.h
index 5617672..f72721d 100644
--- a/firmware/os/platform/native/inc/plat/app.h
+++ b/firmware/os/platform/native/inc/plat/app.h
@@ -18,8 +18,7 @@
 #define _PLAT_LNX_APP_H_
 
 struct PlatAppInfo {
-    int dummy;
-    //todo
+    void* data;  // dummy
 };
 
 #endif
diff --git a/firmware/os/platform/native/inc/plat/plat.h b/firmware/os/platform/native/inc/plat/plat.h
index 5cda58f..3e4eb84 100644
--- a/firmware/os/platform/native/inc/plat/plat.h
+++ b/firmware/os/platform/native/inc/plat/plat.h
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include <stdint.h>
+
 #ifndef _LINUX_PLAT_H_
 #define _LINUX_PLAT_H_
 
@@ -21,10 +23,20 @@
 extern "C" {
 #endif
 
-static inline void platWake(void)
+const struct AppHdr* platGetInternalAppList(uint32_t *numAppsP);
+
+// External apps not supported
+static inline uint8_t* platGetSharedAreaInfo(uint32_t *areaSzP)
 {
+    // Note: current seos.c code assumes that it will be able to read at least
+    // 4 bytes. This will be addressed, but using this workaround for now.
+    static uint8_t appHdr[4] = {0xff, 0xff, 0xff, 0xff};
+    *areaSzP = 0;
+    return appHdr;
 }
 
+static inline void platWake(void) {}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/firmware/os/platform/native/inc/plat/wdt.h b/firmware/os/platform/native/inc/plat/wdt.h
index 430a385..b28b037 100644
--- a/firmware/os/platform/native/inc/plat/wdt.h
+++ b/firmware/os/platform/native/inc/plat/wdt.h
@@ -22,6 +22,8 @@
 #endif
 
 void wdtInit(){}
+void wdtEnableClk(){}
+void wdtDisableClk(){}
 
 #ifdef __cplusplus
 }