Advertisement
Guest User

Untitled

a guest
Jun 14th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. Makefile.avr
  2.  
  3. $(info XXXXXXXXXXXXXXXXXXXXXXXX Starting micropnp/Makefile.avr XXXXXXXXXXXXXXXXXXXXXXXX)
  4.  
  5. # When compiling upnp.c, AUTOSTART should be enabled to
  6. # automatically load the uPnP process, from where we bootstrap
  7. # everything
  8. $(OBJECTDIR)/upnp.o: CFLAGS += -DAUTOSTART_ENABLE
  9.  
  10. %.comp: CFLAGS += -DBUILD_COMPONENT
  11.  
  12. # Use our own linker script (avr51.xr). Newer versions of binutils have a
  13. # default linker script that tends to leave too much sections unmerged.
  14. # Deployable components should only have: .text, .data, .bss, .rela for every
  15. # section, .symtab, .strtab, .shstrtab
  16. # Linker is called directly instead of through avr-gcc (generally bad
  17. # practice). In this case avr-gcc would have passed flags causing libc calls to
  18. # be statically compiled in (e.g. printf call in code creates gigantic
  19. # component)
  20. %.comp: %.ce
  21. $(STRIP) -N __do_clear_bss -N __do_copy_data --remove-section=.comment $<
  22. avr-ld -r -T$(UPNP)/cpu/avr/avr51.xr $< -o $@
  23.  
  24. # Cancel built-in rule for .out so we can take over
  25. %.out: %
  26.  
  27. # Use LooCI scripts to generate symbols.c
  28. %.out: %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a
  29. $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBC)
  30.  
  31. # Override Contiki defined .hex so we can also include .bootloader
  32. %.hex: %.out
  33. $(OBJCOPY) $^ -j .text -j .data -j .bootloader -O ihex $@
  34.  
  35.  
  36. # Cancel Contiki defined .elf so we can take over
  37. %.elf: %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a symbols.o
  38.  
  39. # Redirect .elf target to .out, and run avr-size if allowed
  40. %.elf: %.out
  41. cp $< $@
  42. ifndef NOAVRSIZE
  43. avr-size -C --mcu=$(MCU) $@
  44. endif
  45.  
  46. # Sets fuses as defined in contiki-main.c of platform.
  47. %.fu: %.fuses.bin
  48. $(eval LFUSE = $(shell od -A none --format=x1 --read-bytes=1 $<))
  49. $(eval HFUSE = $(shell od -A none --format=x1 --read-bytes=1 -j1 $<))
  50. $(eval EFUSE = $(shell od -A none --format=x1 --read-bytes=1 -j2 $<))
  51. $(AVRDUDE) $(AVRDUDE_MCU) $(AVRDUDE_OPTIONS) $(AVRDUDE_PORT) $(AVRDUDE_PROGRAMMER) \
  52. -U lfuse:w:0x$(LFUSE):m -U hfuse:w:0x$(HFUSE):m -U efuse:w:0x$(EFUSE):m
  53.  
  54. %.fuses.bin: %.out
  55. $(OBJCOPY) $< -j .fuse -O binary --change-section-lma .fuse=0 $@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement