This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problems with gcc 4.7.1 and binutils 2.22


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


/*
 * 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;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]