added workaround for memcpy/memset bug in mspgcc

This commit is contained in:
nifi 2009-04-06 13:07:37 +00:00
parent ed1e945e66
commit c1d490b6a7
2 changed files with 28 additions and 2 deletions

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: msp430def.h,v 1.2 2009/02/04 18:28:44 joxe Exp $
* @(#)$Id: msp430def.h,v 1.3 2009/04/06 13:07:37 nifi Exp $
*/
#ifndef MSP430DEF_H
@ -71,4 +71,29 @@ spl_t splhigh_(void);
#define splhigh() splhigh_()
#define splx(sr) __asm__ __volatile__("bis %0, r2" : : "r" (sr))
/* Workaround for bug in msp430-gcc compiler */
#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND
#ifndef memcpy
#include <string.h>
#define memcpy(dest, src, count) do { \
if(count == 2) { \
*((uint8_t *)dest) = *((uint8_t *)src); \
*((uint8_t *)dest + 1) = *((uint8_t *)src + 1); \
} else { \
memcpy(dest, src, count); \
} \
} while(0)
#define memset(dest, value, count) do { \
if(count == 2) { \
*((uint8_t *)dest) = (uint8_t)value; \
*((uint8_t *)dest + 1) = (uint8_t)value; \
} else { \
memset(dest, value, count); \
} \
} while(0)
#endif /* memcpy */
#endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */
#endif /* MSP430DEF_H */

View File

@ -1,5 +1,5 @@
/* -*- C -*- */
/* @(#)$Id: contiki-conf.h,v 1.42 2009/04/03 11:46:48 adamdunkels Exp $ */
/* @(#)$Id: contiki-conf.h,v 1.43 2009/04/06 13:07:41 nifi Exp $ */
#ifndef CONTIKI_CONF_H
#define CONTIKI_CONF_H
@ -26,6 +26,7 @@
#define ENERGEST_CONF_ON 1
#define HAVE_STDINT_H
#define MSP430_MEMCPY_WORKAROUND 1
#include "msp430def.h"
#ifndef RF_CHANNEL