[riot-notifications] [RIOT-OS/RIOT] cpu/stm32l1: fix issue when writing NULL bytes to eeprom (#11314)

Alexandre Abadie notifications at github.com
Thu Jul 4 12:19:35 CEST 2019


aabadie approved this pull request.

Tested on im880b and confirm this PR is fixing an issue on it.

I have other comments and will do further testing after lunch!

> +
+static void _write_word(uint32_t addr, uint32_t data)
+{
+    assert(addr <= EEPROM_SIZE + EEPROM_START_ADDR);
+
+    /* Wait for last operation to be completed */
+    _wait_for_pending_operations();
+
+    *(__IO uint32_t *)addr = data;
+}
+#endif
+
+static void _write_byte(uint32_t addr, uint8_t data)
+{
+    /* Check the parameters */
+    assert(addr <= EEPROM_SIZE + EEPROM_START_ADDR);

This seems unrelated and means the assert is checked for each byte written. I would drop this.

> @@ -45,7 +101,7 @@ size_t eeprom_read(uint32_t pos, uint8_t *data, size_t len)
     DEBUG("Reading data from EEPROM at pos %" PRIu32 ": ", pos);
     for (size_t i = 0; i < len; i++) {
         _wait_for_pending_operations();
-        *p++ = *(uint8_t *)(EEPROM_START_ADDR + pos++);
+        *p++ = *(__IO uint8_t *)(EEPROM_START_ADDR + pos++);

This should go in its own commit as it's a bit unrelated. It also requires test on other supported families...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11314#pullrequestreview-257958778
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190704/8605ad91/attachment.html>


More information about the notifications mailing list