Keil Logo

CARM: CONVERTING PROGRAMS FROM GNU


Information in this article applies to:

  • CARM Version 2.0

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

Note: The CARM compiler is no longer supported. This article is for legacy users.

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 µVision IDE by the following steps:

  • Open Project - Components, Environment, Books - Folders/Extensions and change the selection for ARM Development Tools to Use Keil ARM Tools.
  • Open Project - Options for Target - Target and enable the on-chip memory (RAM/ROM) components of your device and/or add the address/location of external memory devices.
  • Open Project - Options for Target - LA Locate and enable Use Memory Layout from Target Dialog. Typically this completes the Linker/Locater setup. A linker script file is not required.

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 Keil\ARM\STARTUP. 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  {
    :
  }

Note: There have been many different variants of the GCC compiler for ARM devices. Modern versions of Keil still support the GCC compiler, but now uses the GNU Arm Embedded Toolchain. To use this toolchain with Keil, see GCC: Using a GNU GCC Compiler Toolchain in the IDE.

MORE INFORMATION

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Thursday, August 9, 2018


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.