From 50f2078fcda5b3ad13cb88c579570e5aec55a741 Mon Sep 17 00:00:00 2001
From: Federico Pellegrin <fede@evolware.org>
Date: Thu, 20 Dec 2018 21:18:52 +0100
Subject: [PATCH] tests/periph_flashpage: test_last_raw must erase page before
 write

---
 tests/periph_flashpage/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/periph_flashpage/main.c b/tests/periph_flashpage/main.c
index d517625c58..84f995d3fa 100644
--- a/tests/periph_flashpage/main.c
+++ b/tests/periph_flashpage/main.c
@@ -335,6 +335,9 @@ static int cmd_test_last_raw(int argc, char **argv)
     /* try to align */
     memcpy(raw_buf, "test12344321tset", 16);
 
+    /* erase the page first */
+    flashpage_write(((int)FLASHPAGE_NUMOF - 2), NULL);
+
     flashpage_write_raw((void*) ((int)CPU_FLASH_BASE + (int)FLASHPAGE_SIZE * ((int)FLASHPAGE_NUMOF - 2)), raw_buf, strlen(raw_buf));
 
     puts("wrote raw short buffer to last flash page");
-- 
GitLab