dhanraj.kmr
Newbie level 4
Hi All,
I am new to dsPIC and I am trying to understand a program given by my vendor.
I am using dsPIC33EP512MU814, MPLAB X, XC16 compiler.
I have few questions from the code.
I have an application project given by my vendor which occupies primary flash memory. In order to confirm this I had to check two things. 1. Program Memory [Origin = 0x200, Length = 0x555fe] from compiler output. 2. Total auxflash memory used (bytes): 0 (0) <1%. 3. From my application configuration register, FICD register is loaded to always go to primary flash memory location after reset.
My first question is related to this. When I check the linker file(.gld), it says my program origin is 0x200, but why is __CODE_BASE is pointing to Auxiliary flash location? I tried to understand more by googling it. But all of them are program = __CODE_BASE. My linker script below(Extracted to show important portion of it),
So my second question is, is there any default bootloader loaded in Auxiliary flash memory by microchip?
my third question is, how the program control jumps to bootloader in after a reset issued? I know it can only goto 0x000000 location and from there GOTO instruction must point it to required location either 0x000004 or 0x7FFFFFA. but I see there is one more GOTO instruction at 0x7FFFFFC. How this is handled?
In this case, if the application is not present and only bootloader is present in Auxiliary flash memory, after power up where the control goes?
From the code, Why it is going to the Auxiliary GOTO instruction location instead of Auxiliary flash memory interrupt vector table location?
I am new to dsPIC and I am trying to understand a program given by my vendor.
I am using dsPIC33EP512MU814, MPLAB X, XC16 compiler.
I have few questions from the code.
I have an application project given by my vendor which occupies primary flash memory. In order to confirm this I had to check two things. 1. Program Memory [Origin = 0x200, Length = 0x555fe] from compiler output. 2. Total auxflash memory used (bytes): 0 (0) <1%. 3. From my application configuration register, FICD register is loaded to always go to primary flash memory location after reset.
My first question is related to this. When I check the linker file(.gld), it says my program origin is 0x200, but why is __CODE_BASE is pointing to Auxiliary flash location? I tried to understand more by googling it. But all of them are program = __CODE_BASE. My linker script below(Extracted to show important portion of it),
I assume that, at 0x7FC000 some bootloader code is there which can not be confirmed with vendor due to no contact.program (xr) : ORIGIN = 0x200, LENGTH = 0x555FE
auxflash (xr) : ORIGIN = 0x7FC000, LENGTH = 0x3FF8
__CODE_BASE = 0x7FC000;
__CODE_LENGTH = 0x3FFA;
.text :
{
*(.init);
*(.user_init);
KEEP (*(.handle));
KEEP (*(.isr*));
*(.libc) *(.libm) *(.libdsp); /* keep together in this order */
*(.lib*);
} >program
So my second question is, is there any default bootloader loaded in Auxiliary flash memory by microchip?
my third question is, how the program control jumps to bootloader in after a reset issued? I know it can only goto 0x000000 location and from there GOTO instruction must point it to required location either 0x000004 or 0x7FFFFFA. but I see there is one more GOTO instruction at 0x7FFFFFC. How this is handled?
In this case, if the application is not present and only bootloader is present in Auxiliary flash memory, after power up where the control goes?
From the code, Why it is going to the Auxiliary GOTO instruction location instead of Auxiliary flash memory interrupt vector table location?
Code:
void GotoBoot(void)
{
asm("goto 0x7FFFFC");
}