The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.
So far in May, you have voted 0 times ou of a total of 20 votes by the community.
Please help us clean the archives from unuseful discussion threads by using the voting system! Details here.
Is this thread worth a thumbs up?
Thanks for the answer! Just what I was looking for.
--- In m..., Anders Lindgren wrote:
> Hi!
>
> > I think I have figured out why adding in a simple byte variable in one
> > part of my code broke something unrelated. A largish structure used
> > to mirror parameters while doing a parameter update (in the parameter
> > FLASH) is being moved to an odd address.
> >
> > Means my word accesses are stuffed up.
> >
> > I can't find a way of forcing a structure variable to be located on an
> > even address. Do I have to muck about with linker control files and
> > data segments? Would be useful to have a #pragma to control alignment
> > IMO.
>
> You have exactly what you need in the "data_alignment" pragma. You
> can use it to raise the alignment of individual variables, for
> example:
>
> #pragma data_alignment=2
> char x; // This will be placed at an even address!
> An alternative approach would be to define your structure as a union
> of characters and short:s, that way you could access using words when
> you like and as characters when appropriate. A structure defined that
> way would never be placed on an odd address.
> > I could easily learn to hate the IAR compiler - been forcd to use it
> > on one project.
>
> In this case I think that the IAR toolchain is is good company -- I
> haven't heard of any compiler that doesn't pack character data.
> -- Anders Lindgren, Author of the IAR MSP430 compiler, IAR Systems
> --
> Disclaimer: Opinions expressed in this posting are strictly my own and
> not necessarily those of my employer.
>
(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )