[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bluetooth-dev] Re: Porting to ARM
Jonas Wigstein[SMTP:email@example.com] wrote:
> Hi all ARM porters !!!!
> I'm just wondering if anyone has a nice solution on the struct overlay
> We have developed a bluetooth stack for windows and used a struct overlay
> technique similar to axis.
> Now we deeply regrets this technique because of the porting difficulties
> we faces.
> As we understands it the ARM processor cant fetch a word(2 byte) on an odd
> address and therefore the C-compiler inserts a space in our structs if it
> encounters a int_2 on a odd address and thereby destroying our nice
> So does anyone know a C-compiler that can handle this on ARM or a nice way
> around the problem without a complete rewrite of the package processing?
> // Jonas Wigstein
I think a clean solution that solves the alignment- as well as
the endianness problems is a rewrite that uses macros similar to the
* instead of structures, make #defines of the byte offsets:
#define xy 27
* use macros to set/read values:
SSVAL(buffer,xy,value) instead of buffer->xy=value
and ... = SVAL(buffer,xy)
There are a lot of changes necessary, but that's propably unavoidable for
a really portable solution.