public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Heikki Keränen" <heikki.keranen@finwe.fi>
To: Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
Cc: binutils@sourceware.org
Subject: Re: Linking against armlink produced ELF for armv6-m (thumb only) CPU
Date: Mon, 09 Aug 2010 18:09:00 -0000	[thread overview]
Message-ID: <4C6021C8.8090306@finwe.fi> (raw)
In-Reply-To: <1281357579.15516.9.camel@e102319-lin.cambridge.arm.com>



On 9.8.2010 15:39, Matthew Gretton-Dann wrote:
> Hi,
> 
> On Mon, 2010-08-09 at 15:09 +0300, Heikki Keränen wrote:
>> Hi,
>>
>> I have found no good solution to this problem. Can anyone help?
>>
>> We have a ROM image produced by RVCT toolchain: armlink produces .axf
>> -file which is in ELF-format. Now we would like to create an executable
>> to the RAM by using the GNU-toolchain. Those RAM-executables should of
>> course link against functions in ROM.

[snip]

>> Build finishes, but in the ld -linker prints out a following error
>> message: "Conflicting CPU architectures 11/0". Also the veneers
>> generated by the ld -linker seem to contain ARM-instructions although we
>> have a thumb-only CPU architecture (armv6-m).
> 
> Can you give some sample command lines (I don't think objects are
> necessary at the moment) please?


Here is my very simple example project I used to reproduce this issue:

----- simple_rom_rvct\simple_rom.h ---------
#ifndef SIMPLE_ROM_H
#define SIMPLE_ROM_H

int simple_rom_function(int param);

#endif // SIMPLE_ROM_H
-------------------------------------------

---- simple_rom_rvct\simple_rom.c ----------
#include "simple_rom.h"

int simple_rom_function(int param)
{
	return param + 1;
}
-------------------------------------------

----- simple_ram\simple_ram.c -------------
#include "../simple_rom/simple_rom.h"

int mainfunction(void)
{
	int result;
	result = simple_rom_function(1);
	return result;
}
------------------------------------------

----- simple_ram\simple_ram.ld -----------
MEMORY
{
    MYROM (rx) : ORIGIN = 0x10000000, LENGTH = 0x00008000
    MYRAM (rwxa) : ORIGIN = 0x30000000, LENGTH = 0xf0000000
}

SECTIONS
{
  .text : { *(.text) } >MYRAM
  .data : { *(.data) } >MYRAM
  .bss :  { *(.bss)  } >MYRAM
}
--------------------------------------------


> 
> What I am looking for are examples of how you call armcc, armlink, gcc,
> and ld.

------  RVCT build output (form uVision IDE) -------
Build target 'Target 1'
compiling simple_rom.c...
simple_rom.c: [ArmCC --show_cmdline --debug -c -osimple_rom.o
--depend=simple_rom.d --cpu=Cortex-M0 --apcs=interwork -O0
-IC:\Keil\ARM\INC -IC:\Keil\ARM\INC\ARM --omf_browse=simple_rom.crf
simple_rom.c]
linking...
simple_rom.axf: [ArmLink --show_cmdline --strict
--diag_suppress=6320,6305 --ro_base=0x0 --rw_base=0x0 --cpu=Cortex-M0
--first=__Vectors --output=simple_rom.axf --entry=Reset_Handler
--keep=.ARM.attributes --info=summarysizes simple_rom.o]
Program Size: Code=8 RO-data=0 RW-data=0 ZI-data=0
FromELF: creating hex file...
"simple_rom.axf" - 0 Error(s), 0 Warning(s).
----------------------------------------------------


------- GNU toolchain output (from Eclipse) -------
make all
Building file: simple_ram.c
Invoking: arm-none-eabi-gcc C Compiler
arm-none-eabi-gcc -Os -Wall -c -fmessage-length=0 -MD -MF"simple_ram.d"
-MT"simple_ram.d" -mcpu=cortex-m0 -fpic -mthumb -o"simple_ram.o"
"simple_ram.c"
Finished building: simple_ram.c

Building target: simple_ram.elf
Invoking: arm-none-eabi-gcc C Linker
arm-none-eabi-gcc -T"simple_ram.ld" -nostartfiles
-Wl,--architecture=armv6-m --pic-executable -mcpu=cortex-m0
--strip-debug  -o"simple_ram.elf"  ./simple_ram.o
-Wl,--just-symbols=../simple_rom_rvct/simple_rom.axf
c:/msys/1.0/home/heikki/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.5.0/../../../../arm-none-eabi/bin/ld.exe:
error: ../simple_rom_rvct/simple_rom.axf: Conflicting CPU architectures 11/0
Finished building target: simple_ram.elf
-------------------------------------------------

> 
> Can you also give the results of readelf -A when run on the armlink
> produced image and also one of the gcc produced objects you are trying
> to link against?

D:\simple_rom_rvct>arm-none-eabi-readelf -A simple_rom.axf

  < NOTE: no output here, since .axf does not contain .ARM.attributes? >

D:\simple_ram>arm-none-eabi-readelf -A simple_ram.o
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "CORTEX-M0"
  Tag_CPU_arch: v6-M
  Tag_CPU_arch_profile: Microcontroller
  Tag_THUMB_ISA_use: Thumb-1
  Tag_ABI_PCS_wchar_t: 4
  Tag_ABI_FP_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align_needed: 8-byte
  Tag_ABI_align_preserved: 8-byte, except leaf SP
  Tag_ABI_enum_size: small
  Tag_ABI_optimization_goals: Aggressive Size
  Tag_DIV_use: Not allowed

> 
> What version of RVCT are you using (what is the result of armlink
> --vsn)?

ARM Linker, RVCT4.0 [Build 728] [Standard]

[snip]

> If you can answer the questions above we might be able to give a good
> answer to your question.
> 
> Thanks,
> 
> Matt

Here should be all the information you asked. I can provide additional
details if required. I have tried a large number of compiler and linker
options so some of those options I used are probably unnecessary or stupid.

Thanks for taking a look into this issue,

	Heikki K.

  reply	other threads:[~2010-08-09 15:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-09 12:39 Heikki Keränen
2010-08-09 15:42 ` Matthew Gretton-Dann
2010-08-09 18:09   ` Heikki Keränen [this message]
2010-08-10 21:17     ` Matthew Gretton-Dann
2011-07-05 18:21       ` GusSabina
2011-07-06 14:58         ` Matthew Gretton-Dann
     [not found]           ` <1310448299.35910.YahooMailRC@web34301.mail.mud.yahoo.com>
2011-07-12 22:33             ` Matthew Gretton-Dann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C6021C8.8090306@finwe.fi \
    --to=heikki.keranen@finwe.fi \
    --cc=binutils@sourceware.org \
    --cc=matthew.gretton-dann@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).