Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: Looking to buy compiler

2005-11-09 by Charles Manning

On Tuesday 08 November 2005 21:32, ????????? ??????? wrote:
> Yes, I mean exactly this!! Crossworks GCC compiler works with bit
> fields of structures using byte instructions. So if you access to the
> VICIntSelect (if it defined like struct) you can even fall out to the
> Data Abort.
> And it not Philips feature, it's ARM feature (data access), am I
> right?

You are partially right. The behaviour is partially ARM defined, and partially 
Philips defined.

A byte intruction won't give a data abort (except for a bad address) because 
byte instructions can access any address. A 32/16-bit access that is not 
properly aligned  **might** give you a data abort or might just give you 
rubbish.

>
> As against, IAR, Keil work with the bit fields of struct relatively to
> it (struct) absolute size (used byte or word instructions).
>
> > That the first bit of the second byte also changed is very possible.
> > This is de to the processor. The timer register should be handled in
> > a 32 bit access. this is what i found out. so instead of these kind
> > of structures i just handle them in 32-bit. this way it is also
> > quicker, you can change all values at the same time.

It is often quicker for other reasons too. Often peripheral register accesses 
are slow, so it is better to make fewer of them.

> >
> > is this really the fault of the compiler?????

No. Never use bitfields for accessing hardware, peripheral registers etc. You 
can typically (safely) use them for software structures.

Bitfield implementation is compiler dependent. You might say "hey it works for 
me using compiler X and I will never use compiler Y", but compiler X might 
change from version 3.61 to version 3.62.



>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.