Build: fixes for building with avr-g++ 4.7.0

This commit is contained in:
Andrew Tridgell 2013-01-07 18:43:08 +11:00
parent 51bb2a3b8d
commit 0c1912565a
2 changed files with 11 additions and 5 deletions

View File

@ -88,15 +88,22 @@ typedef struct {
# undef PROGMEM
# define PROGMEM __attribute__(())
#else
#ifndef __PROG_TYPES_COMPAT__
# undef PROGMEM
# define PROGMEM __attribute__(( section(".progmem.data") ))
#endif
#endif
# undef PSTR
/* Need const type for progmem - new for avr-gcc 4.6 */
# if __AVR__ && __GNUC__ == 4 && __GNUC_MINOR__ > 5
#ifdef __PROG_TYPES_COMPAT__
# define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); \
(const prog_char_t *)&__c[0]; }))
#else
# define PSTR(s) (__extension__({static const prog_char __c[] PROGMEM = (s); \
(const prog_char_t *)&__c[0]; }))
#endif
#else
# define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); \
(prog_char_t *)&__c[0]; }))
@ -107,7 +114,6 @@ typedef struct {
// this gets the gcc __format__ checking right
#define FPSTR(s) (wchar_t *)(s)
static inline int strcasecmp_P(const char *str1, const prog_char_t *pstr)
{
return strcasecmp_P(str1, (const prog_char *)pstr);

View File

@ -228,19 +228,19 @@ endif
#
# Tool options
#
DEFINES = -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERS) $(EXTRAFLAGS)
DEFINES = -D__PROG_TYPES_COMPAT__ -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERS) $(EXTRAFLAGS)
OPTFLAGS = -Os -Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wformat=2 -Wno-reorder
DEPFLAGS = -MD -MT $@
# XXX warning options TBD
CXXOPTS = -mcall-prologues -ffunction-sections -fdata-sections -fno-exceptions
COPTS = -mcall-prologues -ffunction-sections -fdata-sections
ASOPTS = -assembler-with-cpp
ASOPTS =
LISTOPTS = -adhlns=$(@:.o=.lst)
CXXFLAGS = -g -mmcu=$(MCU) $(DEFINES) -Wa,$(LISTOPTS) $(OPTFLAGS) $(DEPFLAGS) $(CXXOPTS)
CFLAGS = -g -mmcu=$(MCU) $(DEFINES) -Wa,$(LISTOPTS) $(OPTFLAGS) $(DEPFLAGS) $(COPTS)
ASFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(LISTOPTS) $(DEPFLAGS) $(ASOPTS)
CFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(OPTFLAGS) $(DEPFLAGS) $(COPTS)
ASFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(DEPFLAGS) $(ASOPTS)
LDFLAGS = -g -mmcu=$(MCU) $(OPTFLAGS) -Wl,--relax,--gc-sections -Wl,-Map -Wl,$(SKETCHMAP)
ifeq ($(BOARD),mega)