Merge branch 'master' into imxrt1050
diff --git a/Makefile b/Makefile
index 87b6a10..5218010 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,7 @@
@echo " - opentitan"
@echo " - hifive1"
@echo " - nrf52"
+ @echo " - imxrt1050"
@echo " - apollo3"
@echo
@echo "Run 'make setup' to setup Rust to build libtock-rs."
@@ -152,6 +153,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:
cargo clean
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 757e556..b3ba682 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 1a7d74c..cee7571 100755
--- a/tools/flash.sh
+++ b/tools/flash.sh
@@ -40,6 +40,11 @@
binary_name=rv32imac.elf
tockload=n
;;
+ "imxrt1050")
+ tockloader_flags=""
+ binary_name=cortex-m7.elf
+ tockload=n
+ ;;
"opentitan")
tockloader_flags=""
binary_name=rv32imc.elf