Merge #189
189: Added nucleo r=jrvanwhy a=alexandruradovici
This adds the memory layout for building applications for the Nucelo F429zi and F446re boards.
Co-authored-by: Alexandru Radovici <msg4alex@gmail.com>
diff --git a/Makefile b/Makefile
index d205cc7..36921bb 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,8 @@
@echo "libtock-rs currently includes support for the following platforms:"
@echo " - hail"
@echo " - nrf52840"
+ @echo " - nucleo_f429zi"
+ @echo " - nucleo_f446re"
@echo " - opentitan"
@echo " - hifive1"
@echo " - nrf52"
@@ -102,6 +104,22 @@
flash-hail:
PLATFORM=hail cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features)
+.PHONY: nucleo_f429zi
+nucleo_f429zi:
+ PLATFORM=nucleo_f429zi cargo build $(release) --target=thumbv7em-none-eabi --examples $(features)
+
+.PHONY: flash-nucleo_f429zi
+flash-nucleo_f429zi:
+ PLATFORM=nucleo_f429zi cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features)
+
+.PHONY: nucleo_f446re
+nucleo_f446re:
+ PLATFORM=nucleo_f446re cargo build $(release) --target=thumbv7em-none-eabi --examples $(features)
+
+.PHONY: flash-nucleo_f446re
+flash-nucleo_f446re:
+ PLATFORM=nucleo_f446re cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features)
+
.PHONY: nrf52840
nrf52840:
PLATFORM=nrf52840 cargo build $(release) --target=thumbv7em-none-eabi --examples $(features)
diff --git a/boards/layout_nucleo_f429zi.ld b/boards/layout_nucleo_f429zi.ld
new file mode 100644
index 0000000..8261e9c
--- /dev/null
+++ b/boards/layout_nucleo_f429zi.ld
@@ -0,0 +1,17 @@
+/* Layout for the Nucleo F429zi, used by the examples in this repository. */
+
+MEMORY {
+ /* The application region is 64 bytes (0x40) */
+ FLASH (rx) : ORIGIN = 0x08040040, LENGTH = 255K
+ 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/boards/layout_nucleo_f446re.ld b/boards/layout_nucleo_f446re.ld
new file mode 100644
index 0000000..6536b30
--- /dev/null
+++ b/boards/layout_nucleo_f446re.ld
@@ -0,0 +1,17 @@
+/* Layout for the Nucleo F446re, used by the examples in this repository. */
+
+MEMORY {
+ /* The application region is 64 bytes (0x40) */
+ FLASH (rx) : ORIGIN = 0x08040040, LENGTH = 255K
+ SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 176K
+}
+
+/*
+ * 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/tools/flash.sh b/tools/flash.sh
index ea75dee..1a7d74c 100755
--- a/tools/flash.sh
+++ b/tools/flash.sh
@@ -20,6 +20,11 @@
binary_name=cortex-m4.elf
tockload=n
;;
+ "nucleo_f429zi"|"nucleo_f446re")
+ tockloader_flags=""
+ binary_name=cortex-m4.elf
+ tockload=n
+ ;;
"nrf52"|"nrf52840")
tockloader_flags="--jlink --arch cortex-m4 --board nrf52dk --jtag-device nrf52"
binary_name=cortex-m4.elf