2005-02-17 09:39 PM
Excluding unreference code with GNU ARM tool-chain
2004-11-03 11:15 PM
Hi,
I was wondering if anyone could help! I'm trying to build a project that excludes unreference code! To do this I'm using a combination of -ffunction-sections and --gc-sections, with the arm-elf-gcc and arm-elf-ld, respectively. Although the -ffunction-sections seems to work (in that I can place each function into it own section), the --gc-sections seems to then exclude all of the code, including this in object files that weren't built with -ffunction-sections! Does anyone know if the --gc-sections option works with the arm-elf-ld version 2.13.1. I'd be grateful of any help!!!2004-11-04 04:03 AM
Hi,
I'm sorry I don't know help you but I think you can help me. I would like to use STR71x eval.board but I cannot buy the RVDK tools. I see you're using the free tool gc. Could you tell me which JTAG-TO-USB hardware part I have to build to use it with this free C compiler and debugger tools? Bye and tks.2004-11-04 08:33 AM
If ld finds no reference to a section it will not include it - to overcome this use the KEEP keyword in the linker script.
Also the company I work for Anglia (www.angliac.com) is just releasing a gcc based toolchain and a STR71x dev board (with detachable jtag interface), the gcc toolchain (v3.4.1) includes an IDE to wrap gcc and debugging using gdb insight. The toolchain is the standard gcc release except - newlib has been built with -ffunction-sections and -fdata-sections to reduce code size. Also STR71x lib has been included as a pre built library. The toolchain is free but requires user registration. Regards sjo[ This message was edited by: sjo on 04-11-2004 22:05 ]2004-11-11 01:47 AM
Do you have any more info on this Dev Board (Timescale, Price,etc ?) It sounds very interesting. How does it compare with the STR71x Eval ?
rjrQuote:
On 2004-11-04 22:03, sjo wrote: If ld finds no reference to a section it will not include it - to overcome this use the KEEP keyword in the linker script. Also the company I work for Anglia (www.angliac.com) is just releasing a gcc based toolchain and a STR71x dev board (with detachable jtag interface), the gcc toolchain (v3.4.1) includes an IDE to wrap gcc and debugging using gdb insight. The toolchain is the standard gcc release except - newlib has been built with -ffunction-sections and -fdata-sections to reduce code size. Also STR71x lib has been included as a pre built library. The toolchain is free but requires user registration. Regards sjo [ This message was edited by: sjo on 04-11-2004 22:05 ]2004-11-15 11:03 PM
Have a look at
http://www.angliac.com/newsarchive/828.asp Toolchain/ide is available now, board available very very soon. Regards sjo2004-12-01 10:44 PM
Sorry it's taken me so long to reply - but we're using the Ashling tools, which are based on the gnu elf tool-chain. And it runs from AsIDE, a windows dos command shell assuming cygwin is installed, and I assume from a cygwin bash shell (but have tried it!). I think the basic ARM gnu tool-chain is free, and is probably downloadable as a package from the cygwin site - although I haven't tried to do that! The Ashling stuff cost just over 2000 euros.
The problem I had linking code dependent code was solved by using the directive KEEP in the link definition file, eg. SECTIONS { .text: { /* links all dependent function sections associated with -ffunction-sections */ *(.text.*) /* keeps all other sections, i.e. where -ffunction-sections isn't used to compile an object *./ KEEP(*(.text)) } }2004-12-02 09:25 PM
chris,
Doing that will defeat the object of removing unwanted sections. The KEEP should be put round sections which have no reference, eg. reset vectors, ctrs and any init routines. KEEP(*(.vectors)) I have attached a linker script I use, which is taken from our free str7 toolchain. Regards sjo ________________ Attachments : ram.ld : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtE9&d=%2Fa%2F0X0000000aKV%2F4xdgyjXgn1CtqHzA6VtcgYpvPDN96hspkrJ5q_MKDqE&asPdf=false2005-02-17 09:32 PM
I cannot find this KEEP() macro documented in the ld manual at
http://www.gnu.org/software/binutils/manual/ld-2.9.1/ld.html
Are there a some other place where a more up-to-date manual is present? /Beach/2005-02-17 09:39 PM
You are looking at a really old ld manual
http://sources.redhat.com/binutils/docs-2.15/ld/Input-Section-Keep.html#Input%20Section%20Keep is the latest for binutils 2.15 Regards sjo