Write custom flash programming function for TMS320F2812?

Hello all

I want to be able to write custom C-code for an TMS320F2812 DSP that enables me to flash program the DSP through several different ports (SCI-A, SCI-B, CAN-A, and maybe other ports to).

I have an idea how I would want it to work. Let's say that flash sector A holds this re-flashing code. And the other sectors hold the application code.

The program in sector A scans all incoming data on the different ports, and when it recognizes a specific sequence in one of them it jumps to a flash programming function.

Have any of you done something similar?

How do I manage the two different programs (the flash programming function and the application), should I use two projects. And how do I use them together?

Reply to
Bill
Loading thread data ...

1) Load and execute a small application in the RAM whose responsibility will be to identify if it is either the Application or the Flash Programming application and load it in RAM. By this technique, you can make the application to get copied to the RAM from the correspoding sector in Flash Memory and you can also make the Flash programming function to get copied to the RAM and execute from there. Care should be taken for avoiding the overlap of Memory of these 2 different programs in the RAM . (This can be done by changing the Linker Scripts / Linker Command FIle(LCF) ).

By placing both these programs in RAM in different locations within RAM memory , it is possible to use them together.

2) You can also try XIP (Execute in Place) functionality for the application whose responsibility will be identify if it is either a Flash Programming Function or Application . But, here the application should be in the Flash Memory itself.

Karthik Balaguru

Reply to
karthikbalaguru

enables

You just want to be able or you want the actual code?

Good.

Why not.

and

So?

I developed the flashloader for 28xx, as well as for many other MCUs.

  1. At reset, the control is given to the flashloader part.
  2. The flashloader verifies if the application part is valid.
  3. If the application part is valid, then the control is given to the application.
  4. If the application is not valid, we stay in the flashloader.
  5. Application can unvoke the flash programming part at any time.

Vladimir Vassilevsky DSP and Mixed Signal Consultant

formatting link

Reply to
Vladimir Vassilevsky

On Tue, 13 Nov 2007 09:43:38 +0100, "Bill" wrote in comp.arch.embedded:

You can download the flash programming API from TI's web site. You write calls to this code according to the documentation and link the provided library into the code.

You can't execute code from the flash while you are erasing or programming any part of the flash. You need to copy your programming code into internal RAM to run it.

Start on this web page:

formatting link

...from there you can find links to application notes and sample source code.

Yes, of course. We have boards where we use the 2812. We split the flash into two parts, a small part for boot code (we call it a BIOS), and a larger part for the application.

The BIOS performs power on self tests, and can communicate with higher level controllers in the system, via CAN which we use in our system. The BIOS will accept a new image for programming into the DSP flash, or a different image for programming into other programmable devices on the board.

In our case, we have 128K x 16 bit external RAM on the board, the same size as the flash, so it can receive the entire new flash image and verify its checksum before running code from internal RAM to erase and reprogram the flash. By having the entire new image in on-board external RAM, it significantly reduces the amount of time where a loss of power could leave the flash in an unusable condition.

Once the BIOS self tests determine that everything on the board is functioning properly and there is a good image in the application part of the flash, it jumps to a predefined address in that image. If any of the self tests fail, or if a push button on the board is held during reset, it remains in the BIOS code.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Reply to
Jack Klein

Flash Memory is organised into many blocks/sectors. So, Why is not possible to execute(XIP) in one part(block/sector) of the flash while other part(blocks/sectors) of flash memory is getting erased/ programmed ? Any specific reason w.r.t Flash Memory design ?

Thx in advans, Karthik Balaguru

Reply to
karthikbalaguru

TI 28xx flash API is crap. It is the brain dead blocking code with disabled interrupts which relies on the delays generated by the dummy loops in the software. It is not very difficult and much more flexible to access the flash programming registers at low level by your own program.

The flash programming (erasing, to be more specific) is so slow on 28xx... I wonder why.

Since it is not safe to reflash the flashloader itself, I usually try to keep the functionality of the flashloader at minimum. Just the communication part and the integrity check of the application code. To avoid the accidental corruption of the flash, the actual flash programming code is

*not* included into the flashloader, but loaded into RAM from the outside.

Vladimir Vassilevsky DSP and Mixed Signal Consultant

formatting link

Reply to
Vladimir Vassilevsky

What if the downloaded code to the DSP flash is fubar and it locks the DSP? Then the custom code can't run?

The only safe way I think is to have a second microcontroller that programs the DSP.

Reply to
Bill

  1. The flashloader checks the CRC of the application code before starting it.
  2. Even if the application code is valid, the flashloader retains the control for some short time. So the application can be reflashed if required.
  3. You can put a jumper on the board to force or to disable the flashloader.
  4. The actual flash programming code is neither the part of application nor the part of the flashloader. This code is loaded from the outside only at the time of the flash programming. This prevents the accidental corruption of the flash because of a glitch, a software bug, etc.

Who will guard the guards?

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

The guard is not erasable :-)

Reply to
Bill

But the guard can kill the master by an accident.

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.