Compiling RTX Kernel files using GCC Compiler in Eclipse IDE

微笑、不失礼 提交于 2019-12-21 19:11:52

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!