-deleted-
9 years, 7 months ago.

FRDM-K64 flash_size() mismatch

Hello Erik. I noticed that when I print out flash_size() on a FRDM-K64 I get a value of 70401. Is this normal when considering the 1MB FLASH spec?

Question relating to:

IAP code for Freescale platforms

If I run it with latest FreescaleIAP and latest mbed in default program I get:

Flash size = 1048576

Which is 1MB.

posted by Erik - 01 Apr 2015

Lol, figured out your problem :D. With your code it also didn't work properly. First something: If sprintf is inlined by compiler it will work properly, but I don't know if this is the case. Otherwise within bootloader it won't work.

But your problem is that you are printing flash_size, not flashSize! So you are printing the address of the flash_size() function.

posted by Erik - 01 Apr 2015

Awesome, good catch. Thank you.

posted by -deleted- 01 Apr 2015

1 Answer

9 years, 7 months ago.

Thats really a weird value. I never had access to the K64F when writing that code, and it has two flash banks instead of the one of the KL25. Will have a look at it later what is causing it.

In the meantime it isn't a very critical value, you can just hardcode it to the 1MB. By the way, is that hex or decimal?

Accepted Answer

Perhaps I made a silly mistake. I was testing with the Bootloader_K64F library, and posted a new question which may be related: http://developer.mbed.org/questions/6897/How-to-use-more-than-64Kb-flash-memory-f/ ?

I used the following code inside the bootloader function:

Bootloader_K64F

    int flashSize = flash_size(); // - SECTOR_SIZE;  
    char buf[100];
    //int c = 3;
    sprintf(buf, "%d", flash_size);
    
    write("\n\rFlash Size: ");
    write(buf);
    write("\n\r");

posted by -deleted- 31 Mar 2015