summaryrefslogtreecommitdiff
path: root/bl1
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2016-11-14 14:58:05 +0000
committerDan Handley <dan.handley@arm.com>2016-12-20 11:43:10 +0000
commit1bfb706851c8606aede8f9f391afde1e5339fbf3 (patch)
tree74d6efca3f5adb080eea5067ffe8180464e82da9 /bl1
parentb38a9e5cd765fa1c7e99f20a8236c3594f2f0562 (diff)
Add some debug assertions in BL1 FWU copy code
These debug assertions sanity check the state of the internal FWU state machine data when resuming an incomplete image copy operation. Change-Id: I38a125b0073658c3e2b4b1bdc623ec221741f43e Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Diffstat (limited to 'bl1')
-rw-r--r--bl1/bl1_fwu.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/bl1/bl1_fwu.c b/bl1/bl1_fwu.c
index 9bd1ba92..7ef184c1 100644
--- a/bl1/bl1_fwu.c
+++ b/bl1/bl1_fwu.c
@@ -158,7 +158,19 @@ static int bl1_fwu_image_copy(unsigned int image_id,
}
if (image_desc->state == IMAGE_STATE_COPYING) {
+ /*
+ * There must have been at least 1 copy operation for this image
+ * previously.
+ */
+ assert(image_desc->copied_size != 0);
+ /*
+ * The image size must have been recorded in the 1st copy
+ * operation.
+ */
image_size = image_desc->image_info.image_size;
+ assert(image_size != 0);
+ assert(image_desc->copied_size < image_size);
+
INFO("BL1-FWU: Continuing image copy in blocks\n");
} else { /* image_desc->state == IMAGE_STATE_RESET */
INFO("BL1-FWU: Initial call to copy an image\n");