Merge #203
203: Add a CI tool that prints a size diff for incoming PRs. r=jrvanwhy a=jrvanwhy
The diff is computed by building the examples with `make examples` both in the PR's target branch and the merge result, and running `diff` on the result.
This is built using GitHub Actions because upstream Tock is moving to GitHub Actions (see https://github.com/tock/tock/pull/1815, and [this core WG discussion](https://github.com/tock/tock/blob/master/doc/wg/core/notes/core-notes-2020-04-24.md#ci-infrastructure-travis-to-github-actions)).
Co-authored-by: Johnathan Van Why <jrvanwhy@google.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/README.md b/README.md
index 52ea0b6..72506cd 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,11 @@
Rust userland library for Tock (WIP)
-Tested with tock [Release 1.4.1](https://github.com/tock/tock/commit/7e37bf67761d83fd585cace4fb201e2864d300b1).
+Generally this library was tested with tock [Release 1.5](https://github.com/tock/tock/releases/tag/release-1.5).
+Since then changes have been made that might not work with the Tock
+release 1.5, but instead target Tock master. For example this library
+might support newer boards (Apollo3), changed boards (HiFive1 revB) or
+new drivers (HMAC).
The library works in principle on most boards, but there is currently the [showstopper
bug #28](https://github.com/tock/libtock-rs/issues/28) that prevents
diff --git a/boards/layout_nrf52.ld b/boards/layout_nrf52.ld
index 419a0bc..40cdb10 100644
--- a/boards/layout_nrf52.ld
+++ b/boards/layout_nrf52.ld
@@ -3,7 +3,7 @@
MEMORY {
/* The application region is 64 bytes (0x40) */
FLASH (rx) : ORIGIN = 0x00030040, LENGTH = 0x0005FFC0
- SRAM (rwx) : ORIGIN = 0x20002000, LENGTH = 62K
+ SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 62K
}
/*
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/examples-features/libtock_test.rs b/examples-features/libtock_test.rs
index 5fe9e59..9a64e67 100644
--- a/examples-features/libtock_test.rs
+++ b/examples-features/libtock_test.rs
@@ -1,5 +1,6 @@
// Libtock regression tests to be used with real hardware.
-// Requires P0.03 and P0.04 to be connected (on a nRF52 DK).
+// Requires P0.03 and P0.04 to be connected (on a nRF52 DK) and
+// P0.01 and P0.03 to be connected (on a nRF52840dk).
#![no_std]
extern crate alloc;
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