Replace flash partitioning terminology

This change replaces the slot 0/1 terminology with primary/secondary
slot and replaces FLASH_AREA_IMAGE_0/1 with
FLASH_AREA_IMAGE_PRIMARY/SECONDARY. This naming convention may be more
understandable, fits better to MCUs with multiple images and it is an
architecture agnostic alternative as well.

Change-Id: I655a585f6ae023852c671ee6635399efe25209c9
Signed-off-by: David Vincze <david.vincze@arm.com>
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/mcuboot-sys/Cargo.toml b/sim/mcuboot-sys/Cargo.toml
index 79a2663..37dba5e 100644
--- a/sim/mcuboot-sys/Cargo.toml
+++ b/sim/mcuboot-sys/Cargo.toml
@@ -21,16 +21,16 @@
 # Overwrite only upgrade
 overwrite-only = []
 
-# Disable validation of slot0
-validate-slot0 = []
+# Disable validation of the primary slot
+validate-primary-slot = []
 
-# Encrypt image in slot1 using RSA-OAEP-2048
+# Encrypt image in the secondary slot using RSA-OAEP-2048
 enc-rsa = []
 
-# Encrypt image in slot1 using AES-KW-128
+# Encrypt image in the secondary slot using AES-KW-128
 enc-kw = []
 
-# Allow bootstrapping an empty/invalid slot0 from a valid slot1
+# Allow bootstrapping an empty/invalid primary slot from a valid secondary slot
 bootstrap = []
 
 [build-dependencies]
diff --git a/sim/mcuboot-sys/build.rs b/sim/mcuboot-sys/build.rs
index 9e9ef36..088b470 100644
--- a/sim/mcuboot-sys/build.rs
+++ b/sim/mcuboot-sys/build.rs
@@ -12,7 +12,8 @@
     let sig_rsa = env::var("CARGO_FEATURE_SIG_RSA").is_ok();
     let sig_ecdsa = env::var("CARGO_FEATURE_SIG_ECDSA").is_ok();
     let overwrite_only = env::var("CARGO_FEATURE_OVERWRITE_ONLY").is_ok();
-    let validate_slot0 = env::var("CARGO_FEATURE_VALIDATE_SLOT0").is_ok();
+    let validate_primary_slot =
+                  env::var("CARGO_FEATURE_VALIDATE_PRIMARY_SLOT").is_ok();
     let enc_rsa = env::var("CARGO_FEATURE_ENC_RSA").is_ok();
     let enc_kw = env::var("CARGO_FEATURE_ENC_KW").is_ok();
     let bootstrap = env::var("CARGO_FEATURE_BOOTSTRAP").is_ok();
@@ -28,8 +29,8 @@
         conf.define("MCUBOOT_BOOTSTRAP", None);
     }
 
-    if validate_slot0 {
-        conf.define("MCUBOOT_VALIDATE_SLOT0", None);
+    if validate_primary_slot {
+        conf.define("MCUBOOT_VALIDATE_PRIMARY_SLOT", None);
     }
 
     // Currently, mbed TLS cannot build with both RSA and ECDSA.
diff --git a/sim/mcuboot-sys/src/area.rs b/sim/mcuboot-sys/src/area.rs
index 8666aa1..9b13098 100644
--- a/sim/mcuboot-sys/src/area.rs
+++ b/sim/mcuboot-sys/src/area.rs
@@ -27,7 +27,7 @@
 
     /// Add a slot to the image.  The slot must align with erasable units in the flash device.
     /// Panics if the description is not valid.  There are also bootloader assumptions that the
-    /// slots are SLOT0, SLOT1, and SCRATCH in that order.
+    /// slots are PRIMARY_SLOT, SECONDARY_SLOT, and SCRATCH in that order.
     pub fn add_image(&mut self, base: usize, len: usize, id: FlashId, dev_id: u8) {
         let nid = id as usize;
         let orig_base = base;
@@ -196,4 +196,3 @@
     off: u32,
     size: u32,
 }
-