Added imxrt1050 board
diff --git a/Makefile b/Makefile
index f1f6dd5..650f4e6 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@
@echo " - opentitan"
@echo " - hifive1"
@echo " - nrf52"
+ @echo " - imxrt1050"
@echo
@echo "Run 'make setup' to setup Rust to build libtock-rs."
@echo "Run 'make <board>' to build libtock-rs for that board"
@@ -47,6 +48,7 @@
PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --example panic --features=custom_panic_handler,custom_alloc_error_handler
PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --example alloc_error --features=alloc,custom_alloc_error_handler
PLATFORM=opentitan cargo build --release --target=riscv32imc-unknown-none-elf --examples # Important: This is testing a platform without atomics support
+ PLATFORM=imxrt1050 cargo build --release --target=thumbv7em-none-eabi --examples --features=alloc
.PHONY: test
test:
@@ -107,6 +109,15 @@
flash-nrf52:
PLATFORM=nrf52 cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features)
+.PHONY: imxrt1050
+imxrt1050:
+ PLATFORM=imxrt1050 cargo build $(release) --target=thumbv7em-none-eabi --examples $(features)
+
+.PHONY: flash-imxrt1050
+flash-imxrt1050:
+ PLATFORM=imxrt1050 cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features)
+
+
.PHONY: clean
clean:
rm -rf target
diff --git a/boards/layout_imxrt1050.ld b/boards/layout_imxrt1050.ld
new file mode 100644
index 0000000..a29c369
--- /dev/null
+++ b/boards/layout_imxrt1050.ld
@@ -0,0 +1,18 @@
+/* Layout for the iMX.RT1050 board, used by the examples in this repository. */
+
+MEMORY {
+ /* The application region is 64 bytes (0x40) */
+ FLASH (rx) : ORIGIN = 0x63002040, LENGTH = 0xFFFFC0
+ SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 112K
+}
+
+/*
+ * Any change to STACK_SIZE should be accompanied by a corresponding change to
+ * `elf2tab`'s `--stack` option
+ */
+STACK_SIZE = 2048;
+
+MPU_MIN_ALIGN = 8K;
+
+INCLUDE layout_generic.ld
+
diff --git a/core/src/entry_point/start_item_arm.rs b/core/src/entry_point/start_item_arm.rs
index c9390f6..43e259f 100644
--- a/core/src/entry_point/start_item_arm.rs
+++ b/core/src/entry_point/start_item_arm.rs
@@ -23,7 +23,8 @@
// the Program Counter) will match the intended location of .start. We
// don't have an easy way to signal an error, so for now we just yield
// if the location is wrong.
- sub r4, pc, #4 // r4 = pc
+ mov r4, pc
+ sub r4, r4, #4 // r4 = pc
ldr r5, =.start // r5 = address of .start
cmp r4, r5
beq .Lstack_init // Jump to stack initialization if pc was correct
diff --git a/tools/flash.sh b/tools/flash.sh
index f24127e..fe9e62b 100755
--- a/tools/flash.sh
+++ b/tools/flash.sh
@@ -3,7 +3,7 @@
set -eux
artifact="$(basename $1)"
-rust_target_folder="$(readlink -f $(dirname $1)/../..)"
+rust_target_folder="$(greadlink -f $(dirname $1)/../..)"
if [ -z $APP_HEAP_SIZE ]; then
echo "Set APP_HEAP_SIZE to a value"
exit 1
@@ -35,6 +35,11 @@
binary_name=rv32imac.elf
tockload=n
;;
+ "imxrt1050")
+ tockloader_flags=""
+ binary_name=cortex-m7.elf
+ tockload=n
+ ;;
"opentitan")
tockloader_flags=""
binary_name=rv32imc.elf