Hello,
I tried to implement my interrupt table in flash with several ways, but it doesn't work
I tried 4 solutions and just one is working but I am not satisfied of this solution.
1/ In the exemple1 , I create my section before the internal_flash section. I've not error or warning during the compilation, but when I load the code on my board, I go directly in illegal interrupt.
MPC5604B_FLASH.lcf
exception_handlers: org = 0x00001000, len = 0x00002000
flash_isr_handler: org = 0x00003000, len = 0x00002000
internal_flash: org = 0x00005000, len = 0x00070000
.....
.ivor_branch_table (VLECODE) LOAD(ADDR(exception_handlers)) ALIGN (0x10) : {}
.intc_hw_branch_table (VLECODE) LOAD(_e_ivor_branch_table) ALIGN(0x800) : {}
.__exception_handlers (VLECODE) LOAD(_e_intc_hw_branch_table) : {}
} > exception_handlers
.flash_isr_handler LOAD (0x00003000): {} > flash_isr_handler
INTS_SwInterrupt.code
#pragma push /* Save the current state */
#pragma section const_type ".__flash_isr_handler" ".__flash_isr_handler"
const INTSInterruptFn INTSSwInterruptsTable[INTS_U8_NUMBER_OF_ISR] =
{
}
INTS_Interrupt.h
extern const INTSInterruptFn INTSSwInterruptsTable[INTS_U8_NUMBER_OF_ISR];
2/ In the exemple2, I've not error or warning during the compilation, but when I load the code on my board, I go directly in illegal interrupt.
MPC5604B_FLASH.lcf
exception_handlers: org = 0x00001000, len = 0x00002000
flash_isr_handler: org = 0x00003000, len = 0x00002000
internal_flash: org = 0x00005000, len = 0x00070000
.....
.ivor_branch_table (VLECODE) LOAD(ADDR(exception_handlers)) ALIGN (0x10) : {}
.intc_hw_branch_table (VLECODE) LOAD(_e_ivor_branch_table) ALIGN(0x800) : {}
.__exception_handlers (VLECODE) LOAD(_e_intc_hw_branch_table) : {}
} > exception_handlers
GROUP : {
.__flash_isr_handler ALIGN(2048) : {}
} > flash_isr_handler
INTS_SwInterrupt.c
#pragma push /* Save the current state */
#pragma section const_type ".__flash_isr_handler" ".__flash_isr_handler"
const INTSInterruptFn INTSSwInterruptsTable[INTS_U8_NUMBER_OF_ISR] =
{
}
INTS_Interrupt.h
#pragma push
#pragma section const_type ".__flash_isr_handler"
extern const __declspec(section ".__flash_isr_handler") INTSInterruptFn INTSSwInterruptsTable[INTS_U8_NUMBER_OF_ISR];
#pragma pop
3/ In the exemple3, I shift my section after the internal_flash section before the end of the flash, but when I go in debug mode, nothing happen (no message).
MPC5604B_FLASH.lcf
exception_handlers: org = 0x00001000, len = 0x00002000
internal_flash: org = 0x00003000, len = 0x00070000
flash_isr_handler: org = 0x00073000, len = 0x00002000
.....
GROUP : {
.text : {}
.text_vle (VLECODE) ALIGN(0x08): {
*(.text)
*(.text_vle)
}
.rodata (CONST) : {
*(.rdata)
*(.rodata)
}
/* The INTC module for this device contains 217 IRQs.*/
/* .__initialized_flash_isr_handle ALIGN(2048) : {}
.__uninitialized_flash_isr_handle ALIGN(2048) : {}*/
.ctors : {}
.dtors : {}
extab : {}
extabindex : {}
} > internal_flash
GROUP : {
.__flash_isr_handler ALIGN(2048) : {}
} > flash_isr_handler
INTS_SwInterrupt.c
#pragma push /* Save the current state */
#pragma section const_type ".__flash_isr_handler" ".__flash_isr_handler"
const INTSInterruptFn INTSSwInterruptsTable[INTS_U8_NUMBER_OF_ISR] =
{
}
INTS_Interrupt.h
#pragma push
#pragma section const_type ".__flash_isr_handler"
extern const __declspec(section ".__flash_isr_handler") INTSInterruptFn INTSSwInterruptsTable[INTS_U8_NUMBER_OF_ISR];
#pragma pop
In the exemple4, it is working, but I define my interrupt table in the internal_flash section.
But I prefere to create a special section for the interrupt, I'm not satisfied of this solution.
MPC5604B_FLASH.lcf
exception_handlers: org = 0x00001000, len = 0x00002000
internal_flash: org = 0x00003000, len = 0x0007D000
.....
GROUP : {
.text : {}
.text_vle (VLECODE) ALIGN(0x08): {
*(.text)
*(.text_vle)
}
.rodata (CONST) : {
*(.rdata)
*(.rodata)
}
/* The INTC module for this device contains 217 IRQs.*/
.__initialized_flash_isr_handle ALIGN(2048) : {}
.__uninitialized_flash_isr_handle ALIGN(2048) : {}
.ctors : {}
.dtors : {}
extab : {}
extabindex : {}
} > internal_flash
GROUP : {
.__flash_isr_handler ALIGN(2048) : {}
} > flash_isr_handler
INTS_SwInterrupt.c
#pragma push /* Save the current state */
#pragma section data_type ".__initialized_flash_isr_handle" ".__uninitialized_flash_isr_handle"
const INTSInterruptFn INTSSwInterruptsTable[INTS_U8_NUMBER_OF_ISR] =
INTS_Interrupt.h
#pragma push
#pragma section data_type ".__initialized_flash_isr_handle" ".__uninitialized_flash_isr_handle"
extern const __declspec(section ".__initialized_flash_isr_handle") INTSInterruptFn INTSSwInterruptsTable[INTS_U8_NUMBER_OF_ISR];
#pragma pop
Do you have an idea where does come from the problem?