To access the internal flash of STM32F042K6.

This library provides a Partition class used to segment the STM32F042K6 internal flash so that the caller can read/write/erase the partition.

Examples

    FlashPartition config(0x7c00, 0x400);

    uint8_t buf[16];
    config.Read(address, buf, sizeof(buf));

    config.EraseAll();
    config.Write(address, buf, sizeof(buf));

Files at this revision

API Documentation at this revision

Comitter:
yjlou
Date:
Mon Sep 11 05:09:15 2017 +0000
Parent:
0:a71e3b72379a
Commit message:
Remove debug message.

Changed in this revision

f042k6_flash.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r a71e3b72379a -r 7a490a05943a f042k6_flash.cpp
--- a/f042k6_flash.cpp	Tue Aug 29 02:36:52 2017 +0000
+++ b/f042k6_flash.cpp	Mon Sep 11 05:09:15 2017 +0000
@@ -55,7 +55,6 @@
 
 void FlashPartition::UnlockControlRegister() {
     if (*REG32(FLASH_CR) & CR_LOCK) {
-        printf("Unlocking control register\r\n");
         *REG32(FLASH_KEYR) = 0x45670123;
         *REG32(FLASH_KEYR) = 0xCDEF89AB;
     }