i.MXRT1050 Plugin image

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MXRT1050 Plugin image

1,664 Views
lukaszskrzypcza
Contributor II

Hi all,

I'm in the middle of development of custom bootloader for i.MXRT1050 family processor and I'd like to use 'Plugin image' functionality. So far I managed to invoke proper function described in manual :

typedef BOOLEAN (*plugin_download_f)(void **start, size_t *bytes, UINT32 *ivt_offset);

but booting of loaded image fails after return. My question is: exactly what values shall be returned in function parameters with respect to target image IVT ? Eg. *start should be the pointer to the very beginning of the image (eg. 0x80000000, where IVT starts @0x80001000) ?

Best regards, Lukasz

Tags (1)
5 Replies

1,353 Views
tomajmich
Contributor I

Hi Lukasz,

can give more details on how exactly you were able to invoke the function? How did you build the image? What binary did you use etc.?

Any help will be appreciated

Regards

Tomasz 

0 Kudos

1,353 Views
diogocacador
Contributor III

I'm also interested in this. Were you successful?

Regards,

Diogo

0 Kudos

1,353 Views
lukaszskrzypcza
Contributor II

Sorry for this delay.

No. I haven't manage to boot with Plugin Image. Instead I used common method of changing VTOR value to point to image new interrupt vector table and jumping to new reset vector. Code goes as follows:

...
typedef void (*pFunction)(void);
int main(void) {
    pFunction Jump_To_Application;
    uint32_t call_Addr;

    LoadImage(&call_Addr);
    getIVT(&call_Addr, &ivt);
    uint8_t *jump = (uint8_t*)ivt->entry;
    unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08;
    *pSCB_VTOR = (unsigned int)jump;
    jump +=4;
    Jump_To_Application =  (pFunction) *(__IO uint32_t*) (jump);
    // Disable interrupts
    __asm volatile ("cpsid i");
    // Clear all pending interrupt flags & disable all NVIC interrupts
    for (int i = 0; i < (NMI_WAKEUP_IRQn + 1); i++) {
        NVIC_DisableIRQ(i);
        NVIC_ClearPendingIRQ(i);
    }
    Jump_To_Application();      //run application

    while(1); should never get here

    return 0;
}

Not quite elegant but works.

Best regards, Lukasz

1,353 Views
jmesc_
Contributor II

Hi Lukasz,

Interesting and classic approach always works ! just by curiosity what 

LoadImage(&call_Addr);

is doing ? in your case

Thanks
0 Kudos

1,353 Views
b36401
NXP Employee
NXP Employee

You can refer this example:
https://community.nxp.com/thread/302258
It is for i.MX6 processor but in i.MXRT there is nothing spechial in this point.

Have a great day,
Victor

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos