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.
I have an application that boots up from Flash, and then downloads an application into RAM. The RAM program is downloaded from the .h86 file and then executed by a far jump. Most all of the downloaded RAM code runs fine, but a few of the functions behave oddly. Are there any system initialization operations that should be performed before jumping into the RAM code?
Are there any system initialization operations that should be performed before jumping into the RAM code? Yes, there are, but not many. The microcontroller's external bus interface must be set up already since the code in RAM runs. First of all, if the application in RAM uses interrupts, you have to properly set up the interrupt vector table. Secondly, code generated by the C166 compiler assumes that the system stack and the user stack are set up. Thirdly, for near data access, the DPPx registers have to hold the right values. Stacks and DPPs (as well as other things like global variable initialisation) are taken care of by the code in START167.A66. You have to take care ot the interrupt vector table yourself. If you jump directly to main in your code in RAM, you bypass the initialisation code in START167.A66. The initialisation code of the boot program in flash can be good enough for the code in RAM to run properly, but not necessarily. Needless to say that the application to be run in RAM has to be built for the address range it is going to run in. Normally it cannot be shifted in memory and be expected to run properly. - mike
Hi, we do have exactly the same architecture and no problems. We start from internal flash at segment 0xc0. In the downloaded application we do have a second startup.a66. That's how we realized the jump:
#define JUMP(ptr) ((void (far*)(void)) ptr)() PSW_IEN = 0; //disable int's VECSEG &= 0xFF00; //set isr-segment to 0 JUMP(0x0000); //jmp to application