public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* problems with gcc 4.7.1 and binutils 2.22
@ 2012-08-13 11:10 Vania Joloboff
  2012-08-17 15:56 ` nick clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Vania Joloboff @ 2012-08-13 11:10 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]

Hi,

We are developing software for different ARM targets
with or without operating systems
In the past, we used older versions of binutils and gcc
that we have built ourselves with essentially

configure --target=arm-unknown-elf --enable-interwork --enable-multilib

It worked fine.

But arm-unknown-elf has been deprecated and we wanted to upgrade
anyway to support new cortex-m3 and m4 platforms,
but we still want to support our old arm9 platforms

We tried to build new versions of binutils 2.22 and gcc 4.7.1 (and 0)
  and newlib with the new syntax

configure --target=arm-none-eabi --enable-interwork --enable-multilib

Then, some of our test programs do not compile any more with error

Error: selected processor does not support Thumb mode `blx r3'

However, if we build the same toolchain with

configure --target=arm-none-elf --enable-interwork --enable-multilib 
--enable-obsolete

then the code compiles again as in the good'ol days...

However we would like to move ahead and not use the --enable-obsolete option

What is the magic formula to configure binutils and gcc ?
Any idea?

I provide attached a test program that fails to compile ,

-- 

Thanks for any help
Vania Joloboff
  


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: thumb_test.c --]
[-- Type: text/x-csrc; name="thumb_test.c", Size: 3291 bytes --]

/*
 * SimSoC Initial software, Copyright © INRIA 2007, 2008, 2009, 2010, 2011
 * LGPL license version 3
 */

#include "dbg_console.h"

#ifndef NULL
#define NULL 0
#endif

int error = 0;

void test_add5() {
  uint32_t d,n;
  asm("add %0,pc,#1*4\n\t"
      "mov %1,pc"
      :"=r"(d), "=r" (n));
  if (((n+2)&~2)-2 == (d-4+2))
    print_str("add5 in thumb instructions test ok\n");
  else {
    print_str("add5 in thumb instructions test fail\n");
    ++error;
  }
}

void test_asr1() {
  uint32_t m,n,d1,d2;
  m = 0xf0000000;
  n = 1;
  asm("asr %0,%1,#32"
      :"=r"(d1)
      :"r"(m));
  asm("asr %0,%1,#32"
      :"=r"(d2)
      :"r"(n));
  if ((d1 == 0xffffffff) && (d2 == 0))
    print_str("asr1 in thumb instructions test ok\n");
  else {
    print_str("asr1 in thumb instructions test fail\n");
    ++error;
  }
}

void test_asr2() {
  uint32_t d1,d2,d3,d4;

  // asr2 Rs[7:0] = 0
  d1 = 0xf;
  asm("asr %0 ,%1"
      :"+r" (d1)
      :"r" (0xf000));

  //asr2 Rs[7:0] < 32
  d2 = 0xf;
  asm("asr %0 ,%1"
      :"+r" (d2)
      :"r" (0x2));

  //asr2 Rs[7:0] >= 32
  d3 = 0xf;
  asm("asr %0 ,%1"
      :"+r" (d3)
      :"r" (0x21));
  d4 = 0xa0000000;
  asm("asr %0 ,%1"
      :"+r" (d4)
      :"r" (0x21));

  if ((d1 == 0xf) && (d2 == 3) && (d3 == 0) && (d4 == 0xffffffff))
    print_str("asr2 in thumb instructions test ok\n");
  else {
    print_str("asr2 in thumb instructions test fail\n");
    ++error;
  }
}

void test_ldr2_str2() {
  uint32_t d1;
  uint32_t m = 0xf0;
  uint32_t n = 0xaf0;
  uint32_t d = 0xffaaff;
  asm("str %0,[%1,%2]"
      :
      :"r"(d),"r"(m),"r"(n));
  asm("ldr %0,[%1,%2]"
      :"=r"(d1)
      :"r"(m),"r"(n));
  if(d1 == 0xffaaff)
    print_str("ldr2 and str2 in thumb instructions test ok\n");
  else {
    print_str("ldr2 and str2 in thumb instructions test fail\n");
    ++error;
  }
}

void test_ldrh2_strh2() {
  uint32_t d1;
  uint32_t m = 0xf2;
  uint32_t n = 0xaf2;
  uint32_t d = 0xaaff;
  asm("strh %0,[%1,%2]"
      :
      :"r"(d),"r"(m),"r"(n));
  asm("ldrh %0,[%1,%2]"
      :"=r"(d1)
      :"r"(m),"r"(n));
  if(d1 == 0xaaff)
    print_str("ldrh2 and strh2 in thumb instructions test ok\n");
  else {
    print_str("ldrh2 and strh2 in thumb instructions test fail\n");
    ++error;
  }
}

void test_ldrsb_ldrsh() {
  uint32_t d1,d2;
  uint32_t m = 0xf2;
  uint32_t n = 0xaf2;
  uint32_t d = 0xffff;
  asm("strb %0,[%1,%2]"
      :
      :"r"(d),"r"(m),"r"(n));
  asm("ldrsb %0,[%1,%2]"
      :"=r"(d1)
      :"r"(m),"r"(n));
  asm("strh %0,[%1,%2]"
      :
      :"r"(d),"r"(m),"r"(n));
  asm("ldrsh %0,[%1,%2]"
      :"=r"(d2)
      :"r"(m),"r"(n));
  if((d1 == 0xffffffff) && (d2 == 0xffffffff))
    print_str("ldrsh and ldrsb in thumb instructions test ok\n");
  else {
    print_str("ldrsh and ldrsb in thumb instructions test fail\n");
    ++error;
  }
}

const char *hello_str = NULL;

void hello() {
  hello_str = "blx in thumb instructions test ok\n";
}

void test_blx() {
  asm("blx %0"
      :
      :"r" ((uint32_t)hello)
      :"lr");
  if (hello_str)
    print_str(hello_str);
  else {
    print_str("blx in thumb instructions test fail!\n");
    ++error;
  }
}

int main(){
  test_add5();
  test_asr1();
  test_asr2();
  test_ldr2_str2();
  test_ldrh2_strh2();
  test_ldrsb_ldrsh();
  test_blx();
  return error;
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: problems with gcc 4.7.1 and binutils 2.22
  2012-08-13 11:10 problems with gcc 4.7.1 and binutils 2.22 Vania Joloboff
@ 2012-08-17 15:56 ` nick clifton
  2012-08-23 14:53   ` Vania Joloboff
  0 siblings, 1 reply; 3+ messages in thread
From: nick clifton @ 2012-08-17 15:56 UTC (permalink / raw)
  To: Vania Joloboff; +Cc: binutils

Hi Vania,

> Error: selected processor does not support Thumb mode `blx r3'

> What is the magic formula to configure binutils and gcc ?
> Any idea?

Try:

  configure --target=arm-none-eabi --enable-interwork --enable-multilib 
--with-arch=armv5t


Cheers
   Nick

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: problems with gcc 4.7.1 and binutils 2.22
  2012-08-17 15:56 ` nick clifton
@ 2012-08-23 14:53   ` Vania Joloboff
  0 siblings, 0 replies; 3+ messages in thread
From: Vania Joloboff @ 2012-08-23 14:53 UTC (permalink / raw)
  To: nick clifton; +Cc: binutils

On 08/17/2012 11:37 PM, nick clifton wrote:
> Hi Vania,
>
>> Error: selected processor does not support Thumb mode `blx r3'
>
>> What is the magic formula to configure binutils and gcc ?
>> Any idea?
>
> Try:
>
>  configure --target=arm-none-eabi --enable-interwork --enable-multilib 
> --with-arch=armv5t
>
>
> Cheers
>   Nick
>
Thanks


-- 
-- Vania Joloboff
LIAMA European Director
Also International Project FORMES
INRIA-CNRS-CAS SIAT--Tsinghua University
Tel +86 135 1063 1405




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-23  8:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-13 11:10 problems with gcc 4.7.1 and binutils 2.22 Vania Joloboff
2012-08-17 15:56 ` nick clifton
2012-08-23 14:53   ` Vania Joloboff

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).