Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: 18_PT1000 RDA5807M-FM-Radio flashaccess TF_conops_BAEFLAGIMAN ... more
You are viewing an older revision! See the latest version
Homepage
Be careful with which flash you are erasing/overwriting!
Example code:
#include "mbed.h"
#include "FreescaleIAP.h"
int main() {
int address = flash_size() - SECTOR_SIZE; //Write in last sector
int *data = (int*)address;
printf("Starting\r\n");
erase_sector(address);
int numbers[10] = {0, 1, 10, 100, 1000, 10000, 1000000, 10000000, 100000000, 1000000000};
program_flash(address, (char*)&numbers, 40); //10 integers of 4 bytes each: 40 bytes length
printf("Resulting flash: \r\n");
for (int i = 0; i<10; i++)
printf("%d\r\n", data[i]);
printf("Done\r\n\n");
while (true) {
}
}
For an example on using this for a bootloader, check out: http://developer.mbed.org/users/Sissors/code/Bootloader_K64F/