1
0

parse_options.mk 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # Make command-line Options for Optiboot, Optiboot-Mega0
  2. # Permit commands like "make atmega4809 LED_START_FLASHES=10" to pass the
  3. # appropriate parameters ("-DLED_START_FLASHES=10") to gcc
  4. #
  5. ifdef PRODUCTION
  6. ifneq ($(PRODUCTION),0)
  7. VERSION_CMD = -DPRODUCTION=1
  8. endif
  9. dummy = FORCE
  10. endif
  11. # Build Options
  12. HELPTEXT += "Option CUSTOM_VERSION=nn - set a customer version number\n"
  13. ifdef CUSTOM_VERSION
  14. ifneq ($(CUSTOM_VERSION), 0)
  15. VERSION_CMD = -DOPTIBOOT_CUSTOMVER=$(CUSTOM_VERSION)
  16. else
  17. VERSION_CMD = -DPRODUCTION=1
  18. endif
  19. dummy = FORCE
  20. endif
  21. HELPTEXT += "Option BIGBOOT=1 - enable extra features up to 1kbytes\n"
  22. # BIGBOOT: Include extra features, up to 1K.
  23. ifdef BIGBOOT
  24. ifneq ($(BIGBOOT), 0)
  25. BIGBOOT_CMD = -DBIGBOOT=1
  26. dummy = FORCE
  27. endif
  28. endif
  29. HELPTEXT += "Option SUPPORT_EEPROM=1 - Include code to read/write EEPROM\n"
  30. ifdef SUPPORT_EEPROM
  31. ifneq ($(SUPPORT_EEPROM), 0)
  32. SUPPORT_EEPROM_CMD = -DSUPPORT_EEPROM
  33. dummy = FORCE
  34. endif
  35. endif
  36. HELPTEXT += "Option NO_APP_SPM=1 - disallow application call of do_spm\n"
  37. ifdef NO_APP_SPM
  38. ifneq ($(NO_APP_SPM),0)
  39. APPSPM_CMD = -DAPP_NOSPM=1
  40. endif
  41. endif
  42. # LED options
  43. HELPTEXT += "Option LED=B3 - set LED pin to particular port/bit\n"
  44. ifdef LED
  45. LED_CMD = -DLED=$(LED)
  46. dummy = FORCE
  47. endif
  48. HELPTEXT += "Option LED_START_FLASHES=n - set number of LED flashes when bootloader starts\n"
  49. ifdef LED_START_FLASHES
  50. LED_START_FLASHES_CMD = -DLED_START_FLASHES=$(LED_START_FLASHES)
  51. dummy = FORCE
  52. else
  53. LED_START_FLASHES_CMD = -DLED_START_FLASHES=3
  54. endif
  55. HELPTEXT += "Option LED_DATA_FLASH=1 - flash the LED each time data is received.\n"
  56. ifdef LED_DATA_FLASH
  57. ifneq ($(LED_DATA_FLASH), 0)
  58. LED_DATA_FLASH_CMD = -DLED_DATA_FLASH=1
  59. dummy = FORCE
  60. endif
  61. endif
  62. HELPTEXT += "Option LED_START_ON=1 - Turn the LED on at bootload start\n"
  63. ifdef LED_START_ON
  64. ifneq ($(LED_START_ON), 0)
  65. LED_START_ON_CMD = -DLED_START_ON=1
  66. endif
  67. dummy = FORCE
  68. endif
  69. HELPTEXT += "Option LED_INVERT=1 - Invert the 'on' state of the LED\n"
  70. ifdef LED_INVERT
  71. ifneq ($(LED_INVERT), 0)
  72. LEDINV_CMD = -DLED_INVERT=1
  73. endif
  74. dummy = FORCE
  75. endif
  76. # UART options
  77. HELPTEXT += "Option BAUD_RATE=nnnn - set the bit rate for communications\n"
  78. ifdef BAUD_RATE
  79. BAUD_RATE_CMD = -DBAUD_RATE=$(BAUD_RATE)
  80. dummy = FORCE
  81. else
  82. BAUD_RATE_CMD = -DBAUD_RATE=115200
  83. endif
  84. HELPTEXT += "Option SOFT_UART=1 - use a software (bit-banged) UART\n"
  85. ifdef SOFT_UART
  86. ifneq ($(SOFT_UART), 0)
  87. SOFT_UART_CMD = -DSOFT_UART=1
  88. dummy = FORCE
  89. endif
  90. endif
  91. HELPTEXT += "Option SINGLESPEED=1 - do not use U2X mode on UART\n"
  92. ifdef SINGLESPEED
  93. ifneq ($(SINGLESPEED), 0)
  94. SS_CMD = -DSINGLESPEED=1
  95. endif
  96. endif
  97. HELPTEXT += "Option RS485=B0 - Pin for optional rs485 tx enable\n"
  98. ifdef RS485
  99. RS485_CMD = -DRS485=$(RS485)
  100. dummy = FORCE
  101. endif
  102. #CPU Options
  103. HELPTEXT += "Option TIMEOUT=n - set WDT to 1, 2, 4, or 8 seconds\n"
  104. ifdef TIMEOUT
  105. TIMEOUT_CMD = -DWDTTIME=$(TIMEOUT)
  106. dummy = FORCE
  107. endif
  108. HELPTEXT += "Option RESETPIN=0/1 - change RESET pin behavior\n"
  109. ifdef RESETPIN
  110. RESETPIN_CMD = -DRSTPIN=$(RESETPIN)
  111. dummy = FORCE
  112. endif
  113. ifdef AVR_FREQ
  114. FCPU_CMD = -DF_CPU=$(AVR_FREQ)
  115. dummy = FORCE
  116. endif
  117. HELPTEXT += "Option AVR_FREQ=<n> - Clock rate of AVR CPU\n"
  118. LED_OPTIONS = $(LED_START_FLASHES_CMD) $(LED_DATA_FLASH_CMD) $(LED_CMD) $(LED_START_ON_CMD) $(LEDINV_CMD)
  119. CPU_OPTIONS = $(RESETPIN_CMD) $(TIMEOUT_CMD) $(FCPU_CMD)
  120. COMMON_OPTIONS = $(BIGBOOT_CMD) $(APPSPM_CMD) $(VERSION_CMD)
  121. COMMON_OPTIONS += $(SUPPORT_EEPROM_CMD)
  122. #UART is handled separately and only passed for devices with more than one.
  123. HELPTEXT += "Option UART=n - use UARTn for communications\n"
  124. HELPTEXT += "Option UARTTX=B5 - describe UART for Mega0, Xtiny\n"
  125. ifdef UART
  126. UART_CMD = -DUART=$(UART)
  127. endif
  128. ifdef UARTTX
  129. UART_CMD = -DUARTTX=$(UARTTX)
  130. endif
  131. UART_OPTIONS = $(UART_CMD) $(BAUD_RATE_CMD) $(SOFT_UART_CMD) $(SS_CMD) $(RS485_CMD)