summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2018-03-02 13:51:33 +0100
committerchrome-bot <chrome-bot@chromium.org>2018-03-16 13:30:05 -0700
commit171916a4a37c369013849b1ebc597538504254f6 (patch)
treeb1f99744b72e65b6d4874c54427ddb5f2c706d98
parentcf30d5c29dae458f1f616351b48f8d04aa4a777a (diff)
downloadchrome-ec-171916a4a37c369013849b1ebc597538504254f6.tar.gz
meowth_fp: move large buffers
Configure the large arrays for the image frame and template in other SRAM memory regions to free up space for the malloc heap in the 'main' SRAM. Note: the template buffer is only used in future CLs. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:72360575 TEST=on ZerbleBarn, run the 'shmem' console and see 500kB of heap available for malloc. Change-Id: I31a1b4fb0d5e124e3229d29386cc6500e402dac0 Reviewed-on: https://chromium-review.googlesource.com/946370 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--board/meowth_fp/board.h4
-rw-r--r--common/fpsensor.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/board/meowth_fp/board.h b/board/meowth_fp/board.h
index 65327dbe90..33949cb61e 100644
--- a/board/meowth_fp/board.h
+++ b/board/meowth_fp/board.h
@@ -53,6 +53,10 @@
* (shared_mem_init done too late).
*/
#define CONFIG_MALLOC
+/* Special memory regions to store large arrays */
+#define FP_FRAME_SECTION __SECTION(ahb4)
+#define FP_TEMPLATE_SECTION __SECTION(ahb)
+
/* we are doing slow compute */
#undef CONFIG_WATCHDOG_PERIOD_MS
#define CONFIG_WATCHDOG_PERIOD_MS 10000
diff --git a/common/fpsensor.c b/common/fpsensor.c
index bf342f3cce..c465dd6963 100644
--- a/common/fpsensor.c
+++ b/common/fpsensor.c
@@ -10,6 +10,7 @@
#include "fpsensor.h"
#include "gpio.h"
#include "host_command.h"
+#include "link_defs.h"
#include "mkbp_event.h"
#include "spi.h"
#include "system.h"
@@ -27,8 +28,13 @@
#define FP_SENSOR_RES_Y 0
#endif
+/* if no special memory regions are defined, fallback on regular SRAM */
+#ifndef FP_FRAME_SECTION
+#define FP_FRAME_SECTION
+#endif
+
/* Last acquired frame */
-static uint8_t fp_buffer[FP_SENSOR_IMAGE_SIZE];
+static uint8_t fp_buffer[FP_SENSOR_IMAGE_SIZE] FP_FRAME_SECTION;
#define CPRINTF(format, args...) cprintf(CC_FP, format, ## args)
#define CPRINTS(format, args...) cprints(CC_FP, format, ## args)