cancel
Showing results for 
Search instead for 
Did you mean: 

Programming uPSD using IAP

partymarty6969
Associate II
Posted on February 22, 2005 at 10:14

Programming uPSD using IAP

3 REPLIES 3
partymarty6969
Associate II
Posted on May 17, 2011 at 12:05

I have a question,

Is it feasible to run a program after the VM Register has been changed using IAP (ex. secondary flash goes from data memory to code memory which now contains the new running program)? Is there any way to keep the VM register changes (after IAP has changed it) so that if the system is reset, it doesn’t return to the original VM Register settings set forth by PSDSoft (I know it says you can’t in the data sheets but I’m going to ask just in case there actually is a way)? The reason I ask is because I’m wondering if I can do the following;

At power-up up:

Main Flash: Code memory

Secondary Flash: Data memory

After IAP and switching of VM Register:

Main Flash: Code memory

Secondary Flash: Code memory

(Secondary flash has priority)

Base version of the program and the programming algorithm will be in the main flash, when applicable the programming algorithm is called and will erase then write new program to the secondary flash, the VM Register switches, and the new program runs from the secondary flash. This will allow me to have a back up of the program in the main flash in case the system is left pending during IAP (a sort of rollback so that system can still run). Basically I want to be able to write the new program to the system while keeping the original program just in case of a failure during IAP and not have to use the JTAG interface (one point of this project is not to use the JTAG).

Thank you for your help,

partymarty6969
Associate II
Posted on May 17, 2011 at 12:05

Well I have to be able to update more then once. So while I'm running from the updated program in the secondary flash memory, if an update is required, a message will trigger a routine which will change the VM Register again and load the programming algorithm in the primary memory. The programming algorithm will run and update the secondary flash memory. After this has completed, the VM register will change and the updated program will run again from the secondary flash.

In your example, is this what you mean;

Power Up:

Secondary Flash = Code memory

Program boots from secondary flash.

if main app is okay, VM Reg switch;

Primary Flash = Code memory

and you run the main app from the main flash

else, run IAP which updates Main flash, VM Reg switches;

Primary Flash = Code memory

and you run the main app from the main flash.

Now if while running the main app. you want to update, you switch the VM Reg back and allow IAP to run from the secondary flash.

So you are running your main program after a switch to the VM Register has happened (hence not the original settings set forth by PSDSoft). So if a reset occurs, the secondary flash boots up, checks the validity of the main app. and performs as stated above, right?

partymarty6969
Associate II
Posted on May 17, 2011 at 12:05

Thanks a lot Hans, your help has been very much appreciated.

I have another question though before I start coding (want to make sure I completely understand the capabilities of IAP memory mapping).

In the following memory mapping scheme (taken from an example listed in the forum);

At power-up:

Page 0

csboot0 - csboot3: Code memory (0x0000 - 0x7FFF)

fs0: Data memory (0x8000 - 0xFFFF)

After IAP and switching of VM Register and Page register:

Page 1

fs0: Code memory (0x0000 - 0x7FFF)

The secondary flash (csboot) which contains the programming algorithm, will write the updated program to fs0 at addresses 0x8000 to 0xFFFF. After this is complete, the page register and VM register will be changed and fs0 (contains updated program) will now run from 0x0000 - 0x7FFF.

My question is can you actually take fs0 from data memory at address 0x8000 - 0xFFFF, update it, and then put it in the code memory at address 0x0000 - 0x7FFF? What allows this change in address memory (switch from 0x8000 - 0xFFFF to 0x0000 - 0x7FFF)? Is it because of the paging that this operation can be done? For example is there anyway to do this without paging?

Thanks again for your help,

MartyQ