我们在KEIL IDE中有一个针对LPC2148的项目,其中包含RTX内核程序以及其他程序,这些项目是由ARM CC编译的。现在,我们需要将IDE从KEIL(ARM CC)更改为Eclipse(GCC)。当我们尝试在Eclipse GCC编译器中对其进行编译时,它在RTX_Config.c和RTX_Config.h文件中显示错误。使用GCC编译器成功编译了其他文件。但是RTXConfig.c文件具有特定于编译器的代码,这些代码不会由GCC进行编译。有什么解决方案可以使用GCC编译器在Eclipse IDE中编译该项目?请以初学者的身份帮助我。在此先感谢
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
我们有一些特定于keil的关键字,例如 irq,__swi,_ _task,__asm,这些关键字已由ARM CC成功编译(keil) ,但是当我们尝试将其移植到GCC编译器(Eclipse)时,该编译器无法编译这些关键字并显示错误。 是否可以在GCC编译器中编译这些keil特定的关键字?
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?
推荐答案do_software_interrupt,do_irq和do_fiq分别是SWI,IRQ和FIQ的中断服务程序。这些功能是使用gcc的属性功能在c中实现的。这是包含irq,fiq和软件中断例程的实际c代码。
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){} }更多推荐
在Eclipse IDE中使用GCC编译器编译RTX内核文件
发布评论