Hello, Program which can earse the entire on-chip flash must run from internal RAM. In my project design, the erase code resides in a known location of Flash. At certain point of execution I need to transfer that block of code to internal RAM, so that the erase procedure can carry on. Will anyone please help me in writing the code / give me some information as how to go ahead with this. Thanks and regards Rashmi
Take a look at the following application note: http://www.keil.com/appnotes/docs/apnt_138.asp Jon
Hi Jon, Thanks a lot for the help. I have a small doubt yet. The application note that you have referred says, // copy flash program code to execution address hmemcpy (SROM_PS_TRG(PFLASH), SROM_PS_SRC(PFLASH), SROM_PS_LEN(PFLASH)); I just want to clarify, if "hmemcpy" and "memcpy" can be used to copy data from Flash to RAM. If yes, what is the time overload? Does it take the same time as on when memcpy is called to tranfer data from RAM to RAM? Can you provide me with some kind of time estimation? Thanks in advance Regards Rashmi
To transfer 1 byte, it'll take the amount of time to READ the byte from the FLASH and WRITE it to the RAM. You can check the data sheet to find this information out. Jon
If I remember right, IRAM has the worst opcode fetch times of all memory, by far. Internal xram is similar to external ram (16-bit bus with 0 wait states) and internal flash is by far the fastest since it has no wait states and fetches are done 32-bits at a time. You should be able to find the actual timings in the data sheets. Best Scott
Hi Scott, I don't think that 'by far' is the right expression. IRAM and XRAM use 16-bit demultiplexed access without extra delays, which is FAST. On-chip flash can use 32-bit reads for instruction fetches, so 4-byte instructions are fetched in 1 read cycle. That's the only difference timewise. Because of this, typical code execution from on-chip flash ROM is about 20% faster than from IRAM or XRAM, according to 'The Insider's Guide To Planning 166 Family Designs' from Hitex. Regards, - mike
Mike, IRAM is fast for operand storage but is much slower for op-code fetches (maybe an artifact of the '51 archecture). I can't find the documentation which had a concise table of timing based on memory location (either from Infineon or ST). However, the ST-10 programming manual lists the timing of op-codes based on flash/iram and external ram with various bus configurations. Example:
Instructuion - ADDC Rb, Rb Memory Cycles Int Flash 2 Int RAM 6 Ext Mem*- 16-bit non-mux 2 Ext Mem*- 16-bit mux 3 Ext Mem*- 8-bit non-mux 4 Ext Mem*- 8-bit mux 6 *Assumes no wait states.
Thanks Scott, Now I understand I was wrong. For some reason I assumed that since IRAM is accessed via 16-bit bus, it must be fast. - mike
Hi Rashmi, What Flash RAM IC are you using? I have some sample code for the Flash RAM AMD 29F040B. The program copies itself to RAM, then goes and erase/write to the AMD Flash. If you want this code, I need your e-mail address. I never did use the code so will not be able to support you on it. Phong
Hi Phong, Thanks for your helping hands. I am using M29F200B from ST. You can send me the code. At least it will give me some info to carry on. My e-mail ID is "rashmi_topno@satyam.com". Thanks once again Rashmi
Hi Phong, I will implement this function for my project.Could you send me the sample code for me reference? Thank you! my email address: derek@trident.com.tw Best regards, Derek
Hi Phong, I need program AM29f040. Could you send me the sample code for me reference? Thank you! my email address: shzhj@sohu.com
hi i have read ur request.well i m also interested on that topic.but still i have no remides for this .well when i find any material related to ur topic then i will be..... bye jai
Hi Phong, I am using ST10F280 with internal flash. I need to copy the flash routines to RAM and erase and program the flash. Request you send me the code. Thanks & bet regards, rajendra.
Need your e-mail address.