Giovanni wrote:About bit field, true it is not portable and MISRA complains but it is compatible among all ARM compilers and that is good enough for this use case, the structures are defined in the LLD because of this, I would not accept those in the HLD.
For this type of application, where processor and peripherals are irrevocable bound together on one piece of silicon, there doesn't seem to be any problem at all with this approach. It may be more problematic to support peripherals on an external bus in a universal manner.
In my limited experience bitfield order is purely down to whether the ARM is running big-endian or little-endian; I have a big-endian system where the bitfield order is exactly reversed, so it would be possible to generate portable code by testing endianness. (I've seen code by others which does this, so it would appear to be a fairly common practice.)
Its slightly tedious because two lists of bitfields have to be generated, in opposite orders, with scope for mistyping or failing to fully implement mods.
All the more recent ARM configurations I've seen are little-endian; is this now universal?