GCC version to use for ARM7 demo

jamessteward wrote on Tuesday, August 26, 2008:

Hi,

Just wondering if I should be using a specific version of GCC to build some of the apps?

Executing make in FreeRTOS_V5.0.3/Demo/lwIP_Demo_Rowley_ARM7 after fixing the compiler tools prefix in the Makefile (and had to rename makefile to Makefile),

P=arm-none-linux-gnueabi-
CC=$(P)gcc
OBJCOPY=$(P)objcopy
ARCH=$(P)ar

$ arm-none-linux-gnueabi-gcc --version
arm-none-linux-gnueabi-gcc (CodeSourcery Sourcery G++ Lite 2007q1-10) 4.2.0 20070413 (prerelease)

After a few files are processed, I get this…
arm-none-linux-gnueabi-gcc -I. -I./EMAC -I…/Common/include -I./USB -I./lwip-1.1.0/src/include -I./lwip-1.1.0/contrib/port/FreeRTOS/AT91SAM7X -I…/…/Source/include -I…/…/Source/portable/GCC/ARM7_AT91SAM7S -I./lwip-1.1.0/src/include/ipv4 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wno-strict-aliasing -D SAM7_GCC -D THUMB_INTERWORK -mthumb-interwork -mcpu=arm7tdmi -Tatmel-rom.ld -g -O0 -fomit-frame-pointer …/…/Source/portable/GCC/ARM7_AT91SAM7S/portISR.o EMAC/SAM7_EMAC_ISR.o USB/USBIsr.o Cstartup_SAM7.o …/…/Source/portable/MemMang/heap_2.o ParTest/ParTest.o main.o …/Common/Minimal/flash.o …/Common/Minimal/BlockQ.o …/Common/Minimal/integer.o …/Common/Minimal/PollQ.o …/Common/Minimal/semtest.o BasicWEB.o USB/USB-CDC.o lwip-1.1.0/src/core/tcp_out.o lwip-1.1.0/src/core/inet.o lwip-1.1.0/src/core/mem.o lwip-1.1.0/src/core/memp.o lwip-1.1.0/src/core/netif.o lwip-1.1.0/src/core/pbuf.o lwip-1.1.0/src/core/raw.o lwip-1.1.0/src/core/stats.o lwip-1.1.0/src/core/sys.o lwip-1.1.0/src/core/tcp.o lwip-1.1.0/src/core/tcp_in.o lwip-1.1.0/src/core/ipv4/ip.o lwip-1.1.0/src/core/ipv4/ip_addr.o lwip-1.1.0/src/core/ipv4/icmp.o lwip-1.1.0/src/api/tcpip.o lwip-1.1.0/src/api/api_msg.o lwip-1.1.0/src/api/err.o lwip-1.1.0/src/api/api_lib.o lwip-1.1.0/src/netif/etharp.o lwip-1.1.0/contrib/port/FreeRTOS/AT91SAM7X/sys_arch.o lwip-1.1.0/src/netif/ethernetif.o EMAC/SAM7_EMAC.o lwip-1.1.0/src/core/udp.o lwip-1.1.0/src/core/ipv4/ip_frag.o …/…/Source/tasks.o …/…/Source/queue.o …/…/Source/list.o …/…/Source/portable/GCC/ARM7_AT91SAM7S/port.o -nostartfiles boot.s -Xlinker -ortosdemo.elf -Xlinker -M -Xlinker -Map=rtosdemo.map
/opt/codesourcery/arm-2007q1/bin/…/lib/gcc/arm-none-linux-gnueabi/4.2.0/…/…/…/…/arm-none-linux-gnueabi/bin/ld: error: no memory region specified for loadable section `.interp’
collect2: ld returned 1 exit status
make: *** [rtosdemo.elf] Error 1

I don’t think I should have to “frig” with the linker script for a proved demo, so I assume I’ve got a compiler that is too new maybe?

Regards,
James.

jamessteward wrote on Tuesday, August 26, 2008:

Ok, I’ve just got it to compile cleanly with a very old toolchain from gnuarm.com.  arm-elf-gcc (GCC) 3.4.3.

Does everyone here, building code for ARM, still use this?

JS.

davedoors wrote on Tuesday, August 26, 2008:

If you are using Windows as your host then most people seem to use Yagarto now.

jamessteward wrote on Tuesday, August 26, 2008:

I use Linux, specifically Ubuntu 7.10 at the moment.

ben_fnr wrote on Tuesday, August 26, 2008:

I have used :-

gcc (CodeSourcery Sourcery G++ Lite 2007q3-53) 4.2.1

for building a luminary demo with no problems.

I also have used gnuarm v 4.1.1. both under Linux (Ubuntu)

It looks to me that something must have changed with the linker, or perhaps gnuarm just ignores the error.

Have only tried the ST & Luminary demos so I can’t comment on the other demos.

Ben

david_farrell wrote on Tuesday, August 26, 2008:

To use you vernacular you "frigged" with the compiler/environment  Rowley? Codesourcery? you
have to frig with the startup files, scripts, portable routines. etc.

I’ using CodeSourcery personal edition, 4.2.3. G++ 4.2-173

The linker script I use is as follows

/* ----------------------------------------------------------------------------
*         ATMEL Microcontroller Software Support  -  ROUSSET  -
* ----------------------------------------------------------------------------
* Copyright (c) 2006, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaiimer below.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer below in the documentation and/or
* other materials provided with the distribution.
*
* Atmel’s name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL “AS IS” AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ----------------------------------------------------------------------------
*/

/*------------------------------------------------------------------------------
*      Linker script for running in internal Flash on the AT91SAM7X256.
*----------------------------------------------------------------------------*/

OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(start)

MEMORY
{
    sram (W!RX) : ORIGIN = 0x200000, LENGTH = 0x10000
    flash (RX) : ORIGIN = 0x100000, LENGTH = 0x40000
}

/* romvectors by DJF */

SECTIONS
{     
    .fixed :
    {
        . = ALIGN(4);
        *(.romvectors)
        _sfixed = .;
        *(.text*)
        *(.rodata*)
        . = ALIGN(4);
        _efixed = .;
    } >flash

    .relocate : AT (_efixed)
    {
        . = ALIGN(4);
        _srelocate = .;
        *(.ramfunc)
        *(.data)
        . = ALIGN(4);
        _erelocate = .;
    } >sram

    .bss (NOLOAD) : {
        _szero = .;
        *(.bss)
        _ezero = .;
    } >sram
   
    _sstack = 0x210000;
}
end = .;

David.

jamessteward wrote on Wednesday, August 27, 2008:

Well, I was trying to compile some demos for GCC, with GCC, so I did not "frig" with the compiler/env exactly.

I ended up getting a successful build with an old 3.4.3(?) gcc.

So it looks like the maintainers of the particular demos I tried, have not maintained them to work with newer GCCs.  That’s fine, I was asking what version of GCC I should use, assuming that the linker script requirements had changed in newer virgins (versions).

Thanks for your sample linker script, I’ll give it a whirl when I get back to the office.

Regards,
James.

rtel wrote on Wednesday, August 27, 2008:

I just tried building a clean checkout with YAGARTO GCC V4.2.2 and it built with *no* errors or warnings.  Doing the same with CodeSourcery V4.2.0 (Prerelease) [an older GCC version] I get the error "error: no memory region specified for loadable section `.ARM.extab", so it is not a GCC version problem but a GCC build issue.  If you want to use CodeSourcery I should check out the linker scripts they provide to see how to setup the extab section.

I originally used the GNUARM GCC builds for the ARM7 ports and demos and know that people using WinARM GCC builds had similar problems when using the same linker scripts.  It seems the different builds were expecting the linker scripts to define different symbols.

Regards.

jamessteward wrote on Wednesday, August 27, 2008:

Thanks Richard.

I’ll check out Yagarto.  I got an error about a different section (.interp) from my CodeSourcery attempt, also 4.2.0 prerelease.  So there’s certainly something screwy going on there.

Cheers
James.

david_farrell wrote on Friday, August 29, 2008:

I posted my linker script but obviously it is all about the combination of the Makefile, linker script and startup code.  If you are still having trouble I can post the others.  My Makefile is based on Atmels and I really dislike it but it works and I haven’t the ambition to change it yet.  The startup file is also mostly Atmels which makes some assumptions about how much of their library you use.  One I get more time I plan on considerable cleanup with my use of these and submitting to Richard.  My goal is to be compatible with the Atmel boards/components/peripheral layout so various Atmel parts are compatible with the same FreeRTOS project.