MLECO-2345: Adding dynamic load support for FVPs

With this patch, the generic inference runner use-case can be
configured to accept the model tflite file at run-time via
the FVP's command line parameters. Same is true for the IFM
and the inference results can be dumped out too.

NOTE: this change is only for supporting the FVP, the FPGA
implementation will not allow additional loading for the
changes in this patch to be useful.

Change-Id: I1318bd5b0cfb7bb635ced6fe58d22c3e401d2547
diff --git a/source/use_case/inference_runner/src/TestModel.cc b/source/use_case/inference_runner/src/TestModel.cc
index 4512a9b..274790f 100644
--- a/source/use_case/inference_runner/src/TestModel.cc
+++ b/source/use_case/inference_runner/src/TestModel.cc
@@ -23,14 +23,34 @@
     return this->m_opResolver;
 }
 
-extern uint8_t* GetModelPointer();
-const uint8_t* arm::app::TestModel::ModelPointer()
-{
-    return GetModelPointer();
-}
+#if defined(DYNAMIC_MODEL_BASE) && defined(DYNAMIC_MODEL_SIZE)
 
-extern size_t GetModelLen();
-size_t arm::app::TestModel::ModelSize()
-{
-    return GetModelLen();
-}
\ No newline at end of file
+    const uint8_t* arm::app::TestModel::ModelPointer()
+    {
+        info("Model pointer: 0x%08x\n", DYNAMIC_MODEL_BASE);
+        return reinterpret_cast<uint8_t *>(DYNAMIC_MODEL_BASE);
+    }
+
+    size_t arm::app::TestModel::ModelSize()
+    {
+        /* TODO: Can we get the actual model size here somehow?
+         * Currently we return the reserved space. It is possible to do
+         * so by reading the memory pattern but it will not be reliable. */
+        return static_cast<size_t>(DYNAMIC_MODEL_SIZE);
+    }
+
+#else /* defined(DYNAMIC_MODEL_BASE) && defined(DYNAMIC_MODEL_SIZE) */
+
+    extern uint8_t* GetModelPointer();
+    const uint8_t* arm::app::TestModel::ModelPointer()
+    {
+        return GetModelPointer();
+    }
+
+    extern size_t GetModelLen();
+    size_t arm::app::TestModel::ModelSize()
+    {
+        return GetModelLen();
+    }
+
+#endif /* defined(DYNAMIC_MODEL_BASE) && defined(DYNAMIC_MODEL_SIZE) */