Author Topic: How easy is it to develop with Renesas RX micros?  (Read 5864 times)

0 Members and 1 Guest are viewing this topic.

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2830
  • Country: us
Re: How easy is it to develop with Renesas RX micros?
« Reply #25 on: May 25, 2020, 08:56:30 pm »
The Renesas headers we're using have duplicate definitions of all registers, for big and little endian.

Really? That's ridiculous.  One of the first rules of pragmatic programming is "Don't Repeat Yourself", and the worst possible way to violate that rule is repeating yourself in a slightly but critically different way.

Not that it matters, because no-one should ever use bit fields for hardware registers.
So true. Unfortunately, nobody seems to care anymore.

Yes, it's one of those things that's sort of nice syntactically for single bits, but really not worth the trouble and potential issues.  Also annoying when they'r'e declared in such a way that you have to tack ".reg" onto the end of every single register access if you're not using the bitfields.
« Last Edit: May 25, 2020, 08:59:36 pm by ajb »
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: How easy is it to develop with Renesas RX micros?
« Reply #26 on: May 26, 2020, 04:44:40 am »
The Renesas headers we're using have duplicate definitions of all registers, for big and little endian.
Really? That's ridiculous.  One of the first rules of pragmatic programming is "Don't Repeat Yourself", and the worst possible way to violate that rule is repeating yourself in a slightly but critically different way.
From the CPU's POV, the layout of the registers changes depending on endianness, so there's no much choice. To be clear, each bitfield definition contains an "#ifdef __RX_ENDIAN__BIG__ #else #endif" pattern, they don't duplicate the outer "struct" part.
 
The following users thanked this post: ajb

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2830
  • Country: us
Re: How easy is it to develop with Renesas RX micros?
« Reply #27 on: May 26, 2020, 06:32:59 pm »
The Renesas headers we're using have duplicate definitions of all registers, for big and little endian.
Really? That's ridiculous.  One of the first rules of pragmatic programming is "Don't Repeat Yourself", and the worst possible way to violate that rule is repeating yourself in a slightly but critically different way.
From the CPU's POV, the layout of the registers changes depending on endianness, so there's no much choice. To be clear, each bitfield definition contains an "#ifdef __RX_ENDIAN__BIG__ #else #endif" pattern, they don't duplicate the outer "struct" part.

OOOOoooh, the CPU can be switched, got it.  From the context I was under the impression that it was to support toolchains with different (or switchable) conventions for bitfields.

Switchable endianness seems like a rather expensive feature for limited benefit--maybe a couple of hardware instructions for swapping bytes would have been better and more flexible? 
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: How easy is it to develop with Renesas RX micros?
« Reply #28 on: May 26, 2020, 09:02:24 pm »
Switchable endianness seems like a rather expensive feature for limited benefit--maybe a couple of hardware instructions for swapping bytes would have been better and more flexible?
I suspect it's a backwards compatibility feature, the H8 series and older SuperH were big-endian. It's a bit quirky in that code is always little-endian, but data endianness is configurable via an option bit.

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1589
  • Country: de
Re: How easy is it to develop with Renesas RX micros?
« Reply #29 on: May 26, 2020, 10:55:36 pm »
I wouldn't trust switchable endianess. The earlier Motorola/Freescale/NXP eSys controllers with PowerPC core had this features but it was so bug ridden that it was finally removed.
On a somewhat related note, Motorola also counted the bits the other way round, so the least significant bit in a 32bit register was 31. Even worse, some cores also existed as 64bit versions with some peripherals and buses being also 64bit wide, but only the "lower" 32bit were implemented on a 32bit core. So some 32bit registers were counted from 63 (LSB) to 32 (MSB). Now if that isn't confusing.
Trying is the first step towards failure - Homer J. Simpson
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: How easy is it to develop with Renesas RX micros?
« Reply #30 on: May 27, 2020, 04:55:06 am »
I wouldn't trust switchable endianess. The earlier Motorola/Freescale/NXP eSys controllers with PowerPC core had this features but it was so bug ridden that it was finally removed.
PowerPC implemented little-endian by XORing the LSBs of the address, which doesn't work as expected with unaligned data. That's not an issue with the RX implementation.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf