We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi All,
I am trying to get my In-Application Programming up and running on an ST micro uPSD33xx. When activating the newly programmed image I need to switch execution from the boot flash to the main flash. When this happens the micro will just blindy contiune retrieving instructions from the next memory location as if nothing has happened, unaware of the switch in flash device.
For everything to not fall in a big heap I am planning to have a routine which is fixed at the same absolute in both applications - it is this routine which will handle the switching of memory banks (and so the instuctions being retreieved should be identical in both apps).
First of all, does that sound insane to anyone out there?
Secondly, and prehaps a daft question, how should I determine *where* to locate the absolute routine. What guidelines can you offer as to how one determines where to locate such a 'shared' routine?
Cheers for any help/recommendations.
Andy
Andy,
It sounds somewhat like you've been reading my long-winded discussions at ST's message board. If not, you can take a look here:
www.stmcu.com/forums-cat-2229-11.html&start=0
Assuming you've done that and that's why you're looking here, I can tell you this: All I did to figure out where to place my swapover routine was look in the memory map and find a place where it fit. I've thought about it some since then, however, and forcing it to exist right past the end of the interrupt vectors seems like a more reasonable thing, given that I've integrated it with the startup code.
Hi Jay,
I am assuming you are AKA 'phaze246'.
That posting on the ST website will probably have helped one hek of a lot of people (including me!) - nice one!
So I guess you are saying that you place the routine after the interrupt vectors in the startup code and then simply use the same startup code in both apps, yes?
Cheers
PS - Are there any other resources on IAP for the ST uPSD that you can point me to?
Yeah, that's me. :) Glad to hear it helped a bit. I do, in fact, use the same startup code in both apps. It's certainly possible to do things in other ways, but since I have to decide at startup whether to run the "bootloader" or the "main app" based on a number of factors, it seemed to make sense to put it there. In actuality, the only place the instructions really have to match up is exactly at the point where you change the VM register to switch flash areas. After that point, the code could be different. I just kept mine the same for simplicity.
As far as other resources, ST has made some sample code in the form of both firmware for the chip and a windows app to send over hex files. I find that to adapt it for use in your application, however, you pretty much already have to understand everything they're doing. You can find it here:
" section.
How's it going?
Just a quickie regarding the memory map and Keil v PSDSoft settings for the memory map you have described (on the other forum).
I want to have access to main flash (to erase and reporgram, etc) from the bootloader in secondary flash. The bootloader application obviously needs to be loaded into CSBOOOT0, 1,2 3 with nothing being loaded into primary flash as this is for the main application. However the bootloader app must be able to 'see' primary flash to be able to erase/reprogram.
To acheive this is it necessary to enable code banking in the Keil toolchain or does the memory map specified in PSDSoft express take care of this? As I am not loading any code into memory banks I do not see why it is necessary to enable code banking, but this means that the PSDSoft express memory map must be sufficient for the MCU to be able to access the full memory map as described. So if I try to erase a sector of flash, say FS5, from the bootloader and code banking is OFF will the app successfuly access the relevant addresses based on the PSDSoft express alone?
Do you see what I mean?
Cheers for any help Jay and have a great weekend!
Yes, I understand what you're saying. I don't use code banking at all in my application. I use two separate projects: One for the bootloader that goes into CSBOOT and one for the main application.
As long as the memory map is configured in PSDSoft such that you can EXECUTE out of CSBOOT and WRITE to MAIN flash, then you should be able to get the job done. The only difficulty is that your bootloader code will need to change the page register itself. For instance, if you are trying to program code into bank 5 which is on page 5, then the bootloader will need to change to that page to get it done. Hope that makes it clearer.
-Jay Daniel
hi, i'm sorry, my post is unconcerned with IAP, i want to ask a question when i found somebody who is interested in upsd. in this page mcu.st.com/.../modules.php one of the user mention about upsd_uart.c file, but i cant find this file in st site, do you know where is this file? can you give me a link?
Hank,
No, I don't know of this file. It sounds from the OP like it was part of some example code for one of their dev. kits. Handling the UART in the uPSD is nearly identical to what one would do in a standard 8051, however, and is therefore fairly straightforward to implement.
-Jay D.