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.
 
 
 
 
 
 

90 lines
3.5 KiB

  1. ############################################################################
  2. # Copyright (C) 2011 by Martin Schmoelzer #
  3. # <martin.schmoelzer@student.tuwien.ac.at> #
  4. # #
  5. # This program is free software; you can redistribute it and/or modify #
  6. # it under the terms of the GNU General Public License as published by #
  7. # the Free Software Foundation; either version 2 of the License, or #
  8. # (at your option) any later version. #
  9. # #
  10. # This program is distributed in the hope that it will be useful, #
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of #
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  13. # GNU General Public License for more details. #
  14. # #
  15. # You should have received a copy of the GNU General Public License #
  16. # along with this program; if not, write to the #
  17. # Free Software Foundation, Inc., #
  18. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #
  19. ############################################################################
  20. # Define the name of our tools. Some distributions (e. g. Fedora) prefix
  21. # the SDCC executables, change this accordingly!
  22. PREFIX =
  23. # Small Device C Compiler: http://sdcc.sourceforge.net/
  24. CC = $(PREFIX)-sdcc
  25. # 8051 assembler, part of the SDCC software package.
  26. AS = $(PREFIX)-sdas8051
  27. # SDCC produces quite messy Intel HEX files. This tool is be used to re-format
  28. # those files. It is not required for the firmware download functionality in
  29. # the OpenOCD driver, but the resulting file is smaller.
  30. PACKIHX = $(PREFIX)-packihx
  31. # GNU binutils size. Used to print the size of the IHX file generated by SDCC.
  32. SIZE = size
  33. # Source and header directories.
  34. SRC_DIR = src
  35. INCLUDE_DIR = include
  36. CODE_SIZE = 0x1B00
  37. # Starting address of __xdata variables. Since the OpenULINK firmware does not
  38. # use any of the isochronous interrupts, we can use the isochronous buffer space
  39. # as XDATA memory.
  40. XRAM_LOC = 0x2000
  41. XRAM_SIZE = 0x0800
  42. CFLAGS = --std-sdcc99 --opt-code-size --model-small
  43. LDFLAGS = --code-loc 0x0000 --code-size $(CODE_SIZE) --xram-loc $(XRAM_LOC) \
  44. --xram-size $(XRAM_SIZE) --iram-size 256 --model-small
  45. # list of base object files
  46. OBJECTS = main.rel usb.rel protocol.rel jtag.rel delay.rel USBJmpTb.rel
  47. HEADERS = $(INCLUDE_DIR)/main.h \
  48. $(INCLUDE_DIR)/usb.h \
  49. $(INCLUDE_DIR)/protocol.h \
  50. $(INCLUDE_DIR)/jtag.h \
  51. $(INCLUDE_DIR)/delay.h \
  52. $(INCLUDE_DIR)/reg_ezusb.h \
  53. $(INCLUDE_DIR)/io.h \
  54. $(INCLUDE_DIR)/msgtypes.h
  55. # Disable all built-in rules.
  56. .SUFFIXES:
  57. # Targets which are executed even when identically named file is present.
  58. .PHONY: all, clean
  59. all: ulink_firmware.ihx
  60. $(SIZE) ulink_firmware.ihx
  61. ulink_firmware.ihx: $(OBJECTS)
  62. $(CC) -mmcs51 $(LDFLAGS) -o $@ $^
  63. # Rebuild every C module (there are only 5 of them) if any header changes.
  64. %.rel: $(SRC_DIR)/%.c $(HEADERS)
  65. $(CC) -c $(CFLAGS) -mmcs51 -I$(INCLUDE_DIR) -o $@ $<
  66. %.rel: $(SRC_DIR)/%.a51
  67. $(AS) -lsgo $@ $<
  68. clean:
  69. rm -f *.asm *.lst *.rel *.rst *.sym *.ihx *.lk *.map *.mem
  70. hex: ulink_firmware.ihx
  71. $(PACKIHX) ulink_firmware.ihx > ulink_firmware.hex