Problem with the linker file

This is a discussion on Problem with the linker file within the Tech Board forums, part of the Community Boards category; Hi, I started learning to program embedded system for my project. I use a board called viper-lite which works on ...

  1. #1
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682

    Problem with the linker file

    Hi,

    I started learning to program embedded system for my project. I use a board called viper-lite which works on PXA255 RISC based processor which contains 64Mb of RAM and 16MB of flash memory

    I wrote a code which actually blink a LED with following some instruct from the book. And i wrote a liker script for that blinking problem which was giving in the book. But when i try to link the object file with the linker everything goes fine.

    But when i try to load the exe to the target board it gives me an error.
    Code:
    C*** Abort! Attempt to load ELF data to address: 0x00000000 which is not in RAM
    xyzModem - CRC mode, 8(SOH)/2(STX)/0(CAN) packets, 5 retrie
    which looks like that its a linker problem. And here is the linker file which i wrote
    Code:
    ENTRY (main)
    
    MEMORY
    {
        ram : ORIGIN = 0x00400000, LENGTH = 64M
        rom : ORIGIN = 0x60000000, LENGTH = 16M
    }
    
    SECTIONS
    {
        data :
        {
            _DataStart = . ;
            *(.data)
            _DataEnd   = . ;
        } >ram
    
        bss :
        {
            _BssStart = . ;
            *(.bss)
            _BssEnd   = . ;
        } >ram
    
        text :
        {
            *(.txt)
        } >ram
    }
    Can anyone know whats the problem, may be some one who have already work on viper lite.

    thank you

    ssharish2005
    Last edited by ssharish2005; 04-22-2007 at 02:49 PM.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,590
    Why is the .text in ram rather than rom?

    Check the map file to see what other sections there are in the image. Anything which isn't matching text, data or bss is going to start at 0.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    Thanks Salem for the reply.

    I use Redboot to download the image file from the system to the target board uisng load command. Would that actual loads the command on the RAM rather than ROM. Is that the reason why the it is been specified as RAM.

    And i even checked the authors linker files as well. Even he has specified as ram

    Code:
    ENTRY (main)
    
    MEMORY
    {
        ram : ORIGIN = 0x00400000, LENGTH = 64M
        rom : ORIGIN = 0x60000000, LENGTH = 16M    /* Change to LENGTH = 32M for larger flash. */
    }
    
    SECTIONS
    {
        data :                              /* Initialized data. */ 
        { 
            _DataStart = . ; 
            *(.data) 
            _DataEnd   = . ;
    
        } >ram
         
        bss :                               /* Uninitialized data. */
        { 
            _BssStart = . ;
            *(.bss) 
            _BssEnd   = . ;
        } >ram
         
        text :                              /* The actual instructions. */
        { 
            *(.text) 
        } >ram
    }
    It makes sense why it should be rom. Salem i am not pretty sure of what u are trying to says here.

    Check the map file to see what other sections there are in the image. Anything which isn't matching text, data or bss is going to start at 0.
    This is is my map file

    Code:
    Memory Configuration
    
    Name             Origin             Length             Attributes
    ram              0x00400000         0x04000000
    rom              0x60000000         0x01000000
    *default*        0x00000000         0xffffffff
    
    Linker script and memory map
    
    
    data            0x00400000        0x0
                    0x00400000                _DataStart = .
     *(.data)
                    0x00400000                _DataEnd = .
    
    bss             0x00400000        0x0
                    0x00400000                _BssStart = .
     *(.bss)
                    0x00400000                _BssEnd = .
    
    text            0x00400000      0x148
     *(.text)
     .text          0x00400000       0xac led.o
                    0x00400060                ledToggle
                    0x00400000                ledInit
     .text          0x004000ac       0x9c blink.o
                    0x0040010c                main
                    0x004000ac                delay_ms
    LOAD led.o
    LOAD blink.o
    OUTPUT(blink.exe elf32-littlearm)
    ....
    Thanks Salem

    ssharish2005
    Last edited by ssharish2005; 04-24-2007 at 09:43 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. read from file problem
    By Martin Kovac in forum C Programming
    Replies: 1
    Last Post: 04-13-2009, 08:33 AM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. Subtle(?) File I/O Problem
    By cecomp64 in forum C Programming
    Replies: 9
    Last Post: 07-16-2008, 11:39 AM
  4. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  5. Rename file problem
    By Emporio in forum C Programming
    Replies: 2
    Last Post: 06-05-2002, 09:36 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21