Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 1st June 2008, 03:47 PM
Sune Ahlgren Offline
Registered User
 
Join Date: Sep 2005
Posts: 12
Question GNUARM link error

Hi!

I've built and installed GNU ARM tools on my Fedora 6 x86_64 machine.
I fail to link a simple program and I haven't got the faintest as to why.
I give you a full trace of my actions including how I built my ARM tool chain.

If you can find something I'd really appreciate that!

Thank you in advance
/Sune

PS I'll cross post this to the chat lounge as well....



This is how I built my arm tools
===========================================
It's pretty much straight from http://www.gnuarm.com/

binutils
----------
../binutils-2.17/configure --target=arm-elf --prefix=/usr/local/ARMv5TE --enable-interwork --enable-multilib
make all install
export PATH="$PATH:/usr/local/ARMv5TE/bin"

GCC
----------
../gcc-4.1.1/configure --target=arm-elf --prefix=/usr/local/ARMv5TE --enable-interwork --enable-multilib --enable-languages="c,c++" --with-newlib --with-headers=../../newlib/src/newlib/libc/include/
make all-gcc install-gcc

newlib
----------
../src/configure --target=arm-elf --prefix=/usr/local/ARMv5TE --enable-interwork --enable-multilib
make all install

GCC
----------
make all install

GDB
----------
../gdb-6.8/configure --target=arm-elf --prefix=/usr/local/ARMv5TE --enable-interwork --enable-multilib
make all install


This is how I compile my simple LED example
=============================================
arm-elf-gcc -mcpu=xscale -g -c -Wall -I../include ../led.c

I've tried without -mcpu=xscale as well with the same error.


This is my program
=============================================
led.h:
#ifndef LED_H_
#define LED_H_

#include <stdint.h>

// Define address of GPDR0, the direction register for GPIO 0..31
#define GPIO_0_DIR_REG (*((uint32_t volatile*)0x40E0000C))

// Define the address of GPSR0, the SET register for GPIO 0..31
#define GPIO_0_SET_REG (*((uint32_t volatile*)0x40E00018))

// Define the address of GPCR0, the CLEAR register for GPIO 0..31
#define GPIO_0_CLR_REG (*((uint32_t volatile*)0x40E00024))

// Define the address of GPLR0, the LEVEL register for GPIO 0..31
#define GPIO_0_LVL_REG (*((uint32_t volatile*)0x40E00000))

// LED_GREEN Identifies GPIO22
#define LED_GREEN (0x00400000)

// Define address of GAFR0_U, the ALTERNATE function register for GPIO
// 16..31
#define GPIO_0_ALT_REG (*((uint32_t volatile*)0x40E00058))

// Set function for GPIO
#define LED_GREEN_GPIO22_NORMAL_FUNCTION (0xFFFFCFFF)

#endif /*LED_H_*/


led.c:
#include "led.h"

void led_init()
{
// Set GPIO22 low before configuring it
GPIO_0_CLR_REG = LED_GREEN;

// Disable alternate functions of GPIO22
GPIO_0_ALT_REG &= LED_GREEN_GPIO22_NORMAL_FUNCTION;

// Set direction OUT since it’s a LED
GPIO_0_DIR_REG |= LED_GREEN;
}

void delay1s()
{
uint16_t rounds = 18000;

while (rounds--)
{}
}

void led_toggle()
{
if (GPIO_0_LVL_REG & LED_GREEN)
GPIO_0_CLR_REG = LED_GREEN;
else
GPIO_0_SET_REG = LED_GREEN;
}

int main(int argc, char** argv)
{
led_init();

while (1)
{
led_toggle();
delay1s();
}

return 0;
}



This is where it fails
=============================================

link command
---------------
arm-elf-ld -Map led.map -T viperlite.ld -No led led.o

link error
---------------
arm-elf-ld: error: no memory region specified for loadable section `.glue_7'

link script (viperlite.ld)
---------------
ENTRY (main)

MEMORY
{
ram : ORIGIN = 0x00400000, LENGTH = 64M
rom : ORIGIN = 0x60000000, LENGTH = 16M
}

SECTIONS
{
data : /* Initialized data. */
{
_DataStart = . ;
*(.data)
_DataEnd = . ;
} >ram

bss : /* Uninitialized data. */
{
_BssStart = . ;
*(.bss)
_BssEnd = . ;
} >ram

text : /* The actual instructions. */
{
*(.text)
} >ram
}
Reply With Quote
  #2  
Old 1st June 2008, 04:31 PM
stevea's Avatar
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300
You have double posted.
I predict a spanking in your future.
==
What does "readelf -S led.o" report on your object file ?
The host readelf will *probably* work if you didn't built the full arm target binutils.

I have no idea where the loadable section `.glue_7' is coming from, but you should also look at the sections in the C language intro routines, typically in crtbegin.o, crtend.o but other names are used in older gcc linkers.

[edit]

Sorry - it's probably crti.o for C on ARM.

Last edited by stevea; 1st June 2008 at 04:42 PM.
Reply With Quote
  #3  
Old 1st June 2008, 11:56 PM
stevea's Avatar
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300
Just for grins I loaded the binary image of your compilers and got the same error with your .ld file.
I got just a warning when I used no .ld file. No errors or warning when . I used the arm-elf-gcc command to link.

The .glue_7 symbol comes from the linker (!??!) and it should resolve it. There something that the linker does n't like abt your .ld.
Reply With Quote
  #4  
Old 2nd June 2008, 04:28 AM
Sune Ahlgren Offline
Registered User
 
Join Date: Sep 2005
Posts: 12
Hi again,

and thanks for helping.

True, a very strict man called Bob slapped me around a bit and closed the other thread. No hard feelings...

1)
I use RedBoot for loading my application. I just read that if RedBoot is used to load an application on my board, I should not locate the application as I try to do in the .ld file, I guess that means I can ignore the .ld file altogether to begin with. The application gets located by RedBoot when it is loaded. Is my understanding correct?

2)
Can I please have your gcc 'no warnings'-command for reference?

Thanks again
/Sune
Reply With Quote
  #5  
Old 2nd June 2008, 05:09 AM
stevea's Avatar
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300
[stevea@lycoperdon test]# ls
led.c led.h viperlite.ld
[stevea@lycoperdon test]# arm-elf-gcc ./led.c -o led
[stevea@lycoperdon test]# ls
led led.c led.h viperlite.ld
Reply With Quote
  #6  
Old 2nd June 2008, 01:23 PM
Sune Ahlgren Offline
Registered User
 
Join Date: Sep 2005
Posts: 12
I changed my linking script to:


ENTRY (main)

MEMORY
{
ram : ORIGIN = 0x00400000, LENGTH = 64M
rom : ORIGIN = 0x60000000, LENGTH = 16M
}

SECTIONS
{
data : /* Initialized data. */
{
_DataStart = . ;
*(.data)
_DataEnd = . ;
} >ram

bss : /* Uninitialized data. */
{
_BssStart = . ;
*(.bss)
_BssEnd = . ;
} >ram

text : /* The actual instructions. */
{
*(.glue_7t) *(.glue_7)
*(.text)
} >ram
}


...and now it works.

I built my GNUARM tools with the --enable-interwork argument. The book I got my .ld file from did not and I somehow think that's related with the glue_7 thing.

Thanks again for helping out. I'm new at this and just needed a shove in the right direction.

BRs
/Sune
Reply With Quote
Reply

Tags
error, gnuarm, link

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ link produces database error tashirosgt Suggestions & Feedback 2 3rd April 2009 11:05 PM
GNUARM link error Sune Ahlgren Linux Chat 1 1st June 2008 03:58 PM
GNUARM cross compiler. EABI version error mndar Linux Chat 3 2nd May 2008 04:14 AM
dynamic-link.h:57 error funkymatt Using Fedora 0 21st September 2006 06:39 PM
Link error on XOpenDisplay PompeyBlue Programming & Packaging 1 6th August 2004 11:45 AM


Current GMT-time: 22:07 (Sunday, 19-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat