Basic example of the GCC usage on linux
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
727 B

1 year ago
  1. OBJECTS=blink.o
  2. MAP=blink.map
  3. MAKEFILE=Makefile
  4. ifeq ($(OS),Windows_NT)
  5. ifeq ($(shell uname -o),Cygwin)
  6. RM= rm -rf
  7. else
  8. RM= del /q
  9. endif
  10. else
  11. RM= rm -rf
  12. endif
  13. GCC_DIR = $(abspath $(dir $(lastword $(MAKEFILE)))/../../bin)
  14. SUPPORT_FILE_DIRECTORY = $(abspath $(dir $(lastword $(MAKEFILE)))/../../include)
  15. # Please set your device here
  16. DEVICE = MSP430F5529
  17. CC = $(GCC_DIR)/msp430-elf-gcc
  18. GDB = $(GCC_DIR)/msp430-elf-gdb
  19. CFLAGS = -I $(SUPPORT_FILE_DIRECTORY) -mmcu=$(DEVICE) -Og -Wall -g
  20. LFLAGS = -L $(SUPPORT_FILE_DIRECTORY) -Wl,-Map,$(MAP),--gc-sections
  21. all: ${OBJECTS}
  22. $(CC) $(CFLAGS) $(LFLAGS) $? -o $(DEVICE).out
  23. clean:
  24. $(RM) $(OBJECTS)
  25. $(RM) $(MAP)
  26. $(RM) *.out
  27. debug: all
  28. $(GDB) $(DEVICE).out