bare metal usb host msd integration

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

bare metal usb host msd integration

573 Views
vikashkumar
Contributor I

Hello All,

I am working on bare metal usb host(msd) integration in TWR-K21F210MA board. On tower is working fine,but when i am integrating the same code with my original work space,i am getting an error in vector interrupt setting. 

void * INT_SYS_InstallHandler(IRQn_Type irqNumber, void (*handler)(void))
{
#if (defined(__CC_ARM))
    extern uint32_t Image$$VECTOR_RAM$$Base[];
    #define __VECTOR_RAM Image$$VECTOR_RAM$$Base
#else
    extern uint32_t __VECTOR_RAM[];
#endif

    /* Check IRQ number */
    assert(FSL_FEATURE_INTERRUPT_IRQ_MIN <= irqNumber);
    assert(irqNumber <= FSL_FEATURE_INTERRUPT_IRQ_MAX);

    /* Check whether there is vector table in RAM */
    assert(__VECTOR_RAM != 0U);
    
    /* Save the former handler pointer */
    void * retVal = (void *)__VECTOR_RAM[irqNumber + 16];

    /* Set handler into vector table */
    __VECTOR_RAM[irqNumber + 16] = (uint32_t)handler;    // here i am getting hard fault error.

    return retVal;
}

I am looking for solution.

Thank you

Labels (1)
0 Kudos
3 Replies

388 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Sorry for the later reply.

Could you tell us which IDE software you are using?

About the ISR handler address, please also consider the ARM Thumb bit: function pointers (and vectors pointers) have the Thumb bit set in the address, to mark that they are thumb functions.

So when using the ARM Thumb instruction, the really address should plus 0x1.

Wish it helps.


Have a great day,
Ma Hui

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

0 Kudos

388 Views
vikashkumar
Contributor I

Hui ma,

We are using KDS 3.0 as IDE

Currently having ucosii safety certified version along with QF framework.

I am trying to integrate the bare metal usb stack to it. Suspecting the way we are installing the interrupt be different.

Vikash.

0 Kudos

388 Views
neilporven
Senior Contributor I

Hi Vikash,

It seems I am having the same issue.  On the demo app stepping through what you mentioned above works fine.

If I try it in my custom board, I get the same hard fault error.  Where you able to figure this out?

Thanks,

Neil

0 Kudos