Merge "Add trap handlers to exception tests"
diff --git a/BUILD b/BUILD
index 4ed9d4a..fb944a2 100644
--- a/BUILD
+++ b/BUILD
@@ -18,9 +18,21 @@
build_setting_default = False,
)
+bool_flag(
+ name = "link_tcm_highmem",
+ build_setting_default = False,
+)
+
config_setting(
name = "link_tcm_config",
flag_values = {
":link_tcm": "True",
},
-)
\ No newline at end of file
+)
+
+config_setting(
+ name = "link_tcm_highmem_config",
+ flag_values = {
+ ":link_tcm_highmem": "True",
+ },
+)
diff --git a/crt/BUILD b/crt/BUILD
index a0c26d5..85c25ab 100644
--- a/crt/BUILD
+++ b/crt/BUILD
@@ -17,6 +17,7 @@
filegroup(
name = "kelvin_linker",
srcs = select({
+ "//:link_tcm_highmem_config": ["kelvin_tcm_highmem.ld"],
"//:link_tcm_config": ["kelvin_tcm.ld"],
"//conditions:default": ["kelvin.ld"],
}),
diff --git a/crt/kelvin_tcm_highmem.ld b/crt/kelvin_tcm_highmem.ld
new file mode 100644
index 0000000..dc46060
--- /dev/null
+++ b/crt/kelvin_tcm_highmem.ld
@@ -0,0 +1,88 @@
+/* Copyright 2024 Google LLC. */
+/* Licensed under the Apache License, Version 2.0, see LICENSE for details. */
+/* SPDX-License-Identifier: Apache-2.0 */
+
+MEMORY {
+ ITCM(rx): ORIGIN = 0x00000000, LENGTH = 1024K
+ DTCM(rw): ORIGIN = 0x00100000, LENGTH = 1024K
+}
+
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x1000;
+HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x1000;
+
+ENTRY(_start)
+
+SECTIONS {
+ /* ITCM data here */
+ . = ORIGIN(ITCM);
+ .text : ALIGN(16) {
+ *(._init)
+ *(.text)
+ *(.text.*)
+ . = ALIGN(16);
+ } > ITCM
+
+ .init.array : ALIGN(16) {
+ __init_array_start = .;
+ __init_array_start__ = .;
+ *(.init_array)
+ *(.init_array.*)
+ . = ALIGN(16);
+ __init_array_end = .;
+ __init_array_end__ = .;
+ } > ITCM
+
+ .rodata : ALIGN(16) {
+ *(.srodata)
+ *(.srodata.*)
+ *(.rodata)
+ *(.rodata.*)
+ . = ALIGN(16);
+ } > ITCM
+
+ .data : ALIGN(16) {
+ __data_start__ = .;
+ /**
+ * This will get loaded into `gp`, and the linker will use that register for
+ * accessing data within [-2048,2047] of `__global_pointer$`.
+ *
+ * This is much cheaper (for small data) than materializing the
+ * address and loading from that (which will take one extra instruction).
+ */
+ _global_pointer = . + 0x800;
+ *(.sdata)
+ *(.sdata.*)
+ *(.data)
+ *(.data.*)
+ /**
+ * Memory location for the return value from main,
+ * which could be inspected by another core in the system.
+ **/
+ _ret = .;
+ . = ALIGN(16);
+ __data_end__ = .;
+ } > DTCM
+
+ /* DTCM data here */
+ . = ORIGIN(DTCM);
+ .bss : ALIGN(16) {
+ __bss_start__ = .;
+ *(.sbss)
+ *(.sbss.*)
+ *(.bss)
+ *(.bss.*)
+ __bss_end__ = .;
+ } > DTCM
+
+ .heap : ALIGN(16) {
+ __heap_start__ = .;
+ . += HEAP_SIZE;
+ __heap_end__ = .;
+ } > DTCM
+
+ .stack : ALIGN(16) {
+ __stack_start__ = .;
+ . += STACK_SIZE;
+ __stack_end__ = .;
+ } > DTCM
+}
\ No newline at end of file
diff --git a/tests/tflm/BUILD b/tests/tflm/BUILD
index 3834394..c40e150 100644
--- a/tests/tflm/BUILD
+++ b/tests/tflm/BUILD
@@ -90,6 +90,7 @@
srcs = [
"@tflite-micro//tensorflow/lite/micro/kernels:logistic_test.cc",
],
+ hw_test_size = "large",
deps = [
"//crt",
"@tflite-micro//tensorflow/lite/c:common",