README.txt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. README
  2. ^^^^^^
  3. README for NuttX port to the Stellaris EKK-LM3S9B96 Evaluation Kit
  4. Contents
  5. ^^^^^^^^
  6. Stellaris EKK-LM3S9B96 Evaluation Kit
  7. Development Environment
  8. GNU Toolchain Options
  9. IDEs
  10. NuttX EABI "buildroot" Toolchain
  11. NuttX OABI "buildroot" Toolchain
  12. NXFLAT Toolchain
  13. Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options
  14. Configurations
  15. Stellaris EKK-LM3S9B96 Evaluation Kit
  16. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  17. The EKK-LM3S9B96 evaluation kit provides the following features:
  18. o LM3S9B96 high-performance Stellaris microcontroller and large memory
  19. – 32-bit ARM® Cortex™-M3 core
  20. – 256 KB single-cycle Flash memory, 96 KB single-cycle SRAM, 23.7 KB single-cycle ROM
  21. o Ethernet 10/100 port with two LED indicators
  22. o USB 2.0 Full-Speed OTG port
  23. o SAFERTOS™ operating system in microcontroller ROM
  24. o Virtual serial communications port capability
  25. o Oversized board pads for GPIO access
  26. o User pushbutton and LED
  27. o Detachable ICDI board can be used for debugging other Luminary Micro boards
  28. o Easy to customize
  29. Features of the LM3S9B96 Microcontroller
  30. o ARM® Cortex™-M3 architecture
  31. – 80-MHz operation
  32. – ARM Cortex SysTick Timer
  33. – Integrated Nested Vectored Interrupt Controller (NVIC)
  34. o External Peripheral Interface (EPI)
  35. o 256 KB single-cycle flash
  36. o 96 KB single-cycle SRAM
  37. o Four general-purpose 32-bit timers
  38. o Integrated Ethernet MAC and PHY
  39. o Three fully programmable 16C550-type UARTs
  40. o Two 10-bit channels (inputs) when used as single-ended inputs
  41. o Three independent integrated analog comparators
  42. o Two CAN modules
  43. o Two I2C modules
  44. o Two SSI modules
  45. o Two Watchdog Timers (32-bit)
  46. o Three PWM generator blocks
  47. – One 16-bit counter
  48. – Two comparators
  49. – Produces eight independent PWM signals
  50. – One dead-band generator
  51. o Two QEI modules with position integrator for tracking encoder position
  52. o Up to 65 GPIOs, depending on user configuration
  53. o On-chip low drop-out (LDO) voltage regulator
  54. GPIO Usage
  55. PIN SIGNAL EVB Function
  56. --- ----------- ---------------------------------------
  57. 26 PA0/U0RX Virtual COM port receive
  58. 27 PA1/U0TX Virtual COM port transmit
  59. 66 PB0/USB0ID USBID signal from the USB-On-the-Go
  60. 67 PB1/USB0VBUS USB VBUS input signal from USB-OTG
  61. 92 PB4/GPIO User pushbutton SW2.
  62. 80 PC0/TCK/SWCLK JTAG or SWD clock input
  63. 79 PC1/TMS/SWDIO JTAG TMS input or SWD bidirectional signal SWDIO
  64. 78 PC2/TDI JTAG TDI signal input
  65. 77 PC3/TDO/SWO JTAG TDO output or SWD trace signal SWO output.
  66. 10 PD0/GPIO User LED
  67. 60 PF2/LED1 Ethernet LED1 (yellow)
  68. 59 PF3/LED0 Ethernet LED0 (green)
  69. 83 PH3/USB0EPEN USB-OTG power switch
  70. 76 PH4/USB0PFLT Overcurrent input status from USB-OTG power switch
  71. Development Environment
  72. ^^^^^^^^^^^^^^^^^^^^^^^
  73. Either Linux or Cygwin on Windows can be used for the development environment.
  74. The source has been built only using the GNU toolchain (see below). Other
  75. toolchains will likely cause problems. Testing was performed using the Cygwin
  76. environment.
  77. GNU Toolchain Options
  78. ^^^^^^^^^^^^^^^^^^^^^
  79. The NuttX make system has been modified to support the following different
  80. toolchain options.
  81. 1. The CodeSourcery GNU toolchain,
  82. 2. The devkitARM GNU toolchain,
  83. 3. The NuttX buildroot Toolchain (see below).
  84. All testing has been conducted using the NuttX buildroot toolchain. However,
  85. the make system is setup to default to use the devkitARM toolchain. To use
  86. the CodeSourcery or devkitARM, you simply need to add one of the following
  87. configuration options to your .config (or defconfig) file:
  88. CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery under Windows
  89. CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL=y : CodeSourcery under Linux
  90. CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM=y : devkitARM under Windows
  91. CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
  92. You may also have to modify the PATH environment variable if your make cannot
  93. find the tools.
  94. NOTE: the CodeSourcery (for Windows) and devkitARM are Windows native toolchains.
  95. The CodeSourcey (for Linux) and NuttX buildroot toolchains are Cygwin and/or Linux
  96. native toolchains. There are several limitations to using a Windows based
  97. toolchain in a Cygwin environment. The three biggest are:
  98. 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
  99. performed automatically in the Cygwin makefiles using the 'cygpath' utility
  100. but you might easily find some new path problems. If so, check out 'cygpath -w'
  101. 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
  102. are used in Nuttx (e.g., include/arch). The make system works around these
  103. problems for the Windows tools by copying directories instead of linking them.
  104. But this can also cause some confusion for you: For example, you may edit
  105. a file in a "linked" directory and find that your changes had no effect.
  106. That is because you are building the copy of the file in the "fake" symbolic
  107. directory. If you use a Windows toolchain, you should get in the habit of
  108. making like this:
  109. make clean_context all
  110. An alias in your .bashrc file might make that less painful.
  111. NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
  112. level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
  113. -Os.
  114. NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
  115. the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
  116. path or will get the wrong version of make.
  117. NOTE 3: I recently (i.e., late 2011) tried building with the CodeSourcery Windows
  118. toolchain. The code worked but required 40 seconds to boot (or even until the
  119. status LED illuminates)!! Know idea why. With the buildroot tools, boot time is
  120. a couple of seconds.
  121. IDEs
  122. ^^^^
  123. NuttX is built using command-line make. It can be used with an IDE, but some
  124. effort will be required to create the project.
  125. Makefile Build
  126. --------------
  127. Under Eclipse, it is pretty easy to set up an "empty makefile project" and
  128. simply use the NuttX makefile to build the system. That is almost for free
  129. under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
  130. makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
  131. there is a lot of help on the internet).
  132. Native Build
  133. ------------
  134. Here are a few tips before you start that effort:
  135. 1) Select the toolchain that you will be using in your .config file
  136. 2) Start the NuttX build at least one time from the Cygwin command line
  137. before trying to create your project. This is necessary to create
  138. certain auto-generated files and directories that will be needed.
  139. 3) Set up include pathes: You will need include/, arch/arm/src/lm,
  140. arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
  141. 4) All assembly files need to have the definition option -D __ASSEMBLY__
  142. on the command line.
  143. Startup files will probably cause you some headaches. The NuttX startup file
  144. is arch/arm/src/tiva/tiva_vectors.S.
  145. NuttX EABI "buildroot" Toolchain
  146. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  147. A GNU GCC-based toolchain is assumed. The PATH environment variable should
  148. be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
  149. different from the default in your PATH variable).
  150. If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
  151. Bitbucket download site (https://bitbucket.org/nuttx/buildroot/downloads/).
  152. This GNU toolchain builds and executes in the Linux or Cygwin environment.
  153. 1. You must have already configured Nuttx in <some-dir>/nuttx.
  154. cd tools
  155. ./configure.sh ekk-lm3s9b96/<sub-dir>
  156. 2. Download the latest buildroot package into <some-dir>
  157. 3. unpack the buildroot tarball. The resulting directory may
  158. have versioning information on it like buildroot-x.y.z. If so,
  159. rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
  160. 4. cd <some-dir>/buildroot
  161. 5. cp configs/cortexm3-eabi-defconfig-4.6.3 .config
  162. 6. make oldconfig
  163. 7. make
  164. 8. Make sure that the PATH variable includes the path to the newly built
  165. binaries.
  166. See the file configs/README.txt in the buildroot source tree. That has more
  167. details PLUS some special instructions that you will need to follow if you
  168. are building a Cortex-M3 toolchain for Cygwin under Windows.
  169. NOTE: Unfortunately, the 4.6.3 EABI toolchain is not compatible with the
  170. the NXFLAT tools. See the top-level TODO file (under "Binary loaders") for
  171. more information about this problem. If you plan to use NXFLAT, please do not
  172. use the GCC 4.6.3 EABI toochain; instead use the GCC 4.3.3 OABI toolchain.
  173. See instructions below.
  174. NuttX OABI "buildroot" Toolchain
  175. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  176. The older, OABI buildroot toolchain is also available. To use the OABI
  177. toolchain:
  178. 1. When building the buildroot toolchain, either (1) modify the cortexm3-eabi-defconfig-4.6.3
  179. configuration to use EABI (using 'make menuconfig'), or (2) use an exising OABI
  180. configuration such as cortexm3-defconfig-4.3.3
  181. 2. Modify the Make.defs file to use the OABI conventions:
  182. +CROSSDEV = arm-nuttx-elf-
  183. +ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
  184. +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld -no-check-sections
  185. -CROSSDEV = arm-nuttx-eabi-
  186. -ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
  187. -NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
  188. NXFLAT Toolchain
  189. ^^^^^^^^^^^^^^^^
  190. If you are *not* using the NuttX buildroot toolchain and you want to use
  191. the NXFLAT tools, then you will still have to build a portion of the buildroot
  192. tools -- just the NXFLAT tools. The buildroot with the NXFLAT tools can
  193. be downloaded from the NuttX Bitbucket download site
  194. (https://bitbucket.org/nuttx/nuttx/downloads/).
  195. This GNU toolchain builds and executes in the Linux or Cygwin environment.
  196. 1. You must have already configured Nuttx in <some-dir>/nuttx.
  197. cd tools
  198. ./configure.sh lpcxpresso-lpc1768/<sub-dir>
  199. 2. Download the latest buildroot package into <some-dir>
  200. 3. unpack the buildroot tarball. The resulting directory may
  201. have versioning information on it like buildroot-x.y.z. If so,
  202. rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
  203. 4. cd <some-dir>/buildroot
  204. 5. cp configs/cortexm3-defconfig-nxflat .config
  205. 6. make oldconfig
  206. 7. make
  207. 8. Make sure that the PATH variable includes the path to the newly built
  208. NXFLAT binaries.
  209. Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options
  210. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  211. CONFIG_ARCH - Identifies the arch/ subdirectory. This should
  212. be set to:
  213. CONFIG_ARCH=arm
  214. CONFIG_ARCH_family - For use in C code:
  215. CONFIG_ARCH_ARM=y
  216. CONFIG_ARCH_architecture - For use in C code:
  217. CONFIG_ARCH_CORTEXM3=y
  218. CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
  219. CONFIG_ARCH_CHIP=lm
  220. CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
  221. chip:
  222. CONFIG_ARCH_CHIP_LM3S9B96
  223. CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
  224. hence, the board that supports the particular chip or SoC.
  225. CONFIG_ARCH_BOARD=ekk-lm3s9b96 (for the Stellaris EKK-LM3S9b96 Evaluation Kit)
  226. CONFIG_ARCH_BOARD_name - For use in C code
  227. CONFIG_ARCH_BOARD_EKKLM3S9B96
  228. CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
  229. of delay loops
  230. CONFIG_ENDIAN_BIG - define if big endian (default is little
  231. endian)
  232. CONFIG_RAM_SIZE - Describes the installed DRAM (SRAM in this case):
  233. CONFIG_RAM_SIZE=0x00018000 (96Kb)
  234. CONFIG_RAM_START - The start address of installed DRAM
  235. CONFIG_RAM_START=0x20000000
  236. CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
  237. have LEDs
  238. CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
  239. stack. If defined, this symbol is the size of the interrupt
  240. stack in bytes. If not defined, the user task stacks will be
  241. used during interrupt handling.
  242. CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
  243. CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
  244. CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
  245. cause a 100 second delay during boot-up. This 100 second delay
  246. serves no purpose other than it allows you to calibratre
  247. CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
  248. the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
  249. the delay actually is 100 seconds.
  250. There are configurations for disabling support for interrupts GPIO ports.
  251. GPIOJ must be disabled because it does not exist on the LM3S9B96.
  252. Additional interrupt support can be disabled if desired to reduce memory
  253. footprint.
  254. CONFIG_TIVA_GPIOA_IRQS=y
  255. CONFIG_TIVA_GPIOB_IRQS=y
  256. CONFIG_TIVA_GPIOC_IRQS=y
  257. CONFIG_TIVA_GPIOD_IRQS=y
  258. CONFIG_TIVA_GPIOE_IRQS=y
  259. CONFIG_TIVA_GPIOF_IRQS=y
  260. CONFIG_TIVA_GPIOG_IRQS=y
  261. CONFIG_TIVA_GPIOH_IRQS=y
  262. CONFIG_TIVA_GPIOJ_IRQS=n << Always
  263. LM3S9B96 specific device driver settings
  264. CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
  265. console and ttys0 (default is the UART0).
  266. CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
  267. This specific the size of the receive buffer
  268. CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
  269. being sent. This specific the size of the transmit buffer
  270. CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
  271. CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
  272. CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
  273. CONFIG_UARTn_2STOP - Two stop bits
  274. CONFIG_TIVA_SSI0 - Select to enable support for SSI0
  275. CONFIG_TIVA_SSI1 - Select to enable support for SSI1
  276. CONFIG_SSI_POLLWAIT - Select to disable interrupt driven SSI support.
  277. Poll-waiting is recommended if the interrupt rate would be to
  278. high in the interrupt driven case.
  279. CONFIG_SSI_TXLIMIT - Write this many words to the Tx FIFO before
  280. emptying the Rx FIFO. If the SPI frequency is high and this
  281. value is large, then larger values of this setting may cause
  282. Rx FIFO overrun errors. Default: half of the Tx FIFO size (4).
  283. CONFIG_TIVA_ETHERNET - This must be set (along with CONFIG_NET)
  284. to build the Stellaris Ethernet driver
  285. CONFIG_TIVA_ETHLEDS - Enable to use Ethernet LEDs on the board.
  286. CONFIG_TIVA_BOARDMAC - If the board-specific logic can provide
  287. a MAC address (via tiva_ethernetmac()), then this should be selected.
  288. CONFIG_TIVA_ETHHDUPLEX - Set to force half duplex operation
  289. CONFIG_TIVA_ETHNOAUTOCRC - Set to suppress auto-CRC generation
  290. CONFIG_TIVA_ETHNOPAD - Set to suppress Tx padding
  291. CONFIG_TIVA_MULTICAST - Set to enable multicast frames
  292. CONFIG_TIVA_PROMISCUOUS - Set to enable promiscuous mode
  293. CONFIG_TIVA_BADCRC - Set to enable bad CRC rejection.
  294. CONFIG_TIVA_DUMPPACKET - Dump each packet received/sent to the console.
  295. Configurations
  296. ^^^^^^^^^^^^^^
  297. Each Stellaris EKK-LM3S9b96 Evaluation Kit configuration is maintained in a
  298. sub-directory and can be selected as follow:
  299. cd tools
  300. ./configure.sh ekk-lm3s9b96/<subdir>
  301. cd -
  302. Where <subdir> is one of the following:
  303. nsh:
  304. Configures the NuttShell (nsh) located at examples/nsh. The
  305. Configuration enables both the serial and telnetd NSH interfaces.
  306. NOTE: As it is configured now, you MUST have a network connected.
  307. Otherwise, the NSH prompt will not come up because the Ethernet
  308. driver is waiting for the network to come up. That is probably
  309. a bug in the Ethernet driver behavior!