I need to store a data in to Flash, also I need change (rewrite) the data while application is running and store it again. How can I on-fly programm external FLASH? Pease, advise me.
You will need to read the datasheets and other documentation for your FLASH Chip(s) - that will tell you the programming algorithm. Your Vendor might have drivers and/or sample code, app notes, etc. Note that (most) FLASH chips require a whole sector to be programmed at once.
Assuming you are using an AMD-compatible flash, you have to keep in mind that execution of code from the flash whilst programmming is not possible. So you have to keep your programming code in external ram or in internal cpu ram. If you are using this for reloading firmware, you may simply restart your whole system after programming. If you want to store data you have to make sure that the erase operation prior to the program operation does not erase parts of your firmware. The data must reside in different sectors in this case. Flash drivers in 'C' are avaliable on the flash manufacturer's websites. HHK
Leon, There is an app note on this very subject in the Keil C-166 app notes. It is APNT_138. I used this info to set up programming for a ATMEL AT49F002N and it worked after a little tweaking. Good luck Eric
Have you seen application note apnt_138 and if so, did you find it helpful? Actually, I am disappointed that the file pflash.a66 is in assembly language. Why can't there be a pflash.c?
So how much "little tweaking" did you do? Does anyone know how to tweak this example to work on their 8051 tools?
Can you explain 'tweaking', please? (1) is there an issue with reg167.h? (2) did you need to change the uv2? (3) did the flash.uv2 build for you? The compiler complains about three registers in reg167.h: DP8, etc. Moreover, reg167.h in the "File download area" has an earlier date than in the version 4.20 toolset. Thanks, Doug Hewett