Rust env: Install rustc nightly-2021-03-03

Later versions use LLVM-12, for which we don't yet have a compatible
version of lld.

Note, since we don't generally control the commandline that the
developer uses to run cargo and we don't want to override the developers
default toolchain, we don't actually force 2021-03-03 to be used. So
this is somewhat more of a suggestion to the developer and provides a
point of communication as to what the suggested version is.

TESTED=Ran setup with and without toolchain installed.

Bug: b/183163408
Change-Id: Ie82c372b7feb1228ceed8d5b9ab8f0fc4a428517
Reviewed-on: https://chrome-internal-review.googlesource.com/c/hps-firmware/+/3696351
Reviewed-by: Edward O'Callaghan <quasisec@google.com>
Commit-Queue: Edward O'Callaghan <quasisec@google.com>
Commit-Queue: David Lattimore <dml@google.com>
Tested-by: David Lattimore <dml@google.com>
diff --git a/scripts/check-binary-sizes b/scripts/check-binary-sizes
index 219362b..26f3e4a 100755
--- a/scripts/check-binary-sizes
+++ b/scripts/check-binary-sizes
@@ -3,13 +3,17 @@
 # Builds code and prints binary sizes. For now, this only reports sizes of MCU
 # binaries as that is by far the most space-constrained.
 
-set -e
 PROJECT_ROOT=$(realpath $(dirname ${BASH_SOURCE[0]})/..)
+
+source $PROJECT_ROOT/environment
+
+set -e
 STAGE0="${PROJECT_ROOT}/mcu_rom/stage0/target/thumbv6m-none-eabi/release/stage0.bin"
 STAGE1="${PROJECT_ROOT}/mcu_rom/stage1/target/thumbv6m-none-eabi/release/stage1.bin"
+APPLICATION="${PROJECT_ROOT}/mcu_rom/application/target/thumbv6m-none-eabi/release/application.bin"
 (
     cd "${PROJECT_ROOT}/mcu_rom/stage0"
-    cargo build --release
+    cargo +$RUST_VERSION build --release
     arm-none-eabi-objcopy \
         -O binary \
         target/thumbv6m-none-eabi/release/stage0 \
@@ -17,14 +21,24 @@
 )
 (
     cd "${PROJECT_ROOT}/mcu_rom/stage1"
-    cargo build --release
+    cargo +$RUST_VERSION build --release
     arm-none-eabi-objcopy \
         -O binary \
         target/thumbv6m-none-eabi/release/stage1 \
         "$STAGE1"
 )
+(
+    cd "${PROJECT_ROOT}/mcu_rom/application"
+    cargo +$RUST_VERSION build --release
+    arm-none-eabi-objcopy \
+        -O binary \
+        target/thumbv6m-none-eabi/release/application \
+        "$APPLICATION"
+)
 echo
 STAGE0_SIZE=$(stat --printf='%s' "$STAGE0")
 STAGE1_SIZE=$(stat --printf='%s' "$STAGE1")
+APPLICATION_SIZE=$(stat --printf='%s' "$APPLICATION")
 echo "Stage0: ${STAGE0_SIZE} bytes"
 echo "Stage1: ${STAGE1_SIZE} bytes"
+echo "Application: ${APPLICATION_SIZE} bytes"