User Tools

Site Tools


microcontrollers:avr-libc_makefile_template

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

microcontrollers:avr-libc_makefile_template [2012/01/15 12:32] – created mithatmicrocontrollers:avr-libc_makefile_template [2012/01/16 11:10] (current) mithat
Line 4: Line 4:
  
 <file make Makefile> <file make Makefile>
-PRG            = demo +PRG     = demo 
-OBJ            = demo.o+OBJ     = demo.o
 #MCU_TARGET     = at90s2313 #MCU_TARGET     = at90s2313
 #MCU_TARGET     = at90s2333 #MCU_TARGET     = at90s2333
Line 59: Line 59:
 OPTIMIZE       = -O2 OPTIMIZE       = -O2
  
-DEFS           +DEFS    
-LIBS           =+LIBS    =
  
 # You should not have to change anything below here. # You should not have to change anything below here.
  
-CC             = avr-gcc+CC      = avr-gcc
  
 # Override is only needed by avr-lib build system. # Override is only needed by avr-lib build system.
  
-override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)+override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
 override LDFLAGS       = -Wl,-Map,$(PRG).map override LDFLAGS       = -Wl,-Map,$(PRG).map
  
-OBJCOPY        = avr-objcopy +OBJCOPY = avr-objcopy 
-OBJDUMP        = avr-objdump+OBJDUMP = avr-objdump
  
 all: $(PRG).elf lst text eeprom all: $(PRG).elf lst text eeprom
  
 $(PRG).elf: $(OBJ) $(PRG).elf: $(OBJ)
-        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
  
 # dependency: # dependency:
Line 83: Line 83:
  
 clean: clean:
-        rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak  + rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak  
-        rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)+ rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
  
 lst:  $(PRG).lst lst:  $(PRG).lst
  
 %.lst: %.elf %.lst: %.elf
-        $(OBJDUMP) -h -S $< > $@+ $(OBJDUMP) -h -S $< > $@
  
 # Rules for building the .text rom images # Rules for building the .text rom images
Line 100: Line 100:
  
 %.hex: %.elf %.hex: %.elf
-        $(OBJCOPY) -j .text -j .data -O ihex $< $@+ $(OBJCOPY) -j .text -j .data -O ihex $< $@
  
 %.srec: %.elf %.srec: %.elf
-        $(OBJCOPY) -j .text -j .data -O srec $< $@+ $(OBJCOPY) -j .text -j .data -O srec $< $@
  
 %.bin: %.elf %.bin: %.elf
-        $(OBJCOPY) -j .text -j .data -O binary $< $@+ $(OBJCOPY) -j .text -j .data -O binary $< $@
  
 # Rules for building the .eeprom rom images # Rules for building the .eeprom rom images
Line 117: Line 117:
  
 %_eeprom.hex: %.elf %_eeprom.hex: %.elf
-        $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ \ + $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ \ 
-        || { echo empty $@ not generated; exit 0; }+ || { echo empty $@ not generated; exit 0; }
  
 %_eeprom.srec: %.elf %_eeprom.srec: %.elf
-        $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@ \ + $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@ \ 
-        || { echo empty $@ not generated; exit 0; }+ || { echo empty $@ not generated; exit 0; }
  
 %_eeprom.bin: %.elf %_eeprom.bin: %.elf
-        $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@ \ + $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@ \ 
-        || { echo empty $@ not generated; exit 0; }+ || { echo empty $@ not generated; exit 0; }
  
 # Every thing below here is used by avr-libc's build system and can be ignored # Every thing below here is used by avr-libc's build system and can be ignored
 # by the casual user. # by the casual user.
  
-FIG2DEV                 = fig2dev+FIG2DEV  = fig2dev
 EXTRA_CLEAN_FILES       = *.hex *.bin *.srec EXTRA_CLEAN_FILES       = *.hex *.bin *.srec
  
Line 141: Line 141:
  
 %.eps: %.fig %.eps: %.fig
-        $(FIG2DEV) -L eps $< $@+ $(FIG2DEV) -L eps $< $@
  
 %.pdf: %.fig %.pdf: %.fig
-        $(FIG2DEV) -L pdf $< $@+ $(FIG2DEV) -L pdf $< $@
  
 %.png: %.fig %.png: %.fig
-        $(FIG2DEV) -L png $< $@+ $(FIG2DEV) -L png $< $@
 </file> </file>
microcontrollers/avr-libc_makefile_template.1326630776.txt.gz · Last modified: 2012/01/15 12:32 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki