/*
* Dual panel memory regions
*/
#ifdef __DUAL_PARTITION
reset : ORIGIN = 0x0, LENGTH = 0x4
ivt : ORIGIN = 0x4, LENGTH = 0x1FC
/*program (xr) : ORIGIN = 0x1000, LENGTH = 0x9B80*/
program (xr) : ORIGIN = 0x200, LENGTH = 0xA980
FSEC : ORIGIN = 0xAB80, LENGTH = 0x2
FBSLIM : ORIGIN = 0xAB90, LENGTH = 0x2
FSIGN : ORIGIN = 0xAB94, LENGTH = 0x2
FOSCSEL : ORIGIN = 0xAB98, LENGTH = 0x2
FOSC : ORIGIN = 0xAB9C, LENGTH = 0x2
FWDT : ORIGIN = 0xABA0, LENGTH = 0x2
FPOR : ORIGIN = 0xABA4, LENGTH = 0x2
FICD : ORIGIN = 0xABA8, LENGTH = 0x2
FDEVOPT : ORIGIN = 0xABAC, LENGTH = 0x2
FALTREG : ORIGIN = 0xABB0, LENGTH = 0x2
FBTSEQ : ORIGIN = 0xABFC, LENGTH = 0x2
#endif
Singal Panel :
#ifndef __DUAL_PARTITION
__Key_BASE = 0x200;
__BS_BASE = 0x280; /* Added by Joss */
__CODE_BASE = 0x1000; /*__CODE_BASE = 0x200;*/
__CODE_LENGTH = 0x15580;
__IVT_BASE = 0x4;
#endif
Dual Panel :
/*
* Dual panel memory regions
*/
#ifdef __DUAL_PARTITION
__NO_HANDLES = 1; /* Suppress handles on this device */
__Key_BASE = 0x200;
__BS_BASE = 0x280; /* Added by Joss */
__CODE_BASE = 0x1000; /*__CODE_BASE = 0x200;*/
__CODE_LENGTH = 0xA980;
__IVT_BASE = 0x4;
#endif
Constant variable section :
BS_KeySection : AT(__Key_BASE)
{
*(.BS_Key);
} >program
Constant variable in C code:
const unsigned char __attribute__ ((section(".BS_Key"), space(psv) )) BS_Key[] = {"1234zxyw123412341234"};
Functions section:
BS_Section __BS_BASE : /* Added by Joss */
{
*(BS_Section);
*(BS1_Section);
*(BS2_Section);
*(BS3_Section);
} >program
Functions declared in C code:
unsigned int __attribute__ (( section("BS_Section") )) BS_Program(unsigned int PSWD ) // Boot segment Application Code
{
if(PSWD == 0x1234)
LATAbits.LATA3 = 1; // PASS
else
LATAbits.LATA4 = 1; // FAIL
LATAbits.LATA0 =~ LATAbits.LATA0;
if( PSWD < sizeof(BS_Key))
return BS_Key[PSWD];
else
return -1;
}
unsigned int __attribute__ (( section("BS1_Section") )) BS1_Program(unsigned int PSWD ) // Boot segment Application Code
{
if( PSWD < sizeof(BS_Key))
return BS_Key[PSWD];
else
return -1;
}
unsigned int __attribute__ (( section("BS2_Section") )) BS2_Program(unsigned int PSWD ) // Boot segment Application Code
{
if( PSWD < sizeof(BS_Key))
return BS_Key[PSWD];
else
return -1;
}
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up