This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Relocating Interrupt vectors without changing STARTUP.A51?

Hi,
I have built a boot loader which chooses the recent between 2 versions of the program burnt on the flash.
The only problem is that I need 2 copies of the interrupt and reset vectors...one for each image...

I have succeeded locating the 2 copies in different locations as I wish but I'm having trouble with the CSEG AT statement which needs to be changed in the STARTUP.A51 of the boot loader. I want to do this during runtime so that when the boot loader decides which image it needs to run it will tell the hardware where the interrupt vectors are located using th CSEG.

Is this technically possible? and if the answer is yes...how is it done? I didnt really understand good enough the CSEG statement.

Thank you very much.

  • with the CSEG AT statement which needs to be changed during runtime
    if that was possible the compiler/linker would need to have the ability to dynamically at run time relocate code in read only memory.

    to get you started this in the part residing off loc sero

    CSEG       AT    000h     ;reset
               ljmp  startup
    CSEG       AT    003h     ;int 0
               ljmp  ISC_EI0
    ...
    ...
    ...
    startup:;  setb  GBboot
               mov   dptr,#0fbffh
               mov   a,#0
               movc  a,@a+dptr
               jnz   startAP               ; if last page of flash is erased we are in app mode
               ljmp   ?C_STARTUP
    startAP:   clr   GBboot
               ljmp  APPBASE + 060h
    


    this in each of the two

    .....
    CSEG       AT    APPBASE + 060h    ;int 20
               ljmp  ?C_STARTUP
    

    Erik