cancel
Showing results for 
Search instead for 
Did you mean: 

Field upgrades problem

guyl
Associate II
Posted on May 15, 2003 at 20:31

Field upgrades problem

4 REPLIES 4
guyl
Associate II
Posted on May 17, 2011 at 11:54

Thanks for the reply, but the ''volatile'' refer to variables or ''code constant'', what about adding a new functions (or removing) to the Main application? I know it changes the common.

Do you have a technique for putting a new common in the secondary flash after the IAP process?
guyl
Associate II
Posted on May 17, 2011 at 11:54

We managed to write an application (pc and uPSD) that fully loads HEX files into the flash and run the application.

The application in the uPSD consists of two parts:

1. In the secondary flash: constant loader application that loads once into the uPSD using JTAG.

2. Primary Flash: Application that can be loaded when needed by the loader in the secondary flash.

The two application have a joined common (interrupts, etc.) routines that never changes.

The problem starts when recompiling the application after doing some changes in the main application (like adding functions), apparently the constants part in the common does not stay the same. Since the common is located in the secondary flash (that can't be changed) the application does not work.

Does anyone have a solution to that problem?
joseph2399
Associate II
Posted on May 17, 2011 at 11:54

The constants in the common, should be declared as type ''volatile'' in your header file so that they will not get optimized away by the compiler.

joseph2399
Associate II
Posted on May 17, 2011 at 11:54

Sorry, I think I misunderstood your question. I do not think you can just add some new code to the existing copy of code. You need to have two copies of code. Only the special swapping routine at the beginning of each copy must be the same; this is necessary since the MCU doesn't know anything about the memory swap, it just keeps on generating addresses and the memory provides the instructions. After the instruction that writes to the PAGE register, the MCU generates the next sequential address. The code fetch from this next address in memory 2 must be the same as if it were occurring from memory 1. This results in the microcontroller executing seamlessly without knowledge of the swap. Only the swapping routine needs to be the same for both copies of code, the rest of the new code can be completly different from the one that you want to replace. We have a document that discribes the theory of operation for IAP, please see the attached. Also you may want to take a look at the DK900 User's manual from our website at: //www.st.com/stonline/books/pdf/docs/7888.pdf

It has many graphical illustrations on how IAP and memory swapping works.