london
Member level 4
Hi There,
Working on MCF52259 bootloader standard program in C, as per the freescale flowchart, if the program entered into the bootloader function then board have to be reset to exit from bootloader mode. For my application, if there is no mass storage aviable on the bood, I want to exit from bootloader function automatically after some time and go to main finction without reset the board.
here is the free scale code attached for your reference, it any one have some solutation share with me
void _Entry(void)
{
word i;
dword* UserEntryCheck;
// Handy line to use when testing application code in RAM
//asm(JMP startup);
MCF_GPIO_DDRNQ &= ~MCF_GPIO_DDRNQ_DDRNQ1; // PNQ1 as loading Input
MCF_GPIO_PNQPAR &= ~(MCF_GPIO_PNQPAR_PNQPAR1(3)); // set PNQ1 as GPIO
// delay some time for GPIO stable
for(i = 0; i < 20000; i++)
{
asm(nop);
}
/*******************/
/*******************/
// Disable Software Watchdog Timer
MCF_SCM_CWCR = 0;
// Enable debug
MCF_GPIO_PDDPAR = 0x0F;
MCF_CLOCK_OCLR = 0xC0; //turn on crystal
// delay some time for oscillator stable
for(i=0;i<255;i++)
{
asm(nop);
}
MCF_CLOCK_CCLR = 0x00; //switch to crystal
MCF_CLOCK_OCHR = 0x00; //turn off relaxation osc
// Enable on-chip modules to access internal SRAM
MCF_SCM_RAMBAR = (0
| MCF_SCM_RAMBAR_BA(RAMBAR_ADDRESS)
| MCF_SCM_RAMBAR_BDE);
// init controller and USB, searching USB and TUV_ccb.s19 file; load and boot also.
Bootloader_Main();
/************copied*******************/
// If SW1 not pressed, jump to user application
if(MCF_GPIO_SETNQ & MCF_GPIO_SETNQ_SETNQ1)
{
if ((uint32)_Entry >= (uint32)(__RAMBAR)) // Test to see if running in RAM or Flash
{
asm (JMP _startup); // jump to user entry
}
else
{
UserEntryCheck = (dword*)USER_ENTRY_ADDRESS;
if(*UserEntryCheck == 0x4E714EF9) // check there is a valid jump op-code
{
UserEntryCheck++; // increment pointer to next long word
if(*UserEntryCheck != 0xFFFFFFFF) // check there is a valid jump vector
{
asm (JMP USER_ENTRY_ADDRESS); // jump to user entry
}
}
}
}
/****************************************/
}
Working on MCF52259 bootloader standard program in C, as per the freescale flowchart, if the program entered into the bootloader function then board have to be reset to exit from bootloader mode. For my application, if there is no mass storage aviable on the bood, I want to exit from bootloader function automatically after some time and go to main finction without reset the board.
here is the free scale code attached for your reference, it any one have some solutation share with me
void _Entry(void)
{
word i;
dword* UserEntryCheck;
// Handy line to use when testing application code in RAM
//asm(JMP startup);
MCF_GPIO_DDRNQ &= ~MCF_GPIO_DDRNQ_DDRNQ1; // PNQ1 as loading Input
MCF_GPIO_PNQPAR &= ~(MCF_GPIO_PNQPAR_PNQPAR1(3)); // set PNQ1 as GPIO
// delay some time for GPIO stable
for(i = 0; i < 20000; i++)
{
asm(nop);
}
/*******************/
/*******************/
// Disable Software Watchdog Timer
MCF_SCM_CWCR = 0;
// Enable debug
MCF_GPIO_PDDPAR = 0x0F;
MCF_CLOCK_OCLR = 0xC0; //turn on crystal
// delay some time for oscillator stable
for(i=0;i<255;i++)
{
asm(nop);
}
MCF_CLOCK_CCLR = 0x00; //switch to crystal
MCF_CLOCK_OCHR = 0x00; //turn off relaxation osc
// Enable on-chip modules to access internal SRAM
MCF_SCM_RAMBAR = (0
| MCF_SCM_RAMBAR_BA(RAMBAR_ADDRESS)
| MCF_SCM_RAMBAR_BDE);
// init controller and USB, searching USB and TUV_ccb.s19 file; load and boot also.
Bootloader_Main();
/************copied*******************/
// If SW1 not pressed, jump to user application
if(MCF_GPIO_SETNQ & MCF_GPIO_SETNQ_SETNQ1)
{
if ((uint32)_Entry >= (uint32)(__RAMBAR)) // Test to see if running in RAM or Flash
{
asm (JMP _startup); // jump to user entry
}
else
{
UserEntryCheck = (dword*)USER_ENTRY_ADDRESS;
if(*UserEntryCheck == 0x4E714EF9) // check there is a valid jump op-code
{
UserEntryCheck++; // increment pointer to next long word
if(*UserEntryCheck != 0xFFFFFFFF) // check there is a valid jump vector
{
asm (JMP USER_ENTRY_ADDRESS); // jump to user entry
}
}
}
}
/****************************************/
}