Keil Logo

GCC: LINK PROBLEMS AFTER CHANGING COMPILER TOOLCHAIN


Information in this article applies to:

  • GNU C Compiler for ARM Version 3.22

QUESTION

My ARM project was previously configured for the ARM ADS or Keil ARM toolchain. Since I have changed it to the GNU toolset I can no longer link my program.

I changed the Startup Code (Startup.s), but when I link my application I receive several error messages from the linker:

linking...
arm-thumb-elf/bin/ld: warning: cannot find entry symbol _start; defaulting to 00008000
startup.o(.text+0x14c):/cygdrive/h/TestProject/Startup.s:250: undefined reference to '_data'
collect2: ld returned 1 exit status
Target not created

ANSWER

The following things are required for a GNU project setup:

  1. In most cases you need a Linker Script file, that fits the controller configuration you are using. The generic linker script can be found under \ARM\GNU\LinkerScript.ld. Copy this file to your project and customize it according to your needs. Alternatively you may use a preconfigured *.ld file from one of the example projects in \ARM\GNU\Examples or \ARM\GNU\Boards. Specify the file under Options for Target - Linker.
  2. Enter the start address of the Text Section (used for Code/Constants) and the Data Section. These settings can be made Options for Target - Linker. Be sure that the start address is within the range of the areas defined in your Linker Description File.
  3. Make sure that you have activated the checkbox Do not use Standard System Startup Files. Otherwise, your Startup.s is not used and the Standard Startup is unsuitable for most controllers.

MORE INFORMATION

  • Getting Started User's Guide for ARM, CPU Setup

SEE ALSO

Last Reviewed: Monday, December 10, 2012


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.