registry flash read/ write
Dependencies: FreescaleIAP mbed
Fork of testregistr by
Diff: main.cpp
- Revision:
- 2:f20b253b3a0c
- Parent:
- 1:7db8a959df19
- Child:
- 3:ad384b346c28
--- a/main.cpp Sun May 31 15:35:22 2015 +0000 +++ b/main.cpp Sun Jun 07 07:47:39 2015 +0000 @@ -9,24 +9,29 @@ // pc.printf("value at 3fc00 is %d\r\n",*adress); // pc.printf("value at 3fc00 is %d\r\n",SECTOR_SIZE); - int address = flash_size() - (236*SECTOR_SIZE); //Write in last sector(simply use 256-xkb of file) + int address = flash_size() - (SECTOR_SIZE); //Write in last sector(simply use 256-xkb of file) pc.printf("Starting %x \r\n",address); int *data = (int*)address; pc.printf("Starting\r\n"); - //erase_sector(address);//cant erase the program - //int numbers[10] = {0, 1, 10, 100, 1000, 10000, 1000000, 10000000, 100000000, 1000000000}; - // int i; + erase_sector(address);//cant erase the program + int numbers = 56; + int i; // for(i=0;i<2560;i++){ //numbers[i]=((3*i)+1);} - //program_flash(address, (char*)&numbers, 10240); //10 integers of 4 bytes each: 40 bytes length + Timer t; + t.start(); + program_flash(address, (char*)&numbers, 4); //10 integers of 4 bytes each: 40 bytes length + //printf("heloooooooooooooooooooooooo"); + t.stop(); pc.printf("Resulting flash: \r\n"); - for (int i = 0; i<241664; i++) - printf("%d,%d\r\n",i, data[i]);//will get stuck at one point - - pc.printf("Done\r\n\n"); + for (i =0 ; i<240; i++) + printf("%d,%d\r\n",i, data[i]); + + pc.printf("Done %f\r\n\n",t.read()); pc.printf("value at %x\r\n",address); + t.reset(); //while (true) {