ConfiguringApps.txt 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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_ConfiguringApps Configuring the Demos, Bootloaders and Projects
  7. *
  8. * If the target microcontroller model, architecture, clock speed, board or other settings are different from the current
  9. * settings, they must be changed and the project recompiled from the source code before being programmed into the microcontroller.
  10. * Most project configuration options are located in the <tt>makefile</tt> build script inside each LUFA application's folder,
  11. * however some demo or application-specific configuration settings are located in one or more of the source files of the project.
  12. * See each project's individual documentation for application-specific configuration values.
  13. *
  14. * Each project "makefile" contains all the script and configuration data required to compile each project. When opened with
  15. * any regular basic text editor such as Notepad or WordPad (ensure that the save format is a pure ASCII text format) the
  16. * build configuration settings may be altered.
  17. *
  18. * \see \ref Page_BuildSystem for information on the LUFA build system.
  19. *
  20. * \section Sec_ConfiguringApps_AppMakefileParams The Default Application Makefile Template
  21. *
  22. * Below is a copy of the default LUFA application makefile, which can be used as a template for each application.
  23. *
  24. * \verbinclude makefile_template
  25. *
  26. * Inside each makefile, a number of configuration variables are listed with the syntax "<VARIABLE NAME> = <VALUE>". For
  27. * each application, the important standard variables which should be altered are:
  28. *
  29. * - <b>MCU</b>, the target processor model
  30. * - <b>ARCH</b>, the target microcontroller architecture
  31. * - <b>BOARD</b>, the target board hardware
  32. * - <b>F_CPU</b>, the target CPU master clock frequency, after any prescaling
  33. * - <b>F_USB</b>, the target raw input clock to the USB module of the processor
  34. * - <b>OPTIMIZATION</b>, the level of optimization to compile with
  35. * - <b>TARGET</b>, the name of the target output binary and other files
  36. * - <b>SRC</b>, the list of source files to compile/assemble/link
  37. * - <b>LUFA_PATH</b>, the path to the LUFA library core source code
  38. * - <b>CC_FLAGS</b>, the common command line flags to pass to the C/C++ compiler, assembler and linker
  39. * - <b>LD_FLAGS</b>, the command line flags to pass to the linker
  40. *
  41. * These values should be changed to reflect the build hardware.
  42. *
  43. * \subsection SSec_ConfiguringApps_MCU The MCU Parameter
  44. * This parameter indicates the target microcontroller model for the compiled application. This should be set to the model of the target
  45. * microcontroller (such as the AT90USB1287, or the ATMEGA32U4), in all lower-case (e.g. "at90usb1287"). Note that not all demos support all the
  46. * microcontroller models and architectures, as they may make use of peripherals or modes only present in some devices.
  47. *
  48. * For supported processor models, see \ref Page_DeviceSupport.
  49. *
  50. * \subsection SSec_ConfiguringApps_ARCH The ARCH Parameter
  51. * This parameter indicates the target microcontroller architecture the library is to be compiled for. Different microcontroller
  52. * architectures require different source files to be compiled into the final binary, and so this option must be set to the correct
  53. * architecture for the selected platform.
  54. *
  55. * For supported processor architectures, see \ref Page_DeviceSupport.
  56. *
  57. * \subsection SSec_ConfiguringApps_BOARD The BOARD Parameter
  58. * This parameter indicates the target board hardware for the compiled application. Some LUFA library drivers are board-specific,
  59. * such as the LED driver, and the library needs to know the layout of the target board. If you are using one of the board models listed
  60. * on the main library page, change this parameter to the board name in all UPPER-case.
  61. *
  62. * If you are not using any board-specific drivers in the LUFA library, or you are using a custom board layout, change this to read
  63. * "USER" (no quotes) instead of a standard board name. If the USER board type is selected and the application makes use of one or more
  64. * board-specific hardware drivers inside the LUFA library, then the appropriate stub drives files should be copied from the \c /CodeTemplates/DriverStubs/
  65. * directory into a /Board/ folder inside the application directory, and the stub driver completed with the appropriate code to drive the
  66. * custom board's hardware.
  67. *
  68. * For boards with built in hardware driver support within the LUFA library, see \ref Page_DeviceSupport.
  69. *
  70. * \subsection SSec_ConfiguringApps_F_CPU The F_CPU Parameter
  71. * This parameter indicates the target microcontroller's main CPU clock frequency, in Hz. This is used by many libraries (and applications) for
  72. * timing related purposes, and should reflect the actual CPU speed after any prescaling or adjustments are performed.
  73. *
  74. * \subsection SSec_ConfiguringApps_F_USB The F_USB Parameter
  75. * This parameter indicates the raw input clock frequency to the USB module within the microcontroller in Hz. This may be very different on some platforms
  76. * to the main CPU clock or other peripheral/bus clocks.
  77. *
  78. * \note On AVR8 platforms, this must be equal to \c 8000000 or \c 16000000.
  79. *
  80. * \note On XMEGA platforms, this must be equal to a multiple of 6000000 from \c 6000000 to \c 48000000.
  81. *
  82. * \note On UC3 platforms, this must be equal to a multiple of 12000000 from \c 12000000 to \c 48000000.
  83. *
  84. * \subsection SSec_ConfiguringApps_OPTIMIZATION The OPTIMIZATION Parameter
  85. * This parameter indicates the level of optimization to use when compiling the application. This will allow you to compile with an optimization level
  86. * supported by GCC, from <tt>0</tt> (no optimization) to <tt>3</tt> (fastest runtime optimization) or <tt>s</tt> (smallest size).
  87. *
  88. * \subsection SSec_ConfiguringApps_TARGET The TARGET Parameter
  89. * This parameter indicates the application target name, which is used as the base filename for the build binary and debugging files. This will be the
  90. * name of the output files once linked together into the final application, ready to load into the target.
  91. *
  92. * \subsection SSec_ConfiguringApps_SRC The SRC Parameter
  93. * This parameter indicates the source files used to compile the application, as a list of C (<tt>*.c</tt>), C++ (<tt>*.cpp</tt>) and Assembly (<tt>*.S</tt>) files. Note that
  94. * all assembly files must end in a <b>capital</b> .S extension, as lowercase .s files are reserved for GCC intermediate files.
  95. *
  96. * \subsection SSec_ConfiguringApps_LUFA_PATH The LUFA_PATH Parameter
  97. * As each LUFA program requires the LUFA library source code to compile correctly, the application must know where the LUFA library is located. This
  98. * value specifies the path to the LUFA library core. This path may be relative or absolute, however note than even under Windows based systems the
  99. * forward-slash (/) path separator must be used.
  100. *
  101. * \subsection SSec_ConfiguringApps_CC_FLAGS The CC_FLAGS Parameter
  102. * This parameter lists the compiler flags passed to the C/C++ compiler, the assembler and the linker. These are used as-is directly to GCC and thus
  103. * must match GCC's command line options as given in the GCC manual. This variable may be used to define tokens directly on the command line, enable or
  104. * disable warnings, adjust the target-specific tuning parameters or other options.
  105. *
  106. * \subsection SSec_ConfiguringApps_LD_FLAGS The LD_FLAGS Parameter
  107. * This parameter lists the linker flags passed exclusively to the linker. These are used as-is directly to GCC and thus must match GCC's command line
  108. * linker options as given in the GCC manual. This variable may be used to create or relocate custom data sections, or enable linker specific behaviors.
  109. *
  110. *
  111. * \section Sec_ExampleAppConfig Example Application Makefile Configurations
  112. * Below is an example makefile for an AVR8 based AT90USB1287 running at 8MHz, to compile a program called "MyApplication":
  113. * \verbatim
  114. MCU = at90usb1287
  115. ARCH = AVR8
  116. BOARD = NONE
  117. F_CPU = 8000000
  118. F_USB = $(F_CPU)
  119. OPTIMIZATION = s
  120. TARGET = MyApplication
  121. SRC = MyApplication.c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
  122. LUFA_PATH = ../../../../LUFA
  123. CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/
  124. LD_FLAGS =
  125. \endverbatim
  126. *
  127. * Below is an example makefile for an XMEGA based ATXMEGA128A1U running at 32MHz, to compile a program called "MyApplication":
  128. * \verbatim
  129. MCU = atxmega128a1u
  130. ARCH = XMEGA
  131. BOARD = NONE
  132. F_CPU = 32000000
  133. F_USB = 48000000
  134. OPTIMIZATION = s
  135. TARGET = MyApplication
  136. SRC = MyApplication.c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
  137. LUFA_PATH = ../../../../LUFA
  138. CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/
  139. LD_FLAGS =
  140. \endverbatim
  141. *
  142. * Below is an example makefile for a UC3 based AT32UC3A0512 running at 50MHz, to compile a program called "MyApplication":
  143. * \verbatim
  144. MCU = uc3a0512
  145. ARCH = UC3
  146. BOARD = NONE
  147. F_CPU = 50000000
  148. F_USB = 48000000
  149. OPTIMIZATION = s
  150. TARGET = MyApplication
  151. SRC = MyApplication.c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
  152. LUFA_PATH = ../../../../LUFA
  153. CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/
  154. LD_FLAGS =
  155. \endverbatim
  156. */