Add __heap_size__ defines

Also move the output variables to the model_output section.

Change-Id: I6e4be4c35db08a7d2b2475936bfdd232cfc50abf
diff --git a/float_models/CMakeLists.txt b/float_models/CMakeLists.txt
index a3d9458..5b1e99c 100644
--- a/float_models/CMakeLists.txt
+++ b/float_models/CMakeLists.txt
@@ -124,6 +124,7 @@
     model_util::util
   LINKOPTS
     "LINKER:--defsym=__stack_size__=100k"
+    "LINKER:--defsym=__heap_size__=512k"
 )
 
 springbok_test(
@@ -138,6 +139,7 @@
     model_util::util
   LINKOPTS
     "LINKER:--defsym=__stack_size__=100k"
+    "LINKER:--defsym=__heap_size__=512k"
   COPTS
     "-DBUILD_EMITC"
   TESTFILES
diff --git a/float_models/iree_exec/mnist.c b/float_models/iree_exec/mnist.c
index 6053033..fb560f4 100644
--- a/float_models/iree_exec/mnist.c
+++ b/float_models/iree_exec/mnist.c
@@ -35,7 +35,7 @@
 #endif
 #include "mnist_input_c.h"
 
-MnistOutput score;
+__attribute__((section(".model_output"))) MnistOutput score;
 
 iree_status_t create_module(iree_vm_instance_t *instance,
                             iree_vm_module_t **module) {
diff --git a/float_models/iree_exec/mobilenet_v1.c b/float_models/iree_exec/mobilenet_v1.c
index 82d9789..0dc5710 100644
--- a/float_models/iree_exec/mobilenet_v1.c
+++ b/float_models/iree_exec/mobilenet_v1.c
@@ -35,7 +35,7 @@
 #include "mobilenet_v1_c_module_static_emitc.h"
 #endif
 
-MobilenetV1Output score;
+__attribute__((section(".model_output"))) MobilenetV1Output score;
 
 iree_status_t create_module(iree_vm_instance_t *instance,
                             iree_vm_module_t **module) {
diff --git a/quant_models/CMakeLists.txt b/quant_models/CMakeLists.txt
index 0c5dc39..426c58c 100644
--- a/quant_models/CMakeLists.txt
+++ b/quant_models/CMakeLists.txt
@@ -11,15 +11,15 @@
 
 springbok_modules(
   NAME
-  mobilenet_v1
+    mobilenet_v1
   SRC
-  "mobilenet_v1_0.25_224_quant.tflite"
+    "mobilenet_v1_0.25_224_quant.tflite"
   C_IDENTIFIER
-  "quant_models_mobilenet_v1"
+    "quant_models_mobilenet_v1"
   FLAGS
-  "-iree-input-type=tosa"
-  "-riscv-v-vector-bits-min=512"
-  "-riscv-v-fixed-length-vector-lmul-max=8"
+    "-iree-input-type=tosa"
+    "-riscv-v-vector-bits-min=512"
+    "-riscv-v-fixed-length-vector-lmul-max=8"
   PUBLIC
 )
 
@@ -39,15 +39,15 @@
 
 springbok_modules(
   NAME
-  person_detection
+    person_detection
   SRC
-  "person_detection.tflite"
+    "person_detection.tflite"
   C_IDENTIFIER
-  "quant_models_person_detection"
+    "quant_models_person_detection"
   FLAGS
-  "-iree-input-type=tosa"
-  "-riscv-v-vector-bits-min=512"
-  "-riscv-v-fixed-length-vector-lmul-max=8"
+    "-iree-input-type=tosa"
+    "-riscv-v-vector-bits-min=512"
+    "-riscv-v-fixed-length-vector-lmul-max=8"
   PUBLIC
 )
 
@@ -57,22 +57,22 @@
 
 iree_model_input(
   NAME
-  mobilenet_quant_input
+    mobilenet_quant_input
   SHAPE
-  "1, 224, 224, 3"
+    "1, 224, 224, 3"
   SRC
-  "https://storage.googleapis.com/download.tensorflow.org/ \
+    "https://storage.googleapis.com/download.tensorflow.org/ \
     example_images/YellowLabradorLooking_new.jpg"
   QUANT
 )
 
 iree_model_input(
   NAME
-  person_detection_quant_input
+    person_detection_quant_input
   SHAPE
-  "1, 96, 96, 1"
+    "1, 96, 96, 1"
   SRC
-  "https://github.com/tensorflow/tflite-micro/raw/aeac6f39e5c7475cea20c54e86d41e3a38312546/ \
+    "https://github.com/tensorflow/tflite-micro/raw/aeac6f39e5c7475cea20c54e86d41e3a38312546/ \
     tensorflow/lite/micro/examples/person_detection/testdata/person.bmp"
   QUANT
 )
@@ -135,6 +135,7 @@
     model_util::util
   LINKOPTS
     "LINKER:--defsym=__stack_size__=300k"
+    "LINKER:--defsym=__heap_size__=2m"
 )
 
 springbok_test(
@@ -149,6 +150,7 @@
     model_util::util
   LINKOPTS
     "LINKER:--defsym=__stack_size__=300k"
+    "LINKER:--defsym=__heap_size__=2m"
   COPTS
     "-DBUILD_EMITC"
   TESTFILES
@@ -169,6 +171,7 @@
     model_util::util
   LINKOPTS
     "LINKER:--defsym=__stack_size__=128k"
+    "LINKER:--defsym=__heap_size__=200k"
 )
 
 springbok_test(
@@ -183,6 +186,7 @@
     model_util::util
   LINKOPTS
     "LINKER:--defsym=__stack_size__=128k"
+    "LINKER:--defsym=__heap_size__=200k"
   COPTS
     "-DBUILD_EMITC"
   TESTFILES
diff --git a/quant_models/iree_exec/mobilenet_v1.c b/quant_models/iree_exec/mobilenet_v1.c
index dd7e8e9..f67f310 100644
--- a/quant_models/iree_exec/mobilenet_v1.c
+++ b/quant_models/iree_exec/mobilenet_v1.c
@@ -35,7 +35,7 @@
 #include "mobilenet_v1_c_module_static_emitc.h"
 #endif
 
-MobilenetV1Output score;
+__attribute__((section(".model_output"))) MobilenetV1Output score;
 
 iree_status_t create_module(iree_vm_instance_t *instance,
                             iree_vm_module_t **module) {
diff --git a/quant_models/iree_exec/mobilenet_v2.c b/quant_models/iree_exec/mobilenet_v2.c
index 74caa34..9169ee2 100644
--- a/quant_models/iree_exec/mobilenet_v2.c
+++ b/quant_models/iree_exec/mobilenet_v2.c
@@ -35,7 +35,7 @@
 #include "mobilenet_v2_c_module_static_emitc.h"
 #endif
 
-MobilenetV2Output score;
+__attribute__((section(".model_output"))) MobilenetV2Output score;
 
 iree_status_t create_module(iree_vm_instance_t *instance,
                             iree_vm_module_t **module) {
diff --git a/quant_models/iree_exec/person_detection.c b/quant_models/iree_exec/person_detection.c
index 93de25b..04e26f1 100644
--- a/quant_models/iree_exec/person_detection.c
+++ b/quant_models/iree_exec/person_detection.c
@@ -35,7 +35,7 @@
 #endif
 #include "person_detection_quant_input_c.h"
 
-PersonDetectionOutput detection;
+__attribute__((section(".model_output"))) PersonDetectionOutput detection;
 
 iree_status_t create_module(iree_vm_instance_t *instance,
                             iree_vm_module_t **module) {