On Fri, Mar 16, 2012 at 2:23 AM, N. Coesel <n...@nctdev.nl> wrote:
> Wayne,
>
> At 04:39 16-3-2012, Wayne Uroda wrote:
>>Content-Language: en-US
>>Content-Type: multipart/alternative;
>>
>>boundary="_000_FC420BFC27132046879F921D33E6D87F0A693709A9BRUNOgrabbalo_"
>>
>>I notice that iostructures.h hasn't been a part of the MSPGCC
>>project for a while now...
>>
>>I am wondering if there is a reason for this? I always found these

With over 300 MCUs to support, mspgcc now uses header and memory map
information provided by Texas Instruments.  TI does not include
bitfield structure declarations for peripheral registers.

>>structures were a very convenient way to access individual pins, and
>>I can't recall ever suffering any strange problems from using the
>>structures to read or write the in,out,dir,sel,ies,ie and ifg bits.
>>
>>If there is a compelling technical reason to not access pins through
>>structures such as these, does anybody have suggestions as to how
>>they do it, and why?
>
> I've always found those structures prone to errors because the author
> must carefully count the number of elements. Especially when there
> are gaps in the map it is easy to make a mistake. Another potential
> problem is alignment. A compiler may align byte elements of a
> structure on 2 or 4 byte boundaries depending on pragmas or options.

With respect to application code maintainability, I also find the
structure approach to be more opaque and less expressive than bitwise
operations on the whole registers using the constants defined in the
headers and documented in the users' guides.

Peter

> I'm quite sure structures or constant pointers are not slower or
> faster. Since the address is constant in both cases the compiler can
> optimize both equally well.
>
> Nico Coesel
>
> o---------------------------------------------------------------o
> |                       N C T  Developments                     |
> |Innovative embedded solutions                                  |
> o---------------------------------------------------------------o
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to