- Fix build of contiki-2.x AVR port.
- Generate symbol tables for loadable modules.
This commit is contained in:
parent
98cea83de5
commit
265f45feba
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.avr,v 1.4 2006/12/18 15:20:48 fros4943 Exp $
|
||||
# $Id: Makefile.avr,v 1.5 2006/12/22 16:54:36 barner Exp $
|
||||
|
||||
### Check if we are running under Windows
|
||||
|
||||
@ -17,14 +17,16 @@ CONTIKI_CPU=$(CONTIKI)/cpu/avr
|
||||
|
||||
### Define the source files we have in the AVR port
|
||||
|
||||
AVR = leds-arch.c leds.c clock.c
|
||||
SENSORS = #sensors.c button.c pir.c irq.c vib.c sound.c radio.c ctsrts.c \
|
||||
#lm71.c
|
||||
UIPDRIVERS = #me.c me_tabs.c slip.c tr1001-drv.c tr1001.c crc16.c
|
||||
SYSAPPS = #codeprop.c
|
||||
ELFLOADER = #loader-arch.c elfloader.c elfloader-avr.c symtab.c
|
||||
TARGETLIBS = clock.c flash.c
|
||||
SYSAPPS = codeprop-tmp.c
|
||||
ELFLOADER = elfloader.c elfloader-avr.c symtab-avr.c
|
||||
# loader-arch.c
|
||||
TARGETLIBS = clock.c flash.c mtarch.c
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES += $(SENSORS) \
|
||||
CONTIKI_TARGET_SOURCEFILES += ${AVR} $(SENSORS) \
|
||||
$(SYSAPPS) $(ELFLOADER) \
|
||||
$(TARGETLIBS) $(UIPDRIVERS)
|
||||
|
||||
@ -41,10 +43,12 @@ STRIP = avr-strip
|
||||
CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) \
|
||||
-I$(CONTIKI)/platform/$(TARGET) \
|
||||
${addprefix -I,$(APPDIRS)} \
|
||||
-DWITH_UIP -DWITH_ASCII \
|
||||
-Wall -mmcu=$(MCU) -g
|
||||
-Wall -mmcu=$(MCU) -gstabs
|
||||
CFLAGS = $(CFLAGSNO) -Os
|
||||
LDFLAGS = -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map
|
||||
BOOTLOADER_START = 0x1e000
|
||||
LDFLAGS = -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map \
|
||||
-Wl,--section-start=.bootloader=$(BOOTLOADER_START)
|
||||
|
||||
|
||||
### Setup directory search path for source files
|
||||
|
||||
@ -63,21 +67,42 @@ $(OBJECTDIR)/%.o: %.c
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.firmware: %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a
|
||||
%.ko: %.o
|
||||
$(STRIP) -K _init -K _fini --strip-unneeded -g -x $< -o $@
|
||||
|
||||
%.elf: %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter-out %.a,$^) $(filter %.a,$^) $(LDLIBS)
|
||||
%.ihex: %.firmware
|
||||
|
||||
%.hex: %.out
|
||||
$(OBJCOPY) $^ -O ihex $@
|
||||
|
||||
# Add a namelist to the kernel
|
||||
%.out: %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a
|
||||
$(CONTIKI)/tools/make-empty-symbols
|
||||
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBC) symbols.c
|
||||
$(CONTIKI)/tools/avr-make-symbols $@
|
||||
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBC) symbols.c
|
||||
$(CONTIKI)/tools/avr-make-symbols $@
|
||||
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBC) symbols.c
|
||||
|
||||
#%.hex: %.elf
|
||||
# $(OBJCOPY) -R .eeprom $^ -O ihex $@
|
||||
|
||||
%.eep: %.out
|
||||
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||
--change-section-lma .eeprom=0 -O ihex $^ $@
|
||||
|
||||
|
||||
%-stripped.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(STRIP) --strip-unneeded -g -x $@
|
||||
|
||||
%.ce: %.c
|
||||
$(CC) $(CFLAGS) -DPROCESS_LOADABLE -c $< -o $@
|
||||
#%.ce: %.c
|
||||
# $(CC) $(CFLAGS) -DPROCESS_LOADABLE -c $< -o $@
|
||||
$(STRIP) --strip-unneeded -g -x $@
|
||||
|
||||
%.ce: #%.co
|
||||
$(LD) -i -r --unresolved-symbols=ignore-in-object-files -mavrx149 -o $@ $^
|
||||
%.ce: %.co
|
||||
$(LD) -i -r --unresolved-symbols=ignore-in-object-files -mavr5 -o $@ $^
|
||||
$(STRIP) --strip-unneeded -g -x $@
|
||||
|
||||
%.co: %.c
|
||||
@ -92,6 +117,10 @@ $(OBJECTDIR)/%.o: %.c
|
||||
%.srec: %.$(TARGET)
|
||||
$(OBJCOPY) -O srec $< $@
|
||||
|
||||
### Upload image
|
||||
%.u: %.hex
|
||||
avrdude ${AVRDUDE_OPTIONS} -P ${AVRDUDE_PORT} -c ${AVRDUDE_PROGRAMMER} -p ${MCU} -U flash:w:$<
|
||||
|
||||
.PHONY: symbols.c
|
||||
symbols.c:
|
||||
${CONTIKI}/tools/avr-make-symbols core.firmware > symbols.c
|
||||
|
Loading…
Reference in New Issue
Block a user