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

C166 : startup with a loader

Hi,

I use a C164 chip (similar to C166).
For my project, I'll have a bootloader (witch will be located in 0xC0'0000) and an applicative software (located in 0xC1'0000).

Is it possible to have the following flow chart ?

Start 0xC0'0000
if (A_FLAG_IN_FLASH == VALID_APPLI)
  Call Applicative_Startup
else
  Call Boot_Startup
endif

Boot_Startup and Applicative_Startup are the START_V2.A66 file for each project. They will be for sure different.

I don't find the way to do that in keil s options (move ICODE section to 0xC1'0000 didn't success with the linker, ...)

If you have some tips or application note, it will be great.

thks, Nick.

Parents Reply Children
  • Hi np,

    your bootloader project looks like similar to my project. I write a C-program that loads an hexfile from the Office-PC to the XC167 via serial-interface. After calculating the Cheksum of the hexfile it will be written to the on-chip flash beginning at address 0xC02000. To run the hexcode from the on-chip flash i had to jump to the main routine, which i located at address 0xC02800.
    In my project i use the same startup-file for the bootloader and the downloaded application. So I'm not confronted with the problem of to startup files.
    Problems occurs when i modify the vector segment register and jump to the application-main routine:

    PSW_IEN   = 0 ;
    VECSEG=0x00C1;
    ((void (far *) (void)) 0xC02800) ();
    


    At the address 0xC02800 first the interrupts are activated and an endless loop waits for data from the serial interface. This works good but any other interrupts like timer or IIC don't work.

    Please post me when you made similar eperience. Mayb we can compare some notes about this kind of application.

    Greetings