BuildSystem.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. /** \file
  2. *
  3. * This file contains special DoxyGen information for the generation of the main page and other special
  4. * documentation pages. It is not a project source file.
  5. */
  6. /** \page Page_BuildSystem The LUFA Build System
  7. *
  8. * \section Sec_BuildSystem_Overview Overview of the LUFA Build System
  9. * The LUFA build system was originally an attempt at making a set of
  10. * re-usable, modular build make files which could be referenced in a LUFA
  11. * powered project, to minimize the amount of code required in an
  12. * application makefile.
  13. *
  14. * As it turned out to be fairly generic in nature, it was split out into its
  15. * own separate project, called DMBS (<i>Dean's Makefile Build System</i>)
  16. * which is released into the public domain. LUFA-specific portions of the
  17. * LUFA build system extend DMBS, and provide a universal build system for all
  18. * LUFA projects.
  19. *
  20. * The latest DMBS project information and documentation can be found at:
  21. * https://github.com/abcminiuser/dmbs
  22. *
  23. * DMBS is written in GNU Make, and each module is independent of one-another.
  24. *
  25. * LUFA now uses DMBS for its build system, with some LUFA specific extension
  26. * modules.
  27. *
  28. * If you have problems building using LUFA, see \subpage Page_BuildTroubleshooting for resolution steps.
  29. *
  30. * \li \subpage Page_BuildModule_LUFA_SOURCES - The LUFA SOURCES extension module for DMBS
  31. * \li \subpage Page_BuildModule_LUFA_GCC - The LUFA GCC extension module for DMBS
  32. */
  33. /** \page Page_BuildModule_LUFA_SOURCES LUFA SOURCES extension module for DMBS
  34. *
  35. * The LUFA SOURCES extension more for DMBS provides LUFA specific variables
  36. * listing the various LUFA source files required to be build by a project for
  37. * a given LUFA module. This module gives a way to reference LUFA source files
  38. * symbolically, so that changes to the library structure do not break the
  39. * library makefile.
  40. *
  41. * To use this module in your application makefile, add the following code:
  42. * \code
  43. * include $(LUFA_PATH)/Build/LUFA/lufa-sources.mk
  44. * \endcode
  45. *
  46. * \section SSec_BuildModule_LUFA_SOURCES_Requirements Requirements
  47. * None.
  48. *
  49. * \section SSec_BuildModule_LUFA_SOURCES_Targets Targets
  50. *
  51. * <table>
  52. * <tr>
  53. * <td><i>None</i></td>
  54. * </tr>
  55. * </table>
  56. *
  57. * \section SSec_BuildModule_LUFA_SOURCES_MandatoryParams Mandatory Parameters
  58. *
  59. * <table>
  60. * <tr>
  61. * <td><tt>LUFA_PATH</tt></td>
  62. * <td>Path to the LUFA library core, either relative or absolute (e.g. <tt>../LUFA-000000/LUFA/</tt>).</td>
  63. * </tr>
  64. * <tr>
  65. * <td><tt>ARCH</tt></td>
  66. * <td>Architecture of the target processor (see \ref Page_DeviceSupport).</td>
  67. * </tr>
  68. * </table>
  69. *
  70. * \section SSec_BuildModule_LUFA_SOURCES_OptionalParams Optional Parameters
  71. *
  72. * <table>
  73. * <tr>
  74. * <td><i>None</i></td>
  75. * </tr>
  76. * </table>
  77. *
  78. * \section SSec_BuildModule_LUFA_SOURCES_ProvidedVariables Module Provided Variables
  79. *
  80. * <table>
  81. * <tr>
  82. * <td><tt>LUFA_SRC_USB</tt></td>
  83. * <td>List of LUFA USB driver source files.</td>
  84. * </tr>
  85. * <tr>
  86. * <td><tt>LUFA_SRC_USBCLASS</tt></td>
  87. * <td>List of LUFA USB Class driver source files.</td>
  88. * </tr>
  89. * <tr>
  90. * <td><tt>LUFA_SRC_TEMPERATURE</tt></td>
  91. * <td>List of LUFA temperature sensor driver source files.</td>
  92. * </tr>
  93. * <tr>
  94. * <td><tt>LUFA_SRC_SERIAL</tt></td>
  95. * <td>List of LUFA Serial U(S)ART driver source files.</td>
  96. * </tr>
  97. * <tr>
  98. * <td><tt>LUFA_SRC_TWI</tt></td>
  99. * <td>List of LUFA TWI driver source files.</td>
  100. * </tr>
  101. * <tr>
  102. * <td><tt>LUFA_SRC_PLATFORM</tt></td>
  103. * <td>List of LUFA architecture specific platform management source files.</td>
  104. * </tr>
  105. * </table>
  106. *
  107. * \section SSec_BuildModule_LUFA_SOURCES_ProvidedMacros Module Provided Macros
  108. *
  109. * <table>
  110. * <tr>
  111. * <td><i>None</i></td>
  112. * </tr>
  113. * </table>
  114. */
  115. /** \page Page_BuildModule_LUFA_GCC LUFA GCC extension module for DMBS
  116. *
  117. * The LUFA GCC extension module for the standard DMBS GCC module extends the
  118. * latter to support the compilation of LUFA powered projects. It should be
  119. * imported into your LUFA powered project makefiles to ensure that the correct
  120. * build settings are used for the project's configuration.
  121. *
  122. * To use this module in your application makefile, add the following code:
  123. * \code
  124. * include $(LUFA_PATH)/Build/LUFA/lufa-gcc.mk
  125. * \endcode
  126. *
  127. * \section SSec_BuildModule_LUFA_GCC_Requirements Requirements
  128. * This module should be included in your makefile *after* the DMBS GCC module.
  129. *
  130. * \section SSec_BuildModule_LUFA_GCC_Targets Targets
  131. *
  132. * <table>
  133. * <tr>
  134. * <td><i>None</i></td>
  135. * </tr>
  136. * </table>
  137. *
  138. * \section SSec_BuildModule_LUFA_GCC_MandatoryParams Mandatory Parameters
  139. *
  140. * <table>
  141. * <tr>
  142. * <td><tt>LUFA_PATH</tt></td>
  143. * <td>Path to the LUFA library core, either relative or absolute (e.g. <tt>../LUFA-000000/LUFA/</tt>).</td>
  144. * </tr>
  145. * </table>
  146. *
  147. * \section SSec_BuildModule_LUFA_GCC_OptionalParams Optional Parameters
  148. *
  149. * <table>
  150. * <tr>
  151. * <td><tt>BOARD</tt></td>
  152. * <td>LUFA board hardware drivers to use (see \ref Page_DeviceSupport).</td>
  153. * </tr>
  154. * </table>
  155. *
  156. * \section SSec_BuildModule_LUFA_GCC_ProvidedVariables Module Provided Variables
  157. *
  158. * <table>
  159. * <tr>
  160. * <td><i>None</i></td>
  161. * </tr>
  162. * </table>
  163. *
  164. * \section SSec_BuildModule_LUFA_GCC_ProvidedMacros Module Provided Macros
  165. *
  166. * <table>
  167. * <tr>
  168. * <td><i>None</i></td>
  169. * </tr>
  170. * </table>
  171. */
  172. /** \page Page_BuildTroubleshooting Troubleshooting Information
  173. *
  174. * LUFA uses a lot of advanced features of the AVR-GCC compiler, linker, and
  175. * surrounding binaries. This can sometimes lead to problems compiling
  176. * applications if one of these features is buggy in the version of the tools
  177. * used in a build environment. Missing utilities and incorrectly set makefile
  178. * configuration options can also result in different errors being produced
  179. * when compilation or other operations are attempted. The table below lists a
  180. * set of commonly encountered errors and their resolutions.
  181. *
  182. * <table>
  183. * <tr>
  184. * <th>Problem</th>
  185. * <th>Resolution</th>
  186. * </tr>
  187. * <tr>
  188. * <td>Error &quot;<b><tt>relocation truncated to fit: R_AVR_13_PCREL against symbol <i>{X}</i></tt></b>&quot; shown when compiling.</td>
  189. * <td>Try compiling with the setting <tt>LINKER_RELAXATIONS=N</tt> in your LUFA Build System 2.0 makefile, or remove the line <tt>-Wl,--relax</tt>
  190. * from other makefiles. Alternatively, make sure you have the latest version of the Atmel Toolchain installed for your system.</td>
  191. * </tr>
  192. * <tr>
  193. * <td>Error &quot;<b><tt>error: ld terminated with signal 11 [Segmentation fault]</tt></b>&quot; shown when compiling.</td>
  194. * <td>Try compiling with the setting <tt>DEBUG_LEVEL=2</tt> in your LUFA Build System 2.0 makefile, or make sure you are using <tt>binutils</tt> version 2.22 or later.</td>
  195. * </tr>
  196. * <tr>
  197. * <td>Error &quot;<b><tt>EMERGENCY ABORT: INFINITE RECURSION DETECTED</tt></b>&quot; shown when compiling.</td>
  198. * <td>Make sure you are using an up to date version of GNU Make when compiling. This error is a safety system added to the mid-level makefiles, to prevent an issue with
  199. * GNU make or other variants of Make causing an infinitely recursive build.</td>
  200. * </tr>
  201. * <tr>
  202. * <td>Error &quot;<b><tt>Unsupported architecture &quot;<i>{X}</i>&quot;</tt></b>&quot; shown when compiling.</td>
  203. * <td>Ensure your makefile's <tt>ARCH</tt> setting is set to one of the architecture names (case-sensitive) supported by the version of LUFA you are compiling against.</td>
  204. * </tr>
  205. * <tr>
  206. * <td>Error &quot;<b><tt>Makefile <i>{X}</i> value not set</tt></b>&quot; shown when compiling.</td>
  207. * <td>The specified Makefile value was not configured in your project's makefile or on the command line, and the nominated setting is required by one or more LUFA
  208. * build system modules. Define the value in your project makefile and try again.</td>
  209. * </tr>
  210. * <tr>
  211. * <td>Error &quot;<b><tt>Makefile <i>{X}</i> option cannot be blank</tt></b>&quot; shown when compiling.</td>
  212. * <td>The specified Makefile value was configured in your project's makefile or on the command line, but was set to an empty value. For the nominated configuration
  213. * option, an empty value is not allowed. Define the nominated setting to a correct non-blank value and try again.</td>
  214. * </tr>
  215. * <tr>
  216. * <td>Error &quot;<b><tt>Makefile <i>{X}</i> option must be Y or N</tt></b>&quot; shown when compiling.</td>
  217. * <td>The specified Makefile value was configured in your project's makefile or on the command line, but was set to a value other than a Y (for "Yes") or "N" (for "No").
  218. * This configuration option is required to be one of the aforementioned boolean values, and other values are invalid. Set this option to either Y or N and try again.</td>
  219. * </tr>
  220. * <tr>
  221. * <td>Error &quot;<b><tt>Unknown input source file formats: <i>{X}</i></tt></b>&quot; shown when compiling.</td>
  222. * <td>The nominated source files, specified in your project's makefile in the <tt>SRC</tt> configuration option, has an extension that the LUFA build system does not
  223. * recognise. The file extensions are case sensitive, and must be one of the supported formats (<tt>*.c</tt>, <tt>*.cpp</tt> or <tt>*.S</tt>).</td>
  224. * </tr>
  225. * <tr>
  226. * <td>Error &quot;<b><tt>Cannot build with OBJDIR parameter set - one or more object file name is not unique</tt></b>&quot; shown when compiling.</td>
  227. * <td>When a project is built with a non-empty <tt>OBJDIR</tt> object directory name set, all input source files must have unique names, excluding extension and path.
  228. * This means that input files that are named identically and differ only by their path or extension are invalid when this mode is used.</td>
  229. * </tr>
  230. * <tr>
  231. * <td>Error &quot;<b><tt>Source file does not exist: <i>{X}</i></tt></b>&quot; shown when compiling.</td>
  232. * <td>The nominated input source file, specified in the user project's <tt>SRC</tt> parameter, could not be found. Ensure the source file exists and the absolute or
  233. * relative path given in the user project makefile is correct and try again.</td>
  234. * </tr>
  235. * <tr>
  236. * <td>Error &quot;<b><tt>Doxygen configuration file <i>{X}</i> does not exist</tt></b>&quot; shown when upgrading a Doxygen configuration file.</td>
  237. * <td>The nominated Doxygen configuration file, specified in the user project's <tt>DOXYGEN_CONF</tt> parameter, could not be found. Ensure the configuration file exists
  238. * and the absolute or relative path given in the user project makefile is correct and try again, or run the appropriate makefile target to generate a new configuration
  239. * file.</td>
  240. * </tr>
  241. * <tr>
  242. * <td>Error &quot;<b><tt>avr-gcc: error: unrecognized option '<i>{X}</i>'</tt></b>&quot; shown when compiling.</td>
  243. * <td>An unrecognised option was supplied to the compiler, usually in the <tt>C_FLAGS</tt>, <tt>CPP_FLAGS</tt>, <tt>ASM_FLAGS</tt> or <tt>CC_FLAGS</tt> configuration
  244. * options. The nominated compiler switch may be invalid, or unsupported by the version of AVR-GCC on the host system. Remove the unrecognised flag if invalid, or
  245. * upgrade to the latest AVR-GCC. If the option is a valid linker option, use the prefix "-Wl," to ensure it is passed to the linker correctly.</td>
  246. * </tr>
  247. * <tr>
  248. * <td>Error &quot;<b><tt>makefile:{X}: {Y}.mk: No such file or directory</tt></b>&quot; shown when make is invoked.</td>
  249. * <td>The path to the nominated makefile module was incorrect. This usually indicates that the makefile <tt>LUFA_PATH</tt> option is not set to a valid relative or
  250. * absolute path to the LUFA library core.</td>
  251. * </tr>
  252. * <tr>
  253. * <td>Error &quot;<b><tt>fatal error: LUFAConfig.h: No such file or directory</tt></b>&quot; shown when compiling.</td>
  254. * <td>The <tt>USE_LUFA_CONFIG_HEADER</tt> compile time option was set in the user project makefile, but the user supplied <tt>LUFAConfig.h</tt> header could not be
  255. * found. Ensure that the directory that contains this configuration file is correctly passed to the compiler via the -I switch in the makefile <tt>CC_FLAGS</tt>
  256. * parameter.</td>
  257. * </tr>
  258. * <tr>
  259. * <td>Error &quot;<b><tt>ld.exe: section .apitable_trampolines loaded at <i>{X}</i> overlaps section .text</tt></b>&quot; shown when compiling a bootloader.</td>
  260. * <td>The bootloader is compiling too large for the given <tt>FLASH_SIZE_KB</tt> and <tt>BOOT_SECTION_SIZE_KB</tt> parameters set in the bootloader makefile. This
  261. * usually indicates that these values are incorrect for the specified device the bootloader is targeting. If these values are correct, a newer version of the
  262. * compiler may need to be used to ensure that the bootloader is built within the section size constraints of the target device.</td>
  263. * </tr>
  264. * <tr>
  265. * <td>Error &quot;<b><tt>unknown MCU '<i>{X}</i>' specified</tt></b>&quot; shown when compiling.</td>
  266. * <td>The specified microcontroller device model name set in the user application's makefile as the <tt>MCU</tt> parameter is incorrect, or unsupported by the
  267. * version of the compiler being used. Make sure the model name is correct, or upgrade to the latest Atmel Toolchain to obtain newer device support.</td>
  268. * </tr>
  269. * <tr>
  270. * <td>Error &quot;<b><tt>undefined reference to `<i>{X}</i>'</tt></b>&quot; shown when compiling.</td>
  271. * <td>This is usually caused by a missing source file in the user application's <tt>SRC</tt> configuration parameter. If the indicated symbol is one from the LUFA
  272. * library, you may be missing a LUFA source makefile module (see \ref Page_BuildModule_LUFA_SOURCES).</td>
  273. * </tr>
  274. * </table>
  275. *
  276. * For troubleshooting other errors you encounter, please see \ref Sec_ProjectHelp.
  277. */