AnsweredAssumed Answered

SDK 2.2 Interrupt and UART

Question asked by Daniele Cortellazzi on Apr 20, 2017
Latest reply on Apr 26, 2017 by Jorge Antonio Alcala Vazquez

Hello,

 

i use the SDK2.2 and on my system i have a my library where i use the MK22FX512. I want to use a custom library written by me for control the UART4 with interrupt mode. In the init function i have to set the function that will be point when the interrupt happen. If i have this code:

 

/* Enable interrupts */
InstallIRQHandler(UART4_RX_TX_IRQn, UART4_RX_TX_IRQHandler);
EnableIRQ(UART4_RX_TX_IRQn);

 

the system give me some errors during the compile :

 

../drivers/fsl_common.c:114: undefined reference to `__RAM_VECTOR_TABLE_SIZE_BYTES'
../drivers/fsl_common.c:114: undefined reference to `__VECTOR_RAM'
../drivers/fsl_common.c:114: undefined reference to `__VECTOR_TABLE'

 

where in fsl_common.c i have

 

 

uint32_t InstallIRQHandler(IRQn_Type irq, uint32_t irqHandler)
{
/* Addresses for VECTOR_TABLE and VECTOR_RAM come from the linker file */
#if defined(__CC_ARM)
extern uint32_t Image$$VECTOR_ROM$$Base[];
extern uint32_t Image$$VECTOR_RAM$$Base[];
extern uint32_t Image$$RW_m_data$$Base[];

#define __VECTOR_TABLE Image$$VECTOR_ROM$$Base
#define __VECTOR_RAM Image$$VECTOR_RAM$$Base
#define __RAM_VECTOR_TABLE_SIZE (((uint32_t)Image$$RW_m_data$$Base - (uint32_t)Image$$VECTOR_RAM$$Base))
#elif defined(__ICCARM__)
extern uint32_t __RAM_VECTOR_TABLE_SIZE[];
extern uint32_t __VECTOR_TABLE[];
extern uint32_t __VECTOR_RAM[];
#elif defined(__GNUC__)
extern uint32_t __VECTOR_TABLE[];
extern uint32_t __VECTOR_RAM[];
extern uint32_t __RAM_VECTOR_TABLE_SIZE_BYTES[];
uint32_t __RAM_VECTOR_TABLE_SIZE = (uint32_t)(__RAM_VECTOR_TABLE_SIZE_BYTES);
#endif /* defined(__CC_ARM) */
uint32_t n;
uint32_t ret;
uint32_t irqMaskValue;

irqMaskValue = DisableGlobalIRQ();
if (SCB->VTOR != (uint32_t)__VECTOR_RAM)
{
/* Copy the vector table from ROM to RAM */
for (n = 0; n < ((uint32_t)__RAM_VECTOR_TABLE_SIZE) / sizeof(uint32_t); n++)
{
__VECTOR_RAM[n] = __VECTOR_TABLE[n];
}
/* Point the VTOR to the position of vector table */
SCB->VTOR = (uint32_t)__VECTOR_RAM;
}

ret = __VECTOR_RAM[irq + 16];
/* make sure the __VECTOR_RAM is noncachable */
__VECTOR_RAM[irq + 16] = irqHandler;

EnableGlobalIRQ(irqMaskValue);

return ret;
}
#endif

what i have to set the interrupt?

 

Thanks

Outcomes