AnsweredAssumed Answered

IAP Bootloader Question

Question asked by viveros.solomon on Nov 27, 2013
Latest reply on Nov 28, 2013 by Clive One
I've developed a single project[using two separate irom sections which keil currently manages] that contains my bootloader and ApplicationMain(). The first flash block is reserved for the bootloader that runs upon power-up which then depending on criteria will either remain in the bootloader or run the rest of my project[found in following flash sections]...

#define ApplicationMain()                   ((void (*)())(0x08005d69))()
 
 
 
if((BootLoaderSaved.BootLoaderProgrammedFlag1 == VALID_FW_PRESENT_FLAG1) && (BootLoaderSaved.BootLoaderProgrammedFlag2 == VALID_FW_PRESENT_FLAG2) && (BootLoaderSaved.BootLoaderProgrammedFlag3 == VALID_FW_PRESENT_FLAG3))
        ApplicationMain();
    else
        {
        FLASH_If_Init();
             
        while(1)
            {      
            BootLoaderDoReceive();
            BootLoaderDoTransmit();
            }

My current implementation requires the known location of my ApplicationMain which I get from looking at the project *.map file...no sooner the address of ApplicationMain() changes, I get a hard fault...my question is -- do the ST IAP examples expect whatever user application's main() to be fixed at 0x08004000, if so, how does one accomplish this in keil? 

What does __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS); do exactly? I noticed that the code appears to be running correctly even without the line present in my current code...

Outcomes