Hello, everyone!
On the K60F120 Tower, I loaded and ran the flashx example. It is working fine.
However, the example uses only the last 32 Bytes of flash.
It moves to the location with an fseek command.
When I run the example in RAM under control of the IDE, I think that I can reprogram the whole flash area without harm. Is this right?
By single-stepping, I saw that the write access is broken down to sectors by the driver, so it seems that I do not have to care about that.
To do something more useful, I modified the example and tried to write a recognizable pattern and see if I can read it back.
I know that you have to erase the flash before programming ist, but as the example does not do that I assume that the flashx driver takes care of it.
I left all instructions for cache and unprotecting in place.
It seems that I can access only the last 2K of flash which is definitely not enough.
Furthermore, I was able to write my pattern once, but when I changed the pattern and re-wrote the flash, I still get the old pattern so it seems to have been written only once.
What rules apply for accessing the flash with flashx?
Regards, Martin
Solved! Go to Solution.
Hello martinpi,
This topic might answer your question:
Regards,
MartinK
Rule 1
Use MQX 4.0 or later.
Rule 2
Don't overlap your application flash image (instructions, read only data, initialized data) with the internal flash sectors that the same application erases/programs.
With this in mind, you can customize the flashx initialization data structures
(FLASHX_FILE_BLOCK, FLASHX_INIT_STRUCT in
c:\Freescale\Freescale_MQX_4_0\mqx\source\bsp\twrk60f120m\init_flashx.c
or even FLASHX_BLOCK_INFO_STRUCT
c:\Freescale\Freescale_MQX_4_0\mqx\source\io\flashx\freescale\flash_ftfe.c)
to meet your application needs. The flashx chapter in MQX I/O User's Guide is worth reading.
Hi,
I found out something new!
I gave up on the flashx driver and programmed the write sequence "by hand", writing directly to the FTFE registers.
I had pretty much the same effects, i.e. I saw the data written to the flash in the memory browser, but when I powered the K60 tower down and up again, and restarted the debugger, the data was gone.
Until I tried, for some reason, to run my program without debugger and, voila, the data was still there after power down and up.
Apart from the knowledge, not to try writing to flash while debugging, there is the question why is that so and is there a way to overcome it?
Regards, Martin
Thank you, this seems to do the trick.
In the advanced programming options, I set the flash region which I want to preserve.
On the downside, it makes starting the debugger extremely slow.
I mean, it is always slow, but now I am waiting for the debugger to start,
it still says "Download using 3rd party component.
...
Okay, it is done, it took 12 minutes and I missed my train.
And this is not limited to debugging, when I click on Run instead of Debug, it takes very long time again.