cancel
Showing results for 
Search instead for 
Did you mean: 

Reset / IAP

jdaniel
Associate II
Posted on January 28, 2004 at 15:58

Reset / IAP

5 REPLIES 5
jdaniel
Associate II
Posted on May 17, 2011 at 11:58

I have a question regarding in-application-programming and the reset of the processor. Following the guidelines in the IAP.doc document that was distributed on this board, I have designed a bootloader that runs out of secondary flash memory. Additionally, I have 2 separate application images in primary flash that have bits programmed to indicate whether one is valid or not. On reset, my boot loader examines the images and if it finds a valid one, it attempts to swap pages and run it.

What I would like to do is simply change pages and then loop until the watchdog resets the processor and have the processor start up executing the new page as though the bootloader was never running. For instance:

psd_regs.VM |= VM_REG_PSEN_MAIN_FLASH;

psd_regs.page = APP1_PAGE;

psd_regs.VM &= ~VM_REG_PSEN_BOOT_FLASH;

while(1); // wait for reset

I have Keil's BL51 locating the same swap routine to the same memory location in both the boot and primary flash areas.

Is this the way the page register functions? Is there some other way I should start the application code? I'm a bit confused and the document is a bit vague on these details.

Best Regards,

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

Please see the attached document on how sector swap works during Reset.

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

Oops, the document didn't get attached with the last one.

jdaniel
Associate II
Posted on May 17, 2011 at 11:58

Moderator,

Thanks for the help with that. I've gotten a bit further. I specified for both the boot-loader program and the main application image that the linker locate the reset code at the same address. Also, I've figured out (despite my assembler-phobia) how to modify the startup code to change the VM register and page values. I have one more question, however.

Can I depend on the internal uPSD SRAM having any known values at power-up? For instance, what I would like to do is have the startup code run the bootloader. If the bootloader finds a valid application image, it will store a new VM and page value in SRAM and then reset. The startup code will then load this value into the registers and run the specified image.

The question is how do I check whether these values have been set by the bootloader, or if the device has just been powered on? Will the SRAM power-up as all 0x00's or all 0xFF's, or just be competely random? I think this is the last hurdle in my design. Thanks.

Best Regards,

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

uPSD's internal SRAM are volatile and at power up, the values are completely random. However, you do have the option to use a battery to back-up the SRAM content when your target power goes down. You can also design a battery recharge circuitry to charge your battery when your target is powered.