README.txt 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851
  1. README
  2. ^^^^^^
  3. README for NuttX port to the Embedded Artists' base board with the NXP
  4. the LPCXpresso daughter board.
  5. Contents
  6. ^^^^^^^^
  7. LCPXpresso LPC1768 Board
  8. Embedded Artist's Base Board
  9. Development Environment
  10. GNU Toolchain Options
  11. NuttX EABI "buildroot" Toolchain
  12. NuttX OABI "buildroot" Toolchain
  13. NXFLAT Toolchain
  14. Code Red IDE
  15. LEDs
  16. LPCXpresso Configuration Options
  17. Configurations
  18. LCPXpresso LPC1768 Board
  19. ^^^^^^^^^^^^^^^^^^^^^^^^
  20. Pin Description Connector On Board Base Board
  21. -------------------------------- --------- -------------- ---------------------
  22. P0[0]/RD1/TXD3/SDA1 J6-9 I2C E2PROM SDA TXD3/SDA1
  23. P0[1]/TD1/RXD3/SCL J6-10 RXD3/SCL1
  24. P0[2]/TXD0/AD0[7] J6-21
  25. P0[3]/RXD0/AD0[6] J6-22
  26. P0[4]/I2SRX-CLK/RD2/CAP2.0 J6-38 CAN_RX2
  27. P0[5]/I2SRX-WS/TD2/CAP2.1 J6-39 CAN_TX2
  28. P0[6]/I2SRX_SDA/SSEL1/MAT2[0] J6-8 SSEL1, OLED CS
  29. P0[7]/I2STX_CLK/SCK1/MAT2[1] J6-7 SCK1, OLED SCK
  30. P0[8]/I2STX_WS/MISO1/MAT2[2] J6-6 MISO1
  31. P0[9]/I2STX_SDA/MOSI1/MAT2[3] J6-5 MOSI1, OLED data in
  32. P0[10] J6-40 TXD2/SDA2
  33. P0[11] J6-41 RXD2/SCL2
  34. P0[15]/TXD1/SCK0/SCK J6-13 TXD1/SCK0
  35. P0[16]/RXD1/SSEL0/SSEL J6-14 RXD1/SSEL0
  36. P0[17]/CTS1/MISO0/MISO J6-12 MISO0
  37. P0[18]/DCD1/MOSI0/MOSI J6-11 MOSI0
  38. P0[19]/DSR1/SDA1 PAD17 N/A
  39. P0[20]/DTR1/SCL1 PAD18 I2C E2PROM SCL N/A
  40. P0[21]/RI1/MCIPWR/RD1 J6-23
  41. P0[22]/RTS1/TD1 J6-24 LED
  42. P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] J6-15 AD0.0
  43. P0[24]/AD0[1]/I2SRX_WS/CAP3[1] J6-16 AD0.1
  44. P0[25]/AD0[2]/I2SRX_SDA/TXD3 J6-17 AD0.2
  45. P0[26]/AD0[3]/AOUT/RXD3 J6-18 AD0.3/AOUT / RGB LED
  46. P0[27]/SDA0/USB_SDA J6-25
  47. P0[28]/SCL0 J6-26
  48. P0[29]/USB_D+ J6-37 USB_D+
  49. P0[30]/USB_D- J6-36 USB_D-
  50. P1[0]/ENET-TXD0 J6-34? TXD0 TX-(Ethernet PHY)
  51. P1[1]/ENET_TXD1 J6-35? TXD1 TX+(Ethernet PHY)
  52. P1[4]/ENET_TX_EN TXEN N/A
  53. P1[8]/ENET_CRS CRS_DV/MODE2 N/A
  54. P1[9]/ENET_RXD0 J6-32? RXD0/MODE0 RD-(Ethernet PHY)
  55. P1[10]/ENET_RXD1 J6-33? RXD1/MODE1 RD+(Ethernet PHY)
  56. P1[14]/ENET_RX_ER RXER/PHYAD0 N/A
  57. P1[15]/ENET_REF_CLK REFCLK N/A
  58. P1[16]/ENET_MDC MDC N/A
  59. P1[17]/ENET_MDIO MDIO N/A
  60. P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] PAD1 N/A
  61. P1[19]/MC0A/USB_PPWR/N_CAP1.1 PAD2 N/A
  62. P1[20]/MCFB0/PWM1.2/SCK0 PAD3 N/A
  63. P1[21]/MCABORT/PWM1.3/SSEL0 PAD4 N/A
  64. P1[22]/MC0B/USB-PWRD/MAT1.0 PAD5 N/A
  65. P1[23]/MCFB1/PWM1.4/MISO0 PAD6 N/A
  66. P1[24]/MCFB2/PWM1.5/MOSI0 PAD7 N/A
  67. P1[25]/MC1A/MAT1.1 PAD8 N/A
  68. P1[26]/MC1B/PWM1.6/CAP0.0 PAD9 N/A
  69. P1[27]/CLKOUT/USB-OVRCR-N/CAP0.1 PAD10 N/A
  70. P1[28]/MC2A/PCAP1.0/MAT0.0 PAD11 N/A
  71. P1[29]/MC2B/PCAP1.1/MAT0.1 PAD12 N/A
  72. P1[30]/VBUS/AD0[4] J6-19 AD0.4
  73. P1[31]/SCK1/AD0[5] J6-20 AD0.5
  74. P2[0]/PWM1.1/TXD1 J6-42 PWM1.1 / RGB LED / RS422 RX
  75. P2[1]/PWM1.2/RXD1 J6-43 PWM1.2 / OLED voltage / RGB LED
  76. P2[2]/PWM1.3/CTS1/TRACEDATA[3] J6-44 PWM1.3
  77. P2[3]/PWM1.4/DCD1/TRACEDATA[2] J6-45 PWM1.4
  78. P2[4]/PWM1.5/DSR1/TRACEDATA[1] J6-46 PWM1.5
  79. P2[5]/PWM1[6]/DTR1/TRACEDATA[0] J6-47 PWM1.6
  80. P2[6]/PCAP1[0]/RI1/TRACECLK J6-48
  81. P2[7]/RD2/RTS1 J6-49 OLED command/data
  82. P2[8]/TD2/TXD2 J6-50
  83. P2[9]/USB_CONNECT/RXD2 PAD19 USB Pullup N/A
  84. P2[10]/EINT0/NMI J6-51
  85. P2[11]/EINT1/I2STX_CLK J6-52
  86. P2[12]/EINT2/I2STX_WS j6-53
  87. P2[13]/EINT3/I2STX_SDA J6-27
  88. P3[25]/MAT0.0/PWM1.2 PAD13 N/A
  89. P3[26]/STCLK/MAT0.1/PWM1.3 PAD14 N/A
  90. P4[28]/RX-MCLK/MAT2.0/TXD3 PAD15 N/A
  91. P4[29]/TX-MCLK/MAT2.1/RXD3 PAD16 N/A
  92. Embedded Artist's Base Board
  93. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  94. Jumpers
  95. -------
  96. There are many jumpers on the base board. A usable combination is the
  97. default jumper settings WITH the two J54 jumpers both removed. Those
  98. jumpers are for ISP support and will cause the board to reset.
  99. To use the SD, J55 must be set to provide chip select PIO1_11 signal as
  100. the SD slot chip select.
  101. SD Slot
  102. -------
  103. Base-board J4/J6 LPC1768
  104. SD Signal Pin Pin
  105. --- ----------- ----- --------
  106. CS PIO1_11* 55 P2.2
  107. DIN PIO0_9-MOSI 5 P0.9 MOSI1
  108. DOUT PIO0_8-MISO 6 P0.8 MISO1
  109. CLK PIO2_11-SCK 7 P0.9 SCK1
  110. CD PIO2_10 52 P2.11
  111. These jumper settings are required:
  112. *J55 must be set to provide chip select PIO1_11 signal as the SD slot
  113. chip select.
  114. USB Device
  115. ----------
  116. Base-board J4/J6 LPC1768
  117. Signal Pin Pin
  118. ------------------- ----- --------
  119. PIO0_6-USB_CONNECT* 23 P0.21
  120. USB_DM 36 USB_D-
  121. USB_DP 37 USB_D+
  122. PIO0_3-VBUS_SENSE** 39 P0.5
  123. These jumper settings are listed for information only. They are *not*
  124. required for use with NuttX and LPCXpresso. The configurable pins
  125. (P0.21 and P0.5) are not used!
  126. *J14 must be set to permit GPIO control of the USB connect pin
  127. **J12 must be set to permit GPIO control of the USB vbus sense pin
  128. J23 is associated the LEDs used for USB support
  129. Here is a more detailed pin mapping:
  130. ---------------------------------------------+------+-----------------------------------------------
  131. LPCXpresso | J4/6 | Base Board
  132. ---------------------------------------------| |-----------------------------------------------
  133. LPC1768 Signal | | Signal Connection
  134. ------------------------------ --------------+------+------------------- ---------------------------
  135. P0.29/USB-D+ P0[29]/USB-D+ | 37 | USB_DP USB D+
  136. P0.30/USB-D- P0[30]/USB-D- | 36 | USB_DM USB D-
  137. P1.18/USB-UP-LED/PWM1.1/CAP1.0 PAD1 | N/A | N/A N/A
  138. P1.30/VBUS/AD0.4 P1[30] | 19 | PIO1_3 (Not used on board)
  139. P2.9/USB-CONNECT/RXD2* PAD19 | N/A | N/A N/A
  140. ------------------------------ --------------+------+------------------- ---------------------------
  141. P0.21/RI1/RD1 P0[21] | 23 | PIO0_6-USB_CONNECT VBUS via J14 and transistor
  142. P0.5/I2SRX-WS/TD2/CAP2.1 P0[5] | 39 | PIO0_3-VBUS_SENSE VBUS via J12
  143. ------------------------------ --------------+------+------------------- ---------------------------
  144. *P2.9 connects to a transistor driven USB-D+ pullup on the LPCXpresso board.
  145. 96x64 White OLED with I2C/SPI interface
  146. ---------------------------------------
  147. The OLED display can be connected either to the SPI-bus or the I2C-bus.
  148. Jumper Settings:
  149. - For the SPI interface (default), insert jumpers in J42, J43, J45 pin1-2
  150. and J46 pin 1-2.
  151. - For I2C interface, insert jumpers in J45 pin 2-3, J46 pin 2-3 and J47.
  152. In either case insert a jumper in J44 in order to allow PIO1_10 to control
  153. the OLED-voltage.
  154. Jumper Signal Control:
  155. J42: Short: SPI Open: I2C (Default: inserted)
  156. J44: Allow control of OLED voltage (Default: inserted)
  157. PIO1_10-------->J44 ---------->FAN5331
  158. Common Reset:
  159. PIO0_0-RESET ---------------> RES#
  160. J43: Select OLED chip select
  161. J58: For embed (Default: not inserted)
  162. PIO0_2--------------->J43 ---->CS#
  163. PIO2_7--------->J58 ->J43 ---->D/C#
  164. PIO0_8-MISO --------^
  165. J45: Select SPI or I2C clock (Default: SPI clock)
  166. PIO2_11-SCK---->J45 ----------> D0
  167. PIO0_4-SCL------------^
  168. J46: Select serial data input (Default: SPI MOSI)
  169. PIO0_9-MOSI---->J46 ----------> D1
  170. I2C_SDA---------------^
  171. J47: Allow I2C bi-directional communications (Default: SPI unidirectional)
  172. PIO0_5-SDA---->J47 ----------> D2
  173. LPCXpresso Signals
  174. ----------------------------+-------+-------------- ----------------------------------------
  175. LPC1758 Pin | J4/6 | Base Board Description
  176. ----------------------------+-------+-------------- ----------------------------------------
  177. P2.1/PWM1.2/RXD1 | 43 | PIO1_10 FAN5331 Power Control (SHDN#)
  178. RESET_N | 4 | PIO0_0-RESET OLED reset (RES#) -- Resets EVERYTHING
  179. P0.6/I2SRX-SDA/SSEL1/MAT2.0 | 8 | PIO0_2 OLED chip select (CS#)
  180. P2.7/RD2/RTS1 | 49 | PIO2_7 OLED command/data (D/C#)
  181. P0.7/I2STX-CLK/SCK1/MAT2.1 | 7 | PIO2_11-SCK OLED clock (D0)
  182. P0.9/I2STX-SDA/MOSI1/MAT2.3 | 5 | PIO0_9-MOSI OLED data in (D1)
  183. ----------------------------+-------+-------------- ----------------------------------------
  184. Development Environment
  185. ^^^^^^^^^^^^^^^^^^^^^^^
  186. Either Linux or Cygwin on Windows can be used for the development environment.
  187. The source has been built only using the GNU toolchain (see below). Other
  188. toolchains will likely cause problems. Testing was performed using the Cygwin
  189. environment.
  190. GNU Toolchain Options
  191. ^^^^^^^^^^^^^^^^^^^^^
  192. The NuttX make system has been modified to support the following different
  193. toolchain options.
  194. 1. The Code Red GNU toolchain
  195. 2. The CodeSourcery GNU toolchain,
  196. 3. The devkitARM GNU toolchain,
  197. 4. The NuttX buildroot Toolchain (see below).
  198. All testing has been conducted using the Code Red toolchain and the
  199. make system is setup to default to use the Code Red Linux toolchain. To use
  200. the other toolchain, you simply need add one of the following configuration
  201. options to your .config (or defconfig) file:
  202. CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery under Windows
  203. CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL=y : CodeSourcery under Linux
  204. CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM=y : devkitARM under Windows
  205. CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
  206. CONFIG_ARMV7M_TOOLCHAIN_CODEREDW=n : Code Red toolchain under Windows
  207. CONFIG_ARMV7M_TOOLCHAIN_CODEREDL=y : Code Red toolchain under Linux
  208. You may also have to modify the PATH environment variable if your make cannot
  209. find the tools.
  210. NOTE: the CodeSourcery (for Windows), devkitARM, and Code Red (for Windoes)
  211. are Windows native toolchains. The CodeSourcey (for Linux), Code Red (for Linux)
  212. and NuttX buildroot toolchains are Cygwin and/or Linux native toolchains. There
  213. are several limitations to using a Windows based toolchain in a Cygwin
  214. environment. The three biggest are:
  215. 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
  216. performed automatically in the Cygwin makefiles using the 'cygpath' utility
  217. but you might easily find some new path problems. If so, check out 'cygpath -w'
  218. 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
  219. are used in Nuttx (e.g., include/arch). The make system works around these
  220. problems for the Windows tools by copying directories instead of linking them.
  221. But this can also cause some confusion for you: For example, you may edit
  222. a file in a "linked" directory and find that your changes had no effect.
  223. That is because you are building the copy of the file in the "fake" symbolic
  224. directory. If you use a Windows toolchain, you should get in the habit of
  225. making like this:
  226. make clean_context all
  227. An alias in your .bashrc file might make that less painful.
  228. NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
  229. level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
  230. -Os.
  231. NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
  232. the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
  233. path or will get the wrong version of make.
  234. Code Red IDE
  235. ^^^^^^^^^^^^
  236. NuttX is built using command-line make. It can be used with an IDE, but some
  237. effort will be required to create the project.
  238. Makefile Build
  239. --------------
  240. Under Linux Eclipse, it is pretty easy to set up an "empty makefile project" and
  241. simply use the NuttX makefile to build the system. That is almost for free
  242. under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
  243. makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
  244. there is a lot of help on the internet).
  245. Native Build
  246. ------------
  247. Here are a few tips before you start that effort:
  248. 1) Select the toolchain that you will be using in your .config file
  249. 2) Start the NuttX build at least one time from the Cygwin command line
  250. before trying to create your project. This is necessary to create
  251. certain auto-generated files and directories that will be needed.
  252. 3) Set up include pathes: You will need include/, arch/arm/src/lpc17xx,
  253. arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
  254. 4) All assembly files need to have the definition option -D __ASSEMBLY__
  255. on the command line.
  256. Startup files will probably cause you some headaches. The NuttX startup file
  257. is arch/arm/src/lpc17x/lpc17_vectors.S.
  258. Using Code Red GNU Tools from Cygwin
  259. ------------------------------------
  260. Under Cygwin, the Code Red command line tools (e.g., arm-non-eabi-gcc) cannot
  261. be executed because they only have execute privileges for Administrators. I
  262. worked around this by:
  263. Opening a native Cygwin RXVT as Administrator (Right click, "Run as administrator"),
  264. then executing 'chmod 755 *.exe' in the following directories:
  265. /cygdrive/c/nxp/lpcxpreeso_3.6/bin, and
  266. /cygdrive/c/nxp/lpcxpreeso_3.6/Tools/bin
  267. Command Line Flash Programming
  268. ------------------------------
  269. If using LPCLink as your debug connection, first of all boot the LPC-Link using
  270. the script:
  271. bin\Scripts\bootLPCXpresso type
  272. where type = winusb for Windows XP, or type = hid for Windows Vista / 7.
  273. Now run the flash programming utility with the following options
  274. flash_utility wire -ptarget -flash-load[-exec]=filename [-load-base=base_address]
  275. Where flash_utility is one of:
  276. crt_emu_lpc11_13 (for LPC11xx or LPC13xx parts)
  277. crt_emu_cm3_nxp (for LPC17xx parts)
  278. crt_emu_a7_nxp (for LPC21/22/23/24 parts)
  279. crt_emu_a9_nxp (for LPC31/32 and LPC29xx parts)
  280. crt_emu_cm3_lmi (for TI Stellaris parts)
  281. wire is one of:
  282. (empty) (for Red Probe+, Red Probe, RDB1768v1, or TI Stellaris evaluation boards)
  283. -wire=hid (for RDB1768v2 without upgraded firmware)
  284. -wire=winusb (for RDB1768v2 with upgraded firmware)
  285. -wire=winusb (for LPC-Link on Windows XP)
  286. -wire=hid (for LPC-Link on Windows Vista/ Windows 7)
  287. target is the target chip name. For example LPC1343, LPC1114/301, LPC1768 etc.
  288. filename is the file to flash program. It may be an executable (axf) or a binary
  289. (bin) file. If using a binary file, the base_address must be specified.
  290. base_address is the base load address when flash programming a binary file. It
  291. should be specified as a hex value with a leading 0x.
  292. Note:
  293. - flash-load will leave the processor in a stopped state
  294. - flash-load-exec will start execution of application as soon as download has
  295. completed.
  296. Examples
  297. To load the executable file app.axf and start it executing on an LPC1758
  298. target using Red Probe, use the following command line:
  299. crt_emu_cm3_nxp -pLPC1758 -flash-load-exec=app.axf
  300. To load the binary file binary.bin to address 0x1000 to an LPC1343 target
  301. using LPC-Link on Windows XP, use the following command line:
  302. crt_emu_lpc11_13_nxp -wire=hid -pLPC1343 -flash-load=binary.bin -load-base=0x1000
  303. tools/flash.sh
  304. --------------
  305. All of the above steps are automated in the bash script flash.sh that can
  306. be found in the configs/lpcxpresso/tools directory.
  307. NuttX EABI "buildroot" Toolchain
  308. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  309. A GNU GCC-based toolchain is assumed. The PATH environment variable should
  310. be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
  311. different from the default in your PATH variable).
  312. If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
  313. Bitbucket download site (https://bitbucket.org/nuttx/nuttx/downloads/).
  314. This GNU toolchain builds and executes in the Linux or Cygwin environment.
  315. 1. You must have already configured Nuttx in <some-dir>/nuttx.
  316. cd tools
  317. ./configure.sh lpcxpresso-lpc1768/<sub-dir>
  318. 2. Download the latest buildroot package into <some-dir>
  319. 3. unpack the buildroot tarball. The resulting directory may
  320. have versioning information on it like buildroot-x.y.z. If so,
  321. rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
  322. 4. cd <some-dir>/buildroot
  323. 5. cp configs/cortexm3-eabi-defconfig-4.6.3 .config
  324. 6. make oldconfig
  325. 7. make
  326. 8. Make sure that the PATH variable includes the path to the newly built
  327. binaries.
  328. See the file configs/README.txt in the buildroot source tree. That has more
  329. details PLUS some special instructions that you will need to follow if you
  330. are building a Cortex-M3 toolchain for Cygwin under Windows.
  331. NOTE: Unfortunately, the 4.6.3 EABI toolchain is not compatible with the
  332. the NXFLAT tools. See the top-level TODO file (under "Binary loaders") for
  333. more information about this problem. If you plan to use NXFLAT, please do not
  334. use the GCC 4.6.3 EABI toochain; instead use the GCC 4.3.3 OABI toolchain.
  335. See instructions below.
  336. NuttX OABI "buildroot" Toolchain
  337. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  338. The older, OABI buildroot toolchain is also available. To use the OABI
  339. toolchain:
  340. 1. When building the buildroot toolchain, either (1) modify the cortexm3-eabi-defconfig-4.6.3
  341. configuration to use EABI (using 'make menuconfig'), or (2) use an exising OABI
  342. configuration such as cortexm3-defconfig-4.3.3
  343. 2. Modify the Make.defs file to use the OABI conventions:
  344. +CROSSDEV = arm-nuttx-elf-
  345. +ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
  346. +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld -no-check-sections
  347. -CROSSDEV = arm-nuttx-eabi-
  348. -ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
  349. -NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
  350. NXFLAT Toolchain
  351. ^^^^^^^^^^^^^^^^
  352. If you are *not* using the NuttX buildroot toolchain and you want to use
  353. the NXFLAT tools, then you will still have to build a portion of the buildroot
  354. tools -- just the NXFLAT tools. The buildroot with the NXFLAT tools can
  355. be downloaded from the NuttX Bitbucket download site
  356. (https://bitbucket.org/nuttx/nuttx/downloads/).
  357. This GNU toolchain builds and executes in the Linux or Cygwin environment.
  358. 1. You must have already configured Nuttx in <some-dir>/nuttx.
  359. cd tools
  360. ./configure.sh lpcxpresso-lpc1768/<sub-dir>
  361. 2. Download the latest buildroot package into <some-dir>
  362. 3. unpack the buildroot tarball. The resulting directory may
  363. have versioning information on it like buildroot-x.y.z. If so,
  364. rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
  365. 4. cd <some-dir>/buildroot
  366. 5. cp configs/cortexm3-defconfig-nxflat .config
  367. 6. make oldconfig
  368. 7. make
  369. 8. Make sure that the PATH variable includes the path to the newly built
  370. NXFLAT binaries.
  371. LEDs
  372. ^^^^
  373. If CONFIG_ARCH_LEDS is defined, then support for the LPCXpresso LEDs will be
  374. included in the build. See:
  375. - configs/lpcxpresso-lpc1768/include/board.h - Defines LED constants, types and
  376. prototypes the LED interface functions.
  377. - configs/lpcxpresso-lpc1768/src/lpcxpresso-lpc1768.h - GPIO settings for the LEDs.
  378. - configs/lpcxpresso-lpc1768/src/up_leds.c - LED control logic.
  379. The LPCXpresso LPC1768 has a single LEDs (there are more on the Embedded Artists
  380. base board, but those are not controlled by NuttX). Usage this single LED by NuttX
  381. is as follows:
  382. - The LED is not illuminated until the LPCXpresso completes initialization.
  383. If the LED is stuck in the OFF state, this means that the LPCXpresso did not
  384. complete initializeation.
  385. - Each time the OS enters an interrupt (or a signal) it will turn the LED OFF and
  386. restores its previous stated upon return from the interrupt (or signal).
  387. The normal state, after initialization will be a dull glow. The brightness of
  388. the glow will be inversely related to the proportion of time spent within interrupt
  389. handling logic. The glow may decrease in brightness when the system is very
  390. busy handling device interrupts and increase in brightness as the system becomes
  391. idle.
  392. Stuck in the OFF state suggests that that the system never completed
  393. initialization; Stuck in the ON state would indicated that the system
  394. intialialized, but is not takint interrupts.
  395. - If a fatal assertion or a fatal unhandled exception occurs, the LED will flash
  396. strongly as a slow, 2Hz rate.
  397. LPCXpresso Configuration Options
  398. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  399. General Architecture Settings:
  400. CONFIG_ARCH - Identifies the arch/ subdirectory. This should
  401. be set to:
  402. CONFIG_ARCH=arm
  403. CONFIG_ARCH_family - For use in C code:
  404. CONFIG_ARCH_ARM=y
  405. CONFIG_ARCH_architecture - For use in C code:
  406. CONFIG_ARCH_CORTEXM3=y
  407. CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
  408. CONFIG_ARCH_CHIP=lpc17xx
  409. CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
  410. chip:
  411. CONFIG_ARCH_CHIP_LPC1768=y
  412. CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
  413. hence, the board that supports the particular chip or SoC.
  414. CONFIG_ARCH_BOARD=lpcxpresso-lpc1768
  415. CONFIG_ARCH_BOARD_name - For use in C code
  416. CONFIG_ARCH_BOARD_LPCEXPRESSO=y
  417. CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
  418. of delay loops
  419. CONFIG_ENDIAN_BIG - define if big endian (default is little
  420. endian)
  421. CONFIG_RAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
  422. CONFIG_RAM_SIZE=(32*1024) (32Kb)
  423. There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
  424. CONFIG_RAM_START - The start address of installed DRAM
  425. CONFIG_RAM_START=0x10000000
  426. CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
  427. have LEDs
  428. CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
  429. stack. If defined, this symbol is the size of the interrupt
  430. stack in bytes. If not defined, the user task stacks will be
  431. used during interrupt handling.
  432. CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
  433. CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
  434. CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
  435. cause a 100 second delay during boot-up. This 100 second delay
  436. serves no purpose other than it allows you to calibratre
  437. CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
  438. the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
  439. the delay actually is 100 seconds.
  440. Individual subsystems can be enabled:
  441. CONFIG_LPC17_MAINOSC=y
  442. CONFIG_LPC17_PLL0=y
  443. CONFIG_LPC17_PLL1=n
  444. CONFIG_LPC17_ETHERNET=n
  445. CONFIG_LPC17_USBHOST=n
  446. CONFIG_LPC17_USBOTG=n
  447. CONFIG_LPC17_USBDEV=n
  448. CONFIG_LPC17_UART0=y
  449. CONFIG_LPC17_UART1=n
  450. CONFIG_LPC17_UART2=n
  451. CONFIG_LPC17_UART3=n
  452. CONFIG_LPC17_CAN1=n
  453. CONFIG_LPC17_CAN2=n
  454. CONFIG_LPC17_SPI=n
  455. CONFIG_LPC17_SSP0=n
  456. CONFIG_LPC17_SSP1=n
  457. CONFIG_LPC17_I2C0=n
  458. CONFIG_LPC17_I2C1=n
  459. CONFIG_LPC17_I2S=n
  460. CONFIG_LPC17_TMR0=n
  461. CONFIG_LPC17_TMR1=n
  462. CONFIG_LPC17_TMR2=n
  463. CONFIG_LPC17_TMR3=n
  464. CONFIG_LPC17_RIT=n
  465. CONFIG_LPC17_PWM0=n
  466. CONFIG_LPC17_MCPWM=n
  467. CONFIG_LPC17_QEI=n
  468. CONFIG_LPC17_RTC=n
  469. CONFIG_LPC17_WDT=n
  470. CONFIG_LPC17_ADC=n
  471. CONFIG_LPC17_DAC=n
  472. CONFIG_LPC17_GPDMA=n
  473. CONFIG_LPC17_FLASH=n
  474. LPC17xx specific device driver settings
  475. CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
  476. console and ttys0 (default is the UART0).
  477. CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
  478. This specific the size of the receive buffer
  479. CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
  480. being sent. This specific the size of the transmit buffer
  481. CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
  482. CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
  483. CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
  484. CONFIG_UARTn_2STOP - Two stop bits
  485. LPC17xx specific CAN device driver settings. These settings all
  486. require CONFIG_CAN:
  487. CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
  488. Standard 11-bit IDs.
  489. CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN1 is defined.
  490. CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN2 is defined.
  491. CONFIG_CAN1_DIVISOR - CAN1 is clocked at CCLK divided by this number.
  492. (the CCLK frequency is divided by this number to get the CAN clock).
  493. Options = {1,2,4,6}. Default: 4.
  494. CONFIG_CAN2_DIVISOR - CAN2 is clocked at CCLK divided by this number.
  495. (the CCLK frequency is divided by this number to get the CAN clock).
  496. Options = {1,2,4,6}. Default: 4.
  497. CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
  498. CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7
  499. LPC17xx specific PHY/Ethernet device driver settings. These setting
  500. also require CONFIG_NET and CONFIG_LPC17_ETHERNET.
  501. CONFIG_ETH0_PHY_KS8721 - Selects Micrel KS8721 PHY
  502. CONFIG_PHY_AUTONEG - Enable auto-negotion
  503. CONFIG_PHY_SPEED100 - Select 100Mbit vs. 10Mbit speed.
  504. CONFIG_PHY_FDUPLEX - Select full (vs. half) duplex
  505. CONFIG_NET_EMACRAM_SIZE - Size of EMAC RAM. Default: 16Kb
  506. CONFIG_NET_NTXDESC - Configured number of Tx descriptors. Default: 18
  507. CONFIG_NET_NRXDESC - Configured number of Rx descriptors. Default: 18
  508. CONFIG_NET_WOL - Enable Wake-up on Lan (not fully implemented).
  509. CONFIG_NET_REGDEBUG - Enabled low level register debug. Also needs
  510. CONFIG_DEBUG_FEATURES.
  511. CONFIG_NET_DUMPPACKET - Dump all received and transmitted packets.
  512. Also needs CONFIG_DEBUG_FEATURES.
  513. CONFIG_NET_HASH - Enable receipt of near-perfect match frames.
  514. CONFIG_LPC17_MULTICAST - Enable receipt of multicast (and unicast) frames.
  515. Automatically set if CONFIG_NET_IGMP is selected.
  516. LPC17xx USB Device Configuration
  517. CONFIG_LPC17_USBDEV_FRAME_INTERRUPT
  518. Handle USB Start-Of-Frame events.
  519. Enable reading SOF from interrupt handler vs. simply reading on demand.
  520. Probably a bad idea... Unless there is some issue with sampling the SOF
  521. from hardware asynchronously.
  522. CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT
  523. Enable high priority interrupts. I have no idea why you might want to
  524. do that
  525. CONFIG_LPC17_USBDEV_NDMADESCRIPTORS
  526. Number of DMA descriptors to allocate in SRAM.
  527. CONFIG_LPC17_USBDEV_DMA
  528. Enable lpc17xx-specific DMA support
  529. CONFIG_LPC17_USBDEV_NOVBUS
  530. Define if the hardware implementation does not support the VBUS signal
  531. CONFIG_LPC17_USBDEV_NOLED
  532. Define if the hardware implementation does not support the LED output
  533. LPC17xx USB Host Configuration (the LPCXpresso does not support USB Host)
  534. CONFIG_USBHOST_OHCIRAM_SIZE
  535. Total size of OHCI RAM (in AHB SRAM Bank 1)
  536. CONFIG_USBHOST_NEDS
  537. Number of endpoint descriptors
  538. CONFIG_USBHOST_NTDS
  539. Number of transfer descriptors
  540. CONFIG_USBHOST_TDBUFFERS
  541. Number of transfer descriptor buffers
  542. CONFIG_USBHOST_TDBUFSIZE
  543. Size of one transfer descriptor buffer
  544. CONFIG_USBHOST_IOBUFSIZE
  545. Size of one end-user I/O buffer. This can be zero if the
  546. application can guarantee that all end-user I/O buffers
  547. reside in AHB SRAM.
  548. Configurations
  549. ^^^^^^^^^^^^^^
  550. Each LPCXpresso configuration is maintained in a sub-directory and can be
  551. selected as follow:
  552. cd tools
  553. ./configure.sh lpcxpresso-lpc1768/<subdir>
  554. cd -
  555. Where <subdir> is one of the following:
  556. dhcpd:
  557. This builds the DCHP server using the apps/examples/dhcpd application
  558. (for execution from FLASH.) See apps/examples/README.txt for information
  559. about the dhcpd example.
  560. NOTES:
  561. 1. This configuration uses the mconf-based configuration tool. To
  562. change this configurations using that tool, you should:
  563. a. Build and install the kconfig-mconf tool. See nuttx/README.txt
  564. see additional README.txt files in the NuttX tools repository.
  565. b. Execute 'make menuconfig' in nuttx/ in order to start the
  566. reconfiguration process.
  567. 2. Jumpers: Nothing special. Use the default base board jumper
  568. settings.
  569. nsh:
  570. Configures the NuttShell (nsh) located at apps/examples/nsh. The
  571. Configuration enables both the serial and telnet NSH interfaces.
  572. NOTES:
  573. 1. This configuration uses the mconf-based configuration tool. To
  574. change this configurations using that tool, you should:
  575. a. Build and install the kconfig-mconf tool. See nuttx/README.txt
  576. see additional README.txt files in the NuttX tools repository.
  577. b. Execute 'make menuconfig' in nuttx/ in order to start the
  578. reconfiguration process.
  579. 2. This configuration has been used for testing the microSD card.
  580. This support is, however, disabled in the base configuration.
  581. At last attempt, the SPI-based mircroSD does not work at
  582. higher fequencies. Setting the SPI frequency to 400000
  583. removes the problem. There must be some more optimal
  584. value that could be determined with additional experimetnation.
  585. Jumpers: J55 must be set to provide chip select PIO1_11 signal as
  586. the SD slot chip select.
  587. nx:
  588. And example using the NuttX graphics system (NX). This example
  589. uses the UG-9664HSWAG01 driver.
  590. NOTES:
  591. 1. This configuration uses the mconf-based configuration tool. To
  592. change this configurations using that tool, you should:
  593. a. Build and install the kconfig-mconf tool. See nuttx/README.txt
  594. see additional README.txt files in the NuttX tools repository.
  595. b. Execute 'make menuconfig' in nuttx/ in order to start the
  596. reconfiguration process.
  597. 2. Jumpers: There are several jumper settings needed by the OLED.
  598. All are the default settings:
  599. J42: Close to select the SPI interface (Default: closed)
  600. J43: Close to support OLED command/data select (Default: closed)
  601. J44: Close to allow control of OLED voltage (Default: closed)
  602. J45: Close to select SPI clock (Default: closed)
  603. J46: Close SPI data input (MOSI) (Default:closed)
  604. thttpd:
  605. This builds the THTTPD web server example using the THTTPD and
  606. the apps/examples/thttpd application.
  607. NOTES:
  608. 1. This configuration uses the mconf-based configuration tool. To
  609. change this configurations using that tool, you should:
  610. a. Build and install the kconfig-mconf tool. See nuttx/README.txt
  611. see additional README.txt files in the NuttX tools repository.
  612. b. Execute 'make menuconfig' in nuttx/ in order to start the
  613. reconfiguration process.
  614. 2. You will need to build the NXFLAT toolchain as described above in
  615. order to use this example.
  616. 3. Build setup (easily reconfigured):
  617. CONFIG_HOST_LINUX=y : Linux
  618. CONFIG_ARMV7M_TOOLCHAIN_CODEREDL=y : CodeRed for Linux
  619. 4. Jumpers: Nothing special. Use the default base board jumper
  620. settings.
  621. usbmsc:
  622. This configuration directory exercises the USB mass storage
  623. class driver at apps/system/usbmsc. See apps/examples/README.txt
  624. for more information.
  625. NOTES:
  626. 1. This configuration uses the mconf-based configuration tool. To
  627. change this configurations using that tool, you should:
  628. a. Build and install the kconfig-mconf tool. See nuttx/README.txt
  629. see additional README.txt files in the NuttX tools repository.
  630. b. Execute 'make menuconfig' in nuttx/ in order to start the
  631. reconfiguration process.
  632. 2. At present, the value for the SD SPI frequency is too high and the
  633. SD will fail. Setting that frequency to 400000 removes the problem.
  634. TODO: Tune this frequency to some optimal value.
  635. 3. Jumpers: J55 must be set to provide chip select PIO1_11 signal as
  636. the SD slot chip select.