[PATCH, RX] Add target rx-*-linux

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH, RX] Add target rx-*-linux

Yoshinori Sato
Hello.

I want added rx-*-linux target.
rx-elf is compatible Renesas toolchain. It different standard ELF format.
rx-*-linux have standard ELF format for RX processor.

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 34b0465ba4..28439fb20c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2018-07-30  Yoshinori Sato  <[hidden email]>
+
+ * config.bfd: Add rx-*-linux.
+ * congigure.ac: Likewise.
+ * elf32-rx.c (rx_linux_object_p): New function.
+ (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME)
+ (elf_backend_object_p, elf32_bed): Define rx-*-linux.
+ * targets.c: Add rx_elf32_linux_le_vec.
+
 2018-07-27  John Darrington  <[hidden email]>
 
  * elf32-s12z.c (ELF_TARGET_ID): Don't define.
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 6391f35684..4ab636c62a 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -1196,6 +1196,10 @@ case "${targ}" in
     targ_selvecs="rx_elf32_be_vec rx_elf32_le_vec rx_elf32_be_ns_vec"
     targ_underscore=yes
     ;;
+  rx-*-linux*)
+    targ_defvec=rx_elf32_linux_le_vec
+    targ_selvecs="rx_elf32_linux_le_vec"
+    ;;
 
   s390-*-linux*)
     targ_defvec=s390_elf32_vec
diff --git a/bfd/configure.ac b/bfd/configure.ac
index c6193cd8a4..d18b726a35 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -610,6 +610,7 @@ do
     rx_elf32_be_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
     rx_elf32_be_ns_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
     rx_elf32_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
+    rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
     s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
     s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
     score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index 1f70b97a34..ddcf5e980f 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -3310,6 +3310,14 @@ rx_elf_object_p (bfd * abfd)
 
   return TRUE;
 }
+
+static bfd_boolean
+rx_linux_object_p (bfd * abfd)
+{
+  bfd_default_set_arch_mach (abfd, bfd_arch_rx,
+           elf32_rx_machine (abfd));
+  return TRUE;
+}
 
 
 #ifdef DEBUG
@@ -4059,3 +4067,18 @@ rx_additional_link_map_text (bfd *obfd, struct bfd_link_info *info, FILE *mapfil
 #define elf32_bed elf32_rx_be_ns_bed
 
 #include "elf32-target.h"
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM rx_elf32_linux_le_vec
+#undef  TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-rx-linux"
+#undef  TARGET_BIG_SYM
+#undef  TARGET_BIG_NAME
+
+#undef  elf_backend_object_p
+#define elf_backend_object_p rx_linux_object_p
+#undef  elf_symbol_leading_char
+#undef elf32_bed
+#define elf32_bed elf32_rx_le_linux_bed
+
+#include "elf32-target.h"
diff --git a/bfd/targets.c b/bfd/targets.c
index 531703d226..019b9002bf 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -775,6 +775,7 @@ extern const bfd_target rs6000_xcoff_vec;
 extern const bfd_target rx_elf32_be_vec;
 extern const bfd_target rx_elf32_be_ns_vec;
 extern const bfd_target rx_elf32_le_vec;
+extern const bfd_target rx_elf32_linux_le_vec;
 extern const bfd_target s390_elf32_vec;
 extern const bfd_target s390_elf64_vec;
 extern const bfd_target score_elf32_be_vec;
diff --git a/gas/ChangeLog b/gas/ChangeLog
index f2a0c6a408..5077609109 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-30  Yoshinori Sato  <[hidden email]>
+
+ * configure.tgt: Add rx-*-linux.
+ * config/tc-rx.h (TARGET_FORMAT): Add "elf32-rx-linux".
+
 2018-07-29  John David Anglin  <[hidden email]>
 
  * config/tc-hppa.c: Include "struc-symbol.h".
diff --git a/gas/config/tc-rx.h b/gas/config/tc-rx.h
index bf1f283d3d..78b2bedc9f 100644
--- a/gas/config/tc-rx.h
+++ b/gas/config/tc-rx.h
@@ -31,7 +31,11 @@ extern int target_big_endian;
 /* Instruction bytes are big endian, data bytes can be either.  */
 #define TARGET_BYTES_BIG_ENDIAN 0
 
+#ifndef TE_LINUX
 #define TARGET_FORMAT (target_big_endian ? "elf32-rx-be" : "elf32-rx-le")
+#else
+#define TARGET_FORMAT "elf32-rx-linux"
+#endif
 
 /* We don't need to handle .word strangely.  */
 #define WORKING_DOT_WORD
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 6df7dea31f..1122430104 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -361,6 +361,8 @@ case ${generic_target} in
 
   riscv*-*-*) fmt=elf endian=little ;;
 
+  rx-*-linux*) fmt=elf em=linux ;;
+
   s390-*-linux-*) fmt=elf em=linux ;;
   s390-*-tpf*) fmt=elf ;;

--
Yosinori Sato
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Oleg Endo
Hi,

I've been using RX myself for a while and I'm wondering where this is
coming from or where this is going?

The biggest RX MCU device as of today has 4 MB ROM and 512 RAM.
 External memory can be added to these devices, but it seems
impractically slow for general purpose use.  So I wonder, what kind of
Linux is this?

Any information is highly appreciated.

Cheers,
Oleg

On Mon, 2018-07-30 at 17:58 +0900, Yoshinori Sato wrote:

> Hello.
>
> I want added rx-*-linux target.
> rx-elf is compatible Renesas toolchain. It different standard ELF
> format.
> rx-*-linux have standard ELF format for RX processor.
>
> diff --git a/bfd/ChangeLog b/bfd/ChangeLog
> index 34b0465ba4..28439fb20c 100644
> --- a/bfd/ChangeLog
> +++ b/bfd/ChangeLog
> @@ -1,3 +1,12 @@
> +2018-07-30  Yoshinori Sato  <[hidden email]>
> +
> + * config.bfd: Add rx-*-linux.
> + * congigure.ac: Likewise.
> + * elf32-rx.c (rx_linux_object_p): New function.
> + (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME)
> + (elf_backend_object_p, elf32_bed): Define rx-*-linux.
> + * targets.c: Add rx_elf32_linux_le_vec.
> +
>  2018-07-27  John Darrington  <[hidden email]>
>  
>   * elf32-s12z.c (ELF_TARGET_ID): Don't define.
> diff --git a/bfd/config.bfd b/bfd/config.bfd
> index 6391f35684..4ab636c62a 100644
> --- a/bfd/config.bfd
> +++ b/bfd/config.bfd
> @@ -1196,6 +1196,10 @@ case "${targ}" in
>      targ_selvecs="rx_elf32_be_vec rx_elf32_le_vec
> rx_elf32_be_ns_vec"
>      targ_underscore=yes
>      ;;
> +  rx-*-linux*)
> +    targ_defvec=rx_elf32_linux_le_vec
> +    targ_selvecs="rx_elf32_linux_le_vec"
> +    ;;
>  
>    s390-*-linux*)
>      targ_defvec=s390_elf32_vec
> diff --git a/bfd/configure.ac b/bfd/configure.ac
> index c6193cd8a4..d18b726a35 100644
> --- a/bfd/configure.ac
> +++ b/bfd/configure.ac
> @@ -610,6 +610,7 @@ do
>      rx_elf32_be_vec)  tb="$tb elf32-rx.lo elf32.lo
> $elf" ;;
>      rx_elf32_be_ns_vec)  tb="$tb elf32-rx.lo elf32.lo
> $elf" ;;
>      rx_elf32_le_vec)  tb="$tb elf32-rx.lo elf32.lo
> $elf" ;;
> +    rx_elf32_linux_le_vec)  tb="$tb elf32-rx.lo elf32.lo
> $elf" ;;
>      s390_elf32_vec)  tb="$tb elf32-s390.lo elf32.lo
> $elf" ;;
>      s390_elf64_vec)  tb="$tb elf64-s390.lo elf64.lo
> $elf"; target_size=64 ;;
>      score_elf32_be_vec)  tb="$tb elf32-score.lo
> elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
> diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
> index 1f70b97a34..ddcf5e980f 100644
> --- a/bfd/elf32-rx.c
> +++ b/bfd/elf32-rx.c
> @@ -3310,6 +3310,14 @@ rx_elf_object_p (bfd * abfd)
>  
>    return TRUE;
>  }
> +
> +static bfd_boolean
> +rx_linux_object_p (bfd * abfd)
> +{
> +  bfd_default_set_arch_mach (abfd, bfd_arch_rx,
> +           elf32_rx_machine (abfd));
> +  return TRUE;
> +}
>   
>  
>  #ifdef DEBUG
> @@ -4059,3 +4067,18 @@ rx_additional_link_map_text (bfd *obfd, struct
> bfd_link_info *info, FILE *mapfil
>  #define elf32_bed elf32_rx_be_ns_bed
>  
>  #include "elf32-target.h"
> +
> +#undef TARGET_LITTLE_SYM
> +#define TARGET_LITTLE_SYM rx_elf32_linux_le_vec
> +#undef  TARGET_LITTLE_NAME
> +#define TARGET_LITTLE_NAME "elf32-rx-linux"
> +#undef  TARGET_BIG_SYM
> +#undef  TARGET_BIG_NAME
> +
> +#undef  elf_backend_object_p
> +#define elf_backend_object_p rx_linux_object_
> p
> +#undef  elf_symbol_leading_char
> +#undef elf32_bed
> +#define elf32_bed  elf32_rx_le
> _linux_bed
> +
> +#include "elf32-target.h"
> diff --git a/bfd/targets.c b/bfd/targets.c
> index 531703d226..019b9002bf 100644
> --- a/bfd/targets.c
> +++ b/bfd/targets.c
> @@ -775,6 +775,7 @@ extern const bfd_target rs6000_xcoff_vec;
>  extern const bfd_target rx_elf32_be_vec;
>  extern const bfd_target rx_elf32_be_ns_vec;
>  extern const bfd_target rx_elf32_le_vec;
> +extern const bfd_target rx_elf32_linux_le_vec;
>  extern const bfd_target s390_elf32_vec;
>  extern const bfd_target s390_elf64_vec;
>  extern const bfd_target score_elf32_be_vec;
> diff --git a/gas/ChangeLog b/gas/ChangeLog
> index f2a0c6a408..5077609109 100644
> --- a/gas/ChangeLog
> +++ b/gas/ChangeLog
> @@ -1,3 +1,8 @@
> +2018-07-30  Yoshinori Sato  <[hidden email]>
> +
> + * configure.tgt: Add rx-*-linux.
> + * config/tc-rx.h (TARGET_FORMAT): Add "elf32-rx-linux".
> +
>  2018-07-29  John David Anglin  <[hidden email]>
>  
>   * config/tc-hppa.c: Include "struc-symbol.h".
> diff --git a/gas/config/tc-rx.h b/gas/config/tc-rx.h
> index bf1f283d3d..78b2bedc9f 100644
> --- a/gas/config/tc-rx.h
> +++ b/gas/config/tc-rx.h
> @@ -31,7 +31,11 @@ extern int target_big_endian;
>  /* Instruction bytes are big endian, data bytes can be either.  */
>  #define TARGET_BYTES_BIG_ENDIAN 0
>  
> +#ifndef TE_LINUX
>  #define TARGET_FORMAT (target_big_endian ? "elf32-rx-be" : "elf32-
> rx-le")
> +#else
> +#define TARGET_FORMAT "elf32-rx-linux"
> +#endif
>  
>  /* We don't need to handle .word strangely.  */
>  #define WORKING_DOT_WORD
> diff --git a/gas/configure.tgt b/gas/configure.tgt
> index 6df7dea31f..1122430104 100644
> --- a/gas/configure.tgt
> +++ b/gas/configure.tgt
> @@ -361,6 +361,8 @@ case ${generic_target} in
>  
>    riscv*-*-*) fmt=elf endian=little
> ;;
>  
> +  rx-*-linux*) fmt=elf em=linux ;;
> +
>    s390-*-linux-*) fmt=elf em=linux ;;
>    s390-*-tpf*) fmt=elf ;;
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Yoshinori Sato
Previuos mail rejected MTA.
Try resend.

On Mon, 30 Jul 2018 22:02:54 +0900,
Oleg Endo wrote:

>
> Hi,
>
> I've been using RX myself for a while and I'm wondering where this is
> coming from or where this is going?
>
> The biggest RX MCU device as of today has 4 MB ROM and 512 RAM.
>  External memory can be added to these devices, but it seems
> impractically slow for general purpose use.  So I wonder, what kind of
> Linux is this?

It standrad linux kernel.

My target is RX62N + 16MByte external memory.
I think that connecting with a 32 bit bus is not so slow.
Also, since the code size is small, I think the influence of memory speed
is relaxed.

I think that it is 10% smaller than other CPUs.
yo-satoh@yo-satoh-debian:~/linux (rx)$ rx-unknown-linux-size vmlinux
   text   data    bss    dec    hex filename
 801156  68556 164568 1034280  fc828 vmlinux

> Any information is highly appreciated.
>
> Cheers,
> Oleg
>
> On Mon, 2018-07-30 at 17:58 +0900, Yoshinori Sato wrote:
> > Hello.
> >
> > I want added rx-*-linux target.
> > rx-elf is compatible Renesas toolchain. It different standard ELF
> > format.
> > rx-*-linux have standard ELF format for RX processor.
> >
> > diff --git a/bfd/ChangeLog b/bfd/ChangeLog
> > index 34b0465ba4..28439fb20c 100644
> > --- a/bfd/ChangeLog
> > +++ b/bfd/ChangeLog
> > @@ -1,3 +1,12 @@
> > +2018-07-30  Yoshinori Sato  <[hidden email]>
> > +
> > + * config.bfd: Add rx-*-linux.
> > + * congigure.ac: Likewise.
> > + * elf32-rx.c (rx_linux_object_p): New function.
> > + (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME)
> > + (elf_backend_object_p, elf32_bed): Define rx-*-linux.
> > + * targets.c: Add rx_elf32_linux_le_vec.
> > +
> >  2018-07-27  John Darrington  <[hidden email]>
> >  
> >   * elf32-s12z.c (ELF_TARGET_ID): Don't define.
> > diff --git a/bfd/config.bfd b/bfd/config.bfd
> > index 6391f35684..4ab636c62a 100644
> > --- a/bfd/config.bfd
> > +++ b/bfd/config.bfd
> > @@ -1196,6 +1196,10 @@ case "${targ}" in
> >      targ_selvecs="rx_elf32_be_vec rx_elf32_le_vec
> > rx_elf32_be_ns_vec"
> >      targ_underscore=yes
> >      ;;
> > +  rx-*-linux*)
> > +    targ_defvec=rx_elf32_linux_le_vec
> > +    targ_selvecs="rx_elf32_linux_le_vec"
> > +    ;;
> >  
> >    s390-*-linux*)
> >      targ_defvec=s390_elf32_vec
> > diff --git a/bfd/configure.ac b/bfd/configure.ac
> > index c6193cd8a4..d18b726a35 100644
> > --- a/bfd/configure.ac
> > +++ b/bfd/configure.ac
> > @@ -610,6 +610,7 @@ do
> >      rx_elf32_be_vec)  tb="$tb elf32-rx.lo elf32.lo
> > $elf" ;;
> >      rx_elf32_be_ns_vec)  tb="$tb elf32-rx.lo elf32.lo
> > $elf" ;;
> >      rx_elf32_le_vec)  tb="$tb elf32-rx.lo elf32.lo
> > $elf" ;;
> > +    rx_elf32_linux_le_vec)  tb="$tb elf32-rx.lo elf32.lo
> > $elf" ;;
> >      s390_elf32_vec)  tb="$tb elf32-s390.lo elf32.lo
> > $elf" ;;
> >      s390_elf64_vec)  tb="$tb elf64-s390.lo elf64.lo
> > $elf"; target_size=64 ;;
> >      score_elf32_be_vec)  tb="$tb elf32-score.lo
> > elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
> > diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
> > index 1f70b97a34..ddcf5e980f 100644
> > --- a/bfd/elf32-rx.c
> > +++ b/bfd/elf32-rx.c
> > @@ -3310,6 +3310,14 @@ rx_elf_object_p (bfd * abfd)
> >  
> >    return TRUE;
> >  }
> > +
> > +static bfd_boolean
> > +rx_linux_object_p (bfd * abfd)
> > +{
> > +  bfd_default_set_arch_mach (abfd, bfd_arch_rx,
> > +           elf32_rx_machine (abfd));
> > +  return TRUE;
> > +}
> >   
> >  
> >  #ifdef DEBUG
> > @@ -4059,3 +4067,18 @@ rx_additional_link_map_text (bfd *obfd, struct
> > bfd_link_info *info, FILE *mapfil
> >  #define elf32_bed elf32_rx_be_ns_bed
> >  
> >  #include "elf32-target.h"
> > +
> > +#undef TARGET_LITTLE_SYM
> > +#define TARGET_LITTLE_SYM rx_elf32_linux_le_vec
> > +#undef  TARGET_LITTLE_NAME
> > +#define TARGET_LITTLE_NAME "elf32-rx-linux"
> > +#undef  TARGET_BIG_SYM
> > +#undef  TARGET_BIG_NAME
> > +
> > +#undef  elf_backend_object_p
> > +#define elf_backend_object_p rx_linux_object_
> > p
> > +#undef  elf_symbol_leading_char
> > +#undef elf32_bed
> > +#define elf32_bed  elf32_rx_le
> > _linux_bed
> > +
> > +#include "elf32-target.h"
> > diff --git a/bfd/targets.c b/bfd/targets.c
> > index 531703d226..019b9002bf 100644
> > --- a/bfd/targets.c
> > +++ b/bfd/targets.c
> > @@ -775,6 +775,7 @@ extern const bfd_target rs6000_xcoff_vec;
> >  extern const bfd_target rx_elf32_be_vec;
> >  extern const bfd_target rx_elf32_be_ns_vec;
> >  extern const bfd_target rx_elf32_le_vec;
> > +extern const bfd_target rx_elf32_linux_le_vec;
> >  extern const bfd_target s390_elf32_vec;
> >  extern const bfd_target s390_elf64_vec;
> >  extern const bfd_target score_elf32_be_vec;
> > diff --git a/gas/ChangeLog b/gas/ChangeLog
> > index f2a0c6a408..5077609109 100644
> > --- a/gas/ChangeLog
> > +++ b/gas/ChangeLog
> > @@ -1,3 +1,8 @@
> > +2018-07-30  Yoshinori Sato  <[hidden email]>
> > +
> > + * configure.tgt: Add rx-*-linux.
> > + * config/tc-rx.h (TARGET_FORMAT): Add "elf32-rx-linux".
> > +
> >  2018-07-29  John David Anglin  <[hidden email]>
> >  
> >   * config/tc-hppa.c: Include "struc-symbol.h".
> > diff --git a/gas/config/tc-rx.h b/gas/config/tc-rx.h
> > index bf1f283d3d..78b2bedc9f 100644
> > --- a/gas/config/tc-rx.h
> > +++ b/gas/config/tc-rx.h
> > @@ -31,7 +31,11 @@ extern int target_big_endian;
> >  /* Instruction bytes are big endian, data bytes can be either.  */
> >  #define TARGET_BYTES_BIG_ENDIAN 0
> >  
> > +#ifndef TE_LINUX
> >  #define TARGET_FORMAT (target_big_endian ? "elf32-rx-be" : "elf32-
> > rx-le")
> > +#else
> > +#define TARGET_FORMAT "elf32-rx-linux"
> > +#endif
> >  
> >  /* We don't need to handle .word strangely.  */
> >  #define WORKING_DOT_WORD
> > diff --git a/gas/configure.tgt b/gas/configure.tgt
> > index 6df7dea31f..1122430104 100644
> > --- a/gas/configure.tgt
> > +++ b/gas/configure.tgt
> > @@ -361,6 +361,8 @@ case ${generic_target} in
> >  
> >    riscv*-*-*) fmt=elf endian=little
> > ;;
> >  
> > +  rx-*-linux*) fmt=elf em=linux ;;
> > +
> >    s390-*-linux-*) fmt=elf em=linux ;;
> >    s390-*-tpf*) fmt=elf ;;
> >

--
Yosinori Sato
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Oleg Endo
In reply to this post by Oleg Endo
Hi,

On Tue, 2018-07-31 at 10:39 +0900, Yoshinori Sato wrote:

> It standrad linux kernel.
>
> My target is RX62N + 16MByte external memory.
> I think that connecting with a 32 bit bus is not so slow.

The latest RX71/RX65 support 60 MHz 32 bit data external SDRAM.  On top
of that, there is no instruction/data cache for external SDRAM.  The
system was not designed to operate like that.  The primary use case for
RX is to run code from on-chip flash and use on-chip RAM as application
data.  Every individual access to external memory by the CPU costs
about 3 bus cycles, from what I can see in the hardware manual...

> Also, since the code size is small, I think the influence of memory
> speed is relaxed.

Even if all the Linux + user application code fits into the on-chip
flash ROM, the problem will be the CPU accessing data in external
memory without cache.  That's why I don't think it's practical to run
Linux on RX MCUs.  It will run, but  there are better embedded Linux
options for the same or lower price as RX MCUs.  So I'm not sure how
useful this will be?

>
> I think that it is 10% smaller than other CPUs.
> yo-satoh@yo-satoh-debian:~/linux (rx)$ rx-unknown-linux-size vmlinux
>    text    data     bss     dec     hex
> filename
>  801156   68556  164568 1034280   fc828
> vmlinux

My observation similar. RX ISA produces slightly smaller code than
other ISAs.  But not that much smaller to compensate the slow external
memory :)

Just for my understanding, why is it needed to create a new ELF type
for that?  Why can't rx-elf be used as-is?

Cheers,
Oleg
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Yoshinori Sato
On Tue, 31 Jul 2018 21:49:37 +0900,
Oleg Endo wrote:

>
> Hi,
>
> On Tue, 2018-07-31 at 10:39 +0900, Yoshinori Sato wrote:
> > 
> > It standrad linux kernel.
> >
> > My target is RX62N + 16MByte external memory.
> > I think that connecting with a 32 bit bus is not so slow.
>
> The latest RX71/RX65 support 60 MHz 32 bit data external SDRAM.  On top
> of that, there is no instruction/data cache for external SDRAM.  The
> system was not designed to operate like that.  The primary use case for
> RX is to run code from on-chip flash and use on-chip RAM as application
> data.  Every individual access to external memory by the CPU costs
> about 3 bus cycles, from what I can see in the hardware manual...

I agree.

Because I have not done benchmarks, I only have my own sense,
but it works faster than I suppose.

> > Also, since the code size is small, I think the influence of memory
> > speed is relaxed.
>
> Even if all the Linux + user application code fits into the on-chip
> flash ROM, the problem will be the CPU accessing data in external
> memory without cache.  That's why I don't think it's practical to run
> Linux on RX MCUs.  It will run, but  there are better embedded Linux
> options for the same or lower price as RX MCUs.  So I'm not sure how
> useful this will be?

Although it is not ready yet, it is possible to place the code in the ROM area
including the user program.
I think that it is possible to create an environment where Linux can operate on
a single chip as long as it is an MCU with a large capacity memory.

> >
> > I think that it is 10% smaller than other CPUs.
> > yo-satoh@yo-satoh-debian:~/linux (rx)$ rx-unknown-linux-size vmlinux
> >    text    data     bss     dec     hex
> > filename
> >  801156   68556  164568 1034280   fc828
> > vmlinux
>
> My observation similar. RX ISA produces slightly smaller code than
> other ISAs.  But not that much smaller to compensate the slow external
> memory :)
>
> Just for my understanding, why is it needed to create a new ELF type
> for that?  Why can't rx-elf be used as-is?

Section name etc is different from general ELF.
standard ELF | rx-elf
.text        | P
.data        | D
.rodata      | C
.bss         | B

> Cheers,
> Oleg

--
Yoshinori Sato
<[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Oleg Endo
On Wed, 2018-08-01 at 13:58 +0900, Yoshinori Sato wrote:

> > Just for my understanding, why is it needed to create a new ELF
> > type
> > for that?  Why can't rx-elf be used as-is?

> Section name etc is different from general ELF.
> standard ELF | rx-elf
> .text        | P
> .data        | D
> .rodata      | C
> .bss         | B

Ah, OK.  In binutils GAS we've got 

-muse-conventional-section-names
-muse-renesas-section-names

Where Renesas section names (P, D, C, B ...) is the default.  Actually
I always build RX-anything with -Wa,--muse-conventional-section-names

Would that solve the problem?

Maybe that should be made the default, or selectable as a configure
option?

Cheers,
Oleg
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Yoshinori Sato
On Wed, 01 Aug 2018 21:26:03 +0900,
Oleg Endo wrote:

>
> On Wed, 2018-08-01 at 13:58 +0900, Yoshinori Sato wrote:
>
> > > Just for my understanding, why is it needed to create a new ELF
> > > type
> > > for that?  Why can't rx-elf be used as-is?
>
> > Section name etc is different from general ELF.
> > standard ELF | rx-elf
> > .text        | P
> > .data        | D
> > .rodata      | C
> > .bss         | B
>
> Ah, OK.  In binutils GAS we've got 
>
> -muse-conventional-section-names
> -muse-renesas-section-names
>
> Where Renesas section names (P, D, C, B ...) is the default.  Actually
> I always build RX-anything with -Wa,--muse-conventional-section-names
>
> Would that solve the problem?
>
> Maybe that should be made the default, or selectable as a configure
> option?

Sorry. My explanation was insufficient.

Same problem have gcc. it can't selectable options.
So need new target alias.

There are some differences in bfd, and it is difficult to select by option.
(ex prefix '_').

> Cheers,
> Oleg

--
Yosinori Sato
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Jeff Law
In reply to this post by Yoshinori Sato
On 07/31/2018 10:58 PM, Yoshinori Sato wrote:

> On Tue, 31 Jul 2018 21:49:37 +0900,
> Oleg Endo wrote:
>>
>> Hi,
>>
>> On Tue, 2018-07-31 at 10:39 +0900, Yoshinori Sato wrote:
>>>  
>>> It standrad linux kernel.
>>>
>>> My target is RX62N + 16MByte external memory.
>>> I think that connecting with a 32 bit bus is not so slow.
>>
>> The latest RX71/RX65 support 60 MHz 32 bit data external SDRAM.  On top
>> of that, there is no instruction/data cache for external SDRAM.  The
>> system was not designed to operate like that.  The primary use case for
>> RX is to run code from on-chip flash and use on-chip RAM as application
>> data.  Every individual access to external memory by the CPU costs
>> about 3 bus cycles, from what I can see in the hardware manual...
>
> I agree.
>
> Because I have not done benchmarks, I only have my own sense,
> but it works faster than I suppose.
>
>>> Also, since the code size is small, I think the influence of memory
>>> speed is relaxed.
>>
>> Even if all the Linux + user application code fits into the on-chip
>> flash ROM, the problem will be the CPU accessing data in external
>> memory without cache.  That's why I don't think it's practical to run
>> Linux on RX MCUs.  It will run, but  there are better embedded Linux
>> options for the same or lower price as RX MCUs.  So I'm not sure how
>> useful this will be?
>
> Although it is not ready yet, it is possible to place the code in the ROM area
> including the user program.
> I think that it is possible to create an environment where Linux can operate on
> a single chip as long as it is an MCU with a large capacity memory.
Or consider if one mated the -linux target with a glibc & qemu port for
the rx.  You could then build a chroot of rx-linux binaries and
bootstrap gcc within the chroot.

That turns out to be a nice stress test for code generator correctness.

Jeff
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Yoshinori Sato
On Fri, 03 Aug 2018 03:49:32 +0900,
Jeff Law wrote:

>
> On 07/31/2018 10:58 PM, Yoshinori Sato wrote:
> > On Tue, 31 Jul 2018 21:49:37 +0900,
> > Oleg Endo wrote:
> >>
> >> Hi,
> >>
> >> On Tue, 2018-07-31 at 10:39 +0900, Yoshinori Sato wrote:
> >>>  
> >>> It standrad linux kernel.
> >>>
> >>> My target is RX62N + 16MByte external memory.
> >>> I think that connecting with a 32 bit bus is not so slow.
> >>
> >> The latest RX71/RX65 support 60 MHz 32 bit data external SDRAM.  On top
> >> of that, there is no instruction/data cache for external SDRAM.  The
> >> system was not designed to operate like that.  The primary use case for
> >> RX is to run code from on-chip flash and use on-chip RAM as application
> >> data.  Every individual access to external memory by the CPU costs
> >> about 3 bus cycles, from what I can see in the hardware manual...
> >
> > I agree.
> >
> > Because I have not done benchmarks, I only have my own sense,
> > but it works faster than I suppose.
> >
> >>> Also, since the code size is small, I think the influence of memory
> >>> speed is relaxed.
> >>
> >> Even if all the Linux + user application code fits into the on-chip
> >> flash ROM, the problem will be the CPU accessing data in external
> >> memory without cache.  That's why I don't think it's practical to run
> >> Linux on RX MCUs.  It will run, but  there are better embedded Linux
> >> options for the same or lower price as RX MCUs.  So I'm not sure how
> >> useful this will be?
> >
> > Although it is not ready yet, it is possible to place the code in the ROM area
> > including the user program.
> > I think that it is possible to create an environment where Linux can operate on
> > a single chip as long as it is an MCU with a large capacity memory.
> Or consider if one mated the -linux target with a glibc & qemu port for
> the rx.  You could then build a chroot of rx-linux binaries and
> bootstrap gcc within the chroot.
>
> That turns out to be a nice stress test for code generator correctness.
>
> Jeff

I think that it is difficult to bootstrap gcc because RX target
has severe restrictions on memory.
And qemu is not ready yet, if you do not use real hardware you need
to use gdb and sim, there is speed problem as well.

--
Yosinori Sato
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Yoshinori Sato
In reply to this post by Yoshinori Sato
ping
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

H.J. Lu-30
On Tue, Oct 30, 2018 at 4:35 AM Yoshinori Sato
<[hidden email]> wrote:
>
> ping

Is "make check" clean for this target?  If not, why?

H.J.

--
H.J.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Yoshinori Sato
On Wed, 31 Oct 2018 09:20:00 +0900,
H.J. Lu wrote:
>
> On Tue, Oct 30, 2018 at 4:35 AM Yoshinori Sato
> <[hidden email]> wrote:
> >
> > ping
>
> Is "make check" clean for this target?  If not, why?

Oh, I forgot it. Thanks your comment.

Update patches attached.

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0959688f61..92e4ea7476 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2018-10-31  Yoshinori Sato  <[hidden email]>
+
+ * config.bfd: Add rx-*-linux.
+ * congigure.ac: Likewise.
+ * elf32-rx.c (rx_linux_object_p): New function.
+ (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME)
+ (elf_backend_object_p, elf32_bed): Define rx-*-linux.
+ * targets.c: Add rx_elf32_linux_le_vec.
+
 2018-10-24  H.J. Lu  <[hidden email]>
 
  PR ld/23818
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 5d8424a5f0..2bde98a819 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -1202,6 +1202,10 @@ case "${targ}" in
     targ_selvecs="rx_elf32_be_vec rx_elf32_le_vec rx_elf32_be_ns_vec"
     targ_underscore=yes
     ;;
+  rx-*-linux*)
+    targ_defvec=rx_elf32_linux_le_vec
+    targ_selvecs="rx_elf32_linux_le_vec"
+    ;;
 
   s390-*-linux*)
     targ_defvec=s390_elf32_vec
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 270e54e7d1..5942a74d15 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -612,6 +612,7 @@ do
     rx_elf32_be_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
     rx_elf32_be_ns_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
     rx_elf32_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
+    rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
     s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
     s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
     score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index 1f70b97a34..ddcf5e980f 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -3310,6 +3310,14 @@ rx_elf_object_p (bfd * abfd)
 
   return TRUE;
 }
+
+static bfd_boolean
+rx_linux_object_p (bfd * abfd)
+{
+  bfd_default_set_arch_mach (abfd, bfd_arch_rx,
+           elf32_rx_machine (abfd));
+  return TRUE;
+}
 
 
 #ifdef DEBUG
@@ -4059,3 +4067,18 @@ rx_additional_link_map_text (bfd *obfd, struct bfd_link_info *info, FILE *mapfil
 #define elf32_bed elf32_rx_be_ns_bed
 
 #include "elf32-target.h"
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM rx_elf32_linux_le_vec
+#undef  TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-rx-linux"
+#undef  TARGET_BIG_SYM
+#undef  TARGET_BIG_NAME
+
+#undef  elf_backend_object_p
+#define elf_backend_object_p rx_linux_object_p
+#undef  elf_symbol_leading_char
+#undef elf32_bed
+#define elf32_bed elf32_rx_le_linux_bed
+
+#include "elf32-target.h"
diff --git a/bfd/targets.c b/bfd/targets.c
index b59dd766b2..dc4bef1d82 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -777,6 +777,7 @@ extern const bfd_target rs6000_xcoff_vec;
 extern const bfd_target rx_elf32_be_vec;
 extern const bfd_target rx_elf32_be_ns_vec;
 extern const bfd_target rx_elf32_le_vec;
+extern const bfd_target rx_elf32_linux_le_vec;
 extern const bfd_target s390_elf32_vec;
 extern const bfd_target s390_elf64_vec;
 extern const bfd_target score_elf32_be_vec;
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e3bbbc3a84..a754e9565f 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,7 @@
+2018-10-31  Yoshinori Sato  <[hidden email]>
+ * testsuite/lib/binutils-common.exp: Special section name
+ use only rx-*-elf.
+
 2018-10-18  Nick Clifton  <[hidden email]>
 
  * doc/binutils.texi (readelf): Document alternatives to the
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 08d57ae963..df859fa210 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -1340,7 +1340,7 @@ proc big_or_little_endian {} {
 # Internal procedure: return the names of the standard sections
 #
 proc get_standard_section_names {} {
-    if [istarget "rx-*-*"] {
+    if [istarget "rx-*-elf"] {
  return { "P" "D_1" "B_1" }
     }
     if { [istarget "alpha*-*-*vms*"] || [is_som_format] } {
diff --git a/gas/ChangeLog b/gas/ChangeLog
index bbf6918c19..af2ca940af 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+2018-10-31  Yoshinori Sato  <[hidden email]>
+
+ * configure.tgt: Add rx-*-linux.
+ * config/tc-rx.h (TARGET_FORMAT): Add "elf32-rx-linux".
+ * testsuite/gas/rx/pr19665.d: Add pattern.
+ * testsuite/gas/rx/pr22737.d: Likewise.
+
 2018-10-29  Alan Modra  <[hidden email]>
 
  * Makefile.am (HFILES): Delete struc-symbol.h.
diff --git a/gas/config/tc-rx.h b/gas/config/tc-rx.h
index bf1f283d3d..78b2bedc9f 100644
--- a/gas/config/tc-rx.h
+++ b/gas/config/tc-rx.h
@@ -31,7 +31,11 @@ extern int target_big_endian;
 /* Instruction bytes are big endian, data bytes can be either.  */
 #define TARGET_BYTES_BIG_ENDIAN 0
 
+#ifndef TE_LINUX
 #define TARGET_FORMAT (target_big_endian ? "elf32-rx-be" : "elf32-rx-le")
+#else
+#define TARGET_FORMAT "elf32-rx-linux"
+#endif
 
 /* We don't need to handle .word strangely.  */
 #define WORKING_DOT_WORD
diff --git a/gas/configure.tgt b/gas/configure.tgt
index d1b0535c2b..532f113541 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -366,6 +366,8 @@ case ${generic_target} in
 
   riscv*-*-*) fmt=elf endian=little ;;
 
+  rx-*-linux*) fmt=elf em=linux ;;
+
   s390-*-linux-*) fmt=elf em=linux ;;
   s390-*-tpf*) fmt=elf ;;
 
diff --git a/gas/testsuite/gas/rx/pr19665.d b/gas/testsuite/gas/rx/pr19665.d
index 61b3b0e3f9..04c6b7a42a 100644
--- a/gas/testsuite/gas/rx/pr19665.d
+++ b/gas/testsuite/gas/rx/pr19665.d
@@ -1,6 +1,6 @@
 #objdump: -dr
 
-.*:     file format elf32-rx-le
+.*:     file format elf32-rx-(le|linux)
 
 
 Disassembly of section .*:
diff --git a/gas/testsuite/gas/rx/pr22737.d b/gas/testsuite/gas/rx/pr22737.d
index 1de868e0d4..1de3e0be14 100644
--- a/gas/testsuite/gas/rx/pr22737.d
+++ b/gas/testsuite/gas/rx/pr22737.d
@@ -1,6 +1,6 @@
 #objdump: -dr
 
-.*:     file format elf32-rx-le
+.*:     file format elf32-rx-(le|linux)
 
 
 Disassembly of section .*:

> H.J.
>
> --
> H.J.

--
Yosinori Sato
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Nick Clifton
Hi Yoshinori,

> +2018-10-31  Yoshinori Sato  <[hidden email]>
> +
> + * config.bfd: Add rx-*-linux.
> + * congigure.ac: Likewise.
> + * elf32-rx.c (rx_linux_object_p): New function.
> + (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME)
> + (elf_backend_object_p, elf32_bed): Define rx-*-linux.
> + * targets.c: Add rx_elf32_linux_le_vec.


> +2018-10-31  Yoshinori Sato  <[hidden email]>
> + * testsuite/lib/binutils-common.exp: Special section name
> + use only rx-*-elf.
> +

> +2018-10-31  Yoshinori Sato  <[hidden email]>
> +
> + * configure.tgt: Add rx-*-linux.
> + * config/tc-rx.h (TARGET_FORMAT): Add "elf32-rx-linux".
> + * testsuite/gas/rx/pr19665.d: Add pattern.
> + * testsuite/gas/rx/pr22737.d: Likewise.
> +

Approved - please apply.  Or ping me if you need me to apply it for you.

Cheers
  Nick
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, RX] Add target rx-*-linux

Yoshinori Sato
On Wed, 07 Nov 2018 01:43:21 +0900,
Nick Clifton wrote:

>
> Hi Yoshinori,
>
> > +2018-10-31  Yoshinori Sato  <[hidden email]>
> > +
> > + * config.bfd: Add rx-*-linux.
> > + * congigure.ac: Likewise.
> > + * elf32-rx.c (rx_linux_object_p): New function.
> > + (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME)
> > + (elf_backend_object_p, elf32_bed): Define rx-*-linux.
> > + * targets.c: Add rx_elf32_linux_le_vec.
>
>
> > +2018-10-31  Yoshinori Sato  <[hidden email]>
> > + * testsuite/lib/binutils-common.exp: Special section name
> > + use only rx-*-elf.
> > +
>
> > +2018-10-31  Yoshinori Sato  <[hidden email]>
> > +
> > + * configure.tgt: Add rx-*-linux.
> > + * config/tc-rx.h (TARGET_FORMAT): Add "elf32-rx-linux".
> > + * testsuite/gas/rx/pr19665.d: Add pattern.
> > + * testsuite/gas/rx/pr22737.d: Likewise.
> > +
>
> Approved - please apply.  Or ping me if you need me to apply it for you.
>
> Cheers
>   Nick

OK.
Thanks.

--
Yosinori Sato
Reply | Threaded
Open this post in threaded view
|

Regen bfd/configure

Alan Modra-3
        * configure: Regenerate.

diff --git a/bfd/configure b/bfd/configure
index 4c94cf0b8d..dae6e1f0c5 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -14844,6 +14844,7 @@ do
     rx_elf32_be_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
     rx_elf32_be_ns_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
     rx_elf32_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
+    rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
     s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
     s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
     score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;


--
Alan Modra
Australia Development Lab, IBM