AnsweredAssumed Answered

FlashX file names -- what do they mean?

Question asked by Michael Schwager on Oct 28, 2014
Latest reply on Oct 30, 2014 by Michael Schwager

I'm using MQX 4.1.2 or whatever the version is with the FlashX examples on K60 with 512kB Flash size

I can get the FlashX swap example working, but I don't fully understand the three filenames used in the fopen(...) calls:

flashx:code

flashx:swap0

flashx:swap1

 

Clearly these refer to the two different flash banks.

1. Does flashx:code always refer to the "current" bank, whether it's 0 or 1?  Or does it refer to the "other" bank? 

2. Does flashx:swap0 always refer to absolute bank 0?

3. Does flashx:swap1 always refer to absolute bank 1?

4. The example always seems to clone from flashx:swap1 to flashx:code, and then call FLASH_IOCTL_SWAP_FLASH_AND_RESET on flashx:swap0, so I'm not sure how it's swapping.  I'm guessing the meaning of the above filenames changes depending on which bank you're swapped into, but then I'm not sure why you'd need three; two would suffice.  Not enough documentation in MQXIOUG.pdf.

5. I have 512kB Flash size, but the function that checks available size (fseek to IO_SEEK_END) returns some value other than 262144 bytes, which would be exactly one bank (from 0x0000_0000 to 0x0003_ffff, or 0004_0000 to 0007_ffff).  The number is close (about 260,000) but not exactly.  Why the differences?

6. How does the function that checks current image size (fseek to IO_SEEK_END) know where to stop?  It currently returns one byte short of the .bin file size I'm using to load the Flash.

7. How do I check which bank I'm currently executing out of?

8. Does MQX provide any sort of CRC function?  I plan to use IAR linker's ability to add CRC to image.

9. The example upon first executing finds in the Flash memory some "bank swap" or similar text to put in the swapmark structure.  Is my IAR linker adding this?  I'm not sure where it comes from.


thanks

Outcomes