ARM Technical Support Knowledge Articles

CONVERTING PROGRAMS FROM GNU

Applies to: CARM C Compiler

Answer


Information in this article applies to:


QUESTION

I have written an ARM program using GNU GCC, but now I need the advanced features of the Keil CARM compiler.

What steps need to be done to convert a GNU GCC program to the Keil CARM Compiler?

ANSWER

Converting a program from GNU GCC to the Keil CARM Compiler is straight-forward. Just follow these steps:

Toolset Configuration

The tool configuration is changed for the Keil CARM Compiler within the uVision IDE by the following steps:

STARTUP.S and Other Assembler Source Files

The assembler syntax of the GNU assembler is different. Therefore we recommend to replace the GNU specific STARTUP.S file with a pre-configured STARTUP.S file for the Keil CARM toolchain that can be found in the folder KeilARMSTARTUP. Make the required configurations for hardware and stack sizes.

Other assembler source files of your project need syntax adaptions. For more information refer to the AARM User's Guide.

C Run-Time Library Configuration

The Keil CARM Compiler is designed for embedded applications. The syscalls.c (system calls remapping) file is not required and should be deleted from your project.

If malloc library functions are used, the memory space needs to be initialized with the init_mempool function.

The Keil CARM printf does not delay character output. GNU GCC functions like fflush (stdout) are no longer required and can be removed.

C Source Code Changes

The Keil CARM compiler uses a different syntax for language extensions. You may just compile all C source files which creates syntax errors on the relevant statements.

For example, interrupt functions are defined in Keil CARM with __irq whereas GNU uses the following syntax:

  void timer_irq (void) __attribute__ ((interrupt));
  void timer_irq (void) {
    :
  }

For Keil CARM just change the source code to:

  void timer_irq (void) __irq  {
    :
  }

MORE INFORMATION

SEE ALSO

Article last edited on: 2006-10-29 19:07:40

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential