Other Parts Discussed in Thread: HALCOGEN
Interrupts and Configure Threadx to Halocgen generated code.
We are using TMS570LS1224PGE for one our safety product, and using Hlcogen(04.05.02) to generate code and IAR Embedded Workbench. We want use irqDispatch mode for interrupts. _irqDispatch function is not generated by Halcogen. Is it bug with Halcogen or what way implement _irqDispatch function. sample code will be helpful.
We are configuring the Threadx for TMS570LS1224PGE, as per Thread safety manual, _tx_thread_context_save should be called before the IRQ dispatch, to do this we need edit halcogen generated code, by doing this we might lose the safety certificate(package) bought from TI for halcogen.
Is there any way to configure without handing editing the Halcogen generated code and same time satisfying Threadx safety manual.
snap from thredx safaty manul.
Standard IRQ Interrupts
Standard IRQ interrupts are the most common. In this implementation, all IRQ interrupts are funneled through the IRQ vector at address 0x18. The IRQ interrupt processing must then figure out which interrupt(s) occurred and dispatch accordingly. The following is an example of a standard IRQ interrupt handler in ThreadX:
RSEG .text:CODE:NOROOT(2)
PUBLIC __tx_irq_handler
RSEG .text:CODE:NOROOT(2)
PUBLIC __tx_irq_processing_return
__tx_irq_handler
;
; /* Jump to context save to save system context. */
B _tx_thread_context_save
__tx_irq_processing_return
;
; /* At this point execution is still in the IRQ mode. The CPSR,
; point of interrupt, and all C scratch registers are available for
; use. Note that IRQ interrupts are still disabled at this
; point. */
;
; /* Application ISR dispatch call goes here! */
;
; /* Jump to context restore to restore system context. */
B _tx_thread_context_restore
Vectored IRQ Interrupts
Vectored IRQ interrupts are implementation specific for the ARM9 architecture. The primary advantage is that each IRQ interrupt source has a unique vector address, which is specified by the application during initialization. Hence, vectored IRQ interrupts eliminate the need for an IRQ dispatch function. This makes the interrupt handling logic simpler and more streamlined. The following is an example of a vectored IRQ interrupt handler in ThreadX:
RSEG .text:CODE:NOROOT(2)
PUBLIC __tx_example_vectored_irq_handler
__tx_example_vectored_irq_handler
;
; /* Jump to context save to save system context. */
STMDB sp!, {r0-r3} ; Save some scratch registers
MRS r0, SPSR ; Pickup saved SPSR
SUB lr, lr, #4 ; Adjust point of interrupt
STMDB sp!, {r0, r10, r12, lr} ; Store other registers
BL _tx_thread_vectored_context_save
;
; /* At this point execution is still in the IRQ mode. The CPSR,
; point of interrupt, and all C scratch registers are available for
; use. Note that IRQ interrupts are still disabled at this
; point. */
;
; /* Application ISR dispatch call goes here! */
;
; /* Jump to context restore to restore system context. */
B _tx_thread_context_restore