【问题标题】:Compiling RTX Kernel files using GCC Compiler in Eclipse IDE在 Eclipse IDE 中使用 GCC Compiler 编译 RTX Kernel 文件
【发布时间】:2012-10-25 05:40:35
【问题描述】:

我们在 LPC2148 的 KEIL IDE 中有一个项目,其中包含 RTX 内核程序以及其他程序,由 ARM CC 编译。现在我们需要将 IDE 从 KEIL(ARM CC) 更改为 Eclipse(GCC)。当我们尝试在 Eclipse GCC 编译器中编译它时,它在 RTX_Config.c 和 RTX_Config.h 文件中显示错误。其他文件使用 GCC 编译器编译成功。但是 RTXConfig.c 文件有编译器特定的代码,这些代码没有被 GCC 编译。有没有使用 GCC 编译器在 Eclipse IDE 中编译这个项目的解决方案?作为初学者,请帮助我。提前致谢

我们有一些特定于keil的关键字,如irq、__swi、__task、__asm,它们已被ARM CC(keil)成功编译,但是当我们尝试将其移植到GCC编译器(Eclipse)时,此编译器无法编译这些关键字并显示错误。 有没有办法在 GCC 编译器中编译这些 keil 特定的关键字?

【问题讨论】:

    标签: eclipse gcc keil rtx


    【解决方案1】:

    do_software_interrupt、do_irq 和 do_fiq 分别是 SWI、IRQ 和 FIQ 的中断服务程序。这些函数是使用 gcc 的 attribute 特性在 c 中实现的。这是包含 irq、fiq 和软件中断例程的实际 c 代码。

    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){}
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-23
      • 1970-01-01
      • 2020-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-25
      • 2021-06-03
      相关资源
      最近更新 更多