digidotcom / xbee_ansic_library

A collection of portable ANSI C code for communicating with Digi International's XBee wireless radio modules in API mode.
204 stars 116 forks source link

alignment faults #5

Closed syatech closed 8 years ago

syatech commented 8 years ago

The code contains several casts that fail on processors with uint16_t and uint32_t alignment restrictions, such as the PIC32MX. For example:

response.value = be16toh( (uint16_t FAR )value);

If 'value' is not word-aligned then this will generate an exception.

tomlogic commented 8 years ago

I believe I've addressed this in e48e03163e396ad150eea3ac3daa039c338c83b5 on my fork of this repository. Take a look at later commits which add support for the ARM-based Freescale FRDM-KL25Z, and include the helper functions a platform needs for unaligned memory access.

I've created a pull request (#1) for Digi to incorporate my recent work in their repo.

syatech commented 8 years ago

Thanks!