问题
We have a project in KEIL IDE for LPC2148 which has RTX kernel programs along with other programs in it, which was compiled by ARM CC.Now we need to change the IDE from KEIL(ARM CC) to Eclipse(GCC). When we tried to compile it in Eclipse GCC Compiler, it is showing errors in RTX_Config.c and RTX_Config.h files. Other files are compiled successfully using GCC compiler. But RTXConfig.c file has compiler specific codes which are not getting compiled by GCC. Is there any solution to compile this project in Eclipse IDE using GCC compiler? Please help me out in this as am a beginner. Thanks in advance
We have some keil specific keywords like irq , __swi, __task , __asm which is compiled successfully by ARM CC (keil), but when we tried to port it to GCC Compiler (Eclipse), This compiler cannot compile these keywords and showing errors. Is there any way to compile these keil specific keywords in GCC Compiler?
回答1:
do_software_interrupt, do_irq and do_fiq are interrupt service routines for SWI, IRQ and FIQ respectively. These functions are implemented in c using gcc’s attribute feature. Here is the actual c code containing routines for irq, fiq and software interrupt.
entry.c
void __attribute__((interrupt("IRQ"))) do_irq()
{
//your irq service code goes here
}
void __attribute__((interrupt("FIQ"))) do_fiq()
{
//your fiq service code goes here
}
void __attribute__((interrupt("SWI"))) do_software_interrupt()
{
volatile unsigned int int_num;
asm("LDR r0, [lr, #-4]");
asm("BIC r0, #0xFF000000");
asm("MOV %0, r0":"=r"(int_num):);
//based on int_num, you can determine which system call is called
}
void c_start() {
asm volatile ("SVC 0x5");
while(1){}
}
来源:https://stackoverflow.com/questions/13231221/compiling-rtx-kernel-files-using-gcc-compiler-in-eclipse-ide