Author Topic: Need Model linker script.gld for Bootloader and Application for PIC24FJ128GB206  (Read 889 times)

0 Members and 1 Guest are viewing this topic.

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Hello All,
I am going to develop Bootloader for PIC24FJ128GB206.I read AN1157 and some posts in the same forum to get understanding on bootloader. What I understood is BL script owns the Real IVT and APP script will generate new IVT table in its space. So,the Real IVT points to APP_IVT which has the address of the ISR.

Though, I have some confusion in understanding about Reset Vector:
Well, let's assume my Boot loader start at:
data  (a!xr)   : ORIGIN = 0x0800,        LENGTH = 0x18000   
  reset          : ORIGIN = 0x0000,        LENGTH = 0x4   
  ivt            : ORIGIN = 0x0004,        LENGTH = 0xFC   
  aivt           : ORIGIN = 0x0104,        LENGTH = 0xFC
program (xr)   :ORIGIN = 0x400,         LENGTH = 0x1000 /*Boot loader starts */

 Application starts at:
  data  (a!xr)   : ORIGIN = 0x0800,        LENGTH = 0x18000   
  reset          : ORIGIN = 0x0000,        LENGTH = 0x4   
  ivt            : ORIGIN = 0x0004,        LENGTH = 0xFC   
  aivt           : ORIGIN = 0x0104,        LENGTH = 0xFC
  app_ivt        : ORIGIN = 0x1402,        LENGTH = 0x01FC   
  program (xr)   : ORIGIN = 0x1602,        LENGTH = 0x141F6 /* User code starts */

Q1:After every device reset,bootloader has to be called first. For this, the device's hardware Reset vector(addresses 000000h and 000002h) should have starting address of Bootloader (0x400). Am I right?. But I don't see that this is mapped in both program and script.

Q2: After successful bootloader operation or boot timeout, it must call user application. In the Bootloader program, they defined constant "USER_PROG_RESET"(0x100) which tells where the Reset vector is mapped. Though, in the App linker script, they explictely declared like below in the MEMORY section:

BLreset : ORIGIN = 0x100, LENGTH = 0x4

.BLreset :
{
(.BLreset);
} >BLreset


Q3: Some BL script files that I have seen have Boottimeout like below:
      /*   
  ** Boot loader timeout value.   
  ** Entered in seconds   
  */   
  .boottimeout :   
  {   
      SHORT(0x05);   /* Bootloader timeout in sec */   
      SHORT(0x00);   
  } >boottimeout   

  Question is that Boot.c set Bootdelay to 2 seconds.Then why they are using like above.

I really need some support.Please suggest.


Thanks,
Muthu
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf