README.txt 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025
  1. README
  2. ^^^^^^
  3. Contents
  4. ^^^^^^^^
  5. o Overview
  6. - Description
  7. - Fake Interrupts
  8. - Timing Fidelity
  9. o Debugging
  10. o Issues
  11. - 64-bit Issues
  12. - Compiler differences
  13. - Stack Size Issues
  14. - Networking Issues
  15. - X11 Issues
  16. - Cygwin64 Issues
  17. - SMP
  18. o BASIC
  19. o Configurations
  20. Overview
  21. ^^^^^^^^
  22. Description
  23. -----------
  24. This README file describes the contents of the build configurations available
  25. for the NuttX "sim" target. The sim target is a NuttX port that runs as a
  26. user-space program under Linux or Cygwin. It is a very "low fidelity" embedded
  27. system simulation: This environment does not support any kind of asynchronous
  28. events -- there are nothing like interrupts in this context. Therefore, there
  29. can be no pre-empting events.
  30. Fake Interrupts
  31. ---------------
  32. In order to get timed behavior, the system timer "interrupt handler" is called
  33. from the sim target's IDLE loop. The IDLE runs whenever there is no other task
  34. running. So, for example, if a task calls sleep(), then that task will suspend
  35. wanting for the time to elapse. If nothing else is available to run, then the
  36. IDLE loop runs and the timer increments, eventually re-awakening the sleeping task.
  37. Context switching is based on logic similar to setjmp() and longjmp().
  38. The sim target is used primarily as a development and test platform for new
  39. RTOS features. It is also of academic interest. But it has no real-world
  40. application that I know of.
  41. Timing Fidelity
  42. ---------------
  43. NOTE: In order to facility fast testing, the sim target's IDLE loop, by default,
  44. calls the system "interrupt handler" as fast as possible. As a result, there
  45. really are no noticeable delays when a task sleeps. However, the task really does
  46. sleep -- but the time scale is wrong. If you want behavior that is closer to
  47. normal timing, then you can define CONFIG_SIM_WALLTIME=y in your configuration
  48. file. This configuration setting will cause the sim target's IDLE loop to delay
  49. on each call so that the system "timer interrupt" is called at a rate approximately
  50. correct for the system timer tick rate. With this definition in the configuration,
  51. sleep() behavior is more or less normal.
  52. Debugging
  53. ^^^^^^^^^
  54. One of the best reasons to use the simulation is that is supports great, Linux-
  55. based debugging. Here are the steps that I following to use the Linux ddd
  56. graphical front-end to GDB:
  57. 1. Modify the top-level configuration file. Enable debug symbols by defining
  58. the following.
  59. cd <NuttX-Directory>
  60. CONFIG_DEBUG_SYMBOLS=y
  61. 2. Re-build:
  62. cd <NuttX-Directory>
  63. make clean
  64. make
  65. 3. Then start the debugging:
  66. ddd nuttx &
  67. gdb> b user_start
  68. gdb> r
  69. NOTE: This above steps work fine on both Linux and Cygwin. On Cygwin, you
  70. will need to start the Cywin-X server before running ddd.
  71. Issues
  72. ^^^^^^
  73. 64-Bit Issues
  74. -------------
  75. As mentioned above, context switching is based on logic like setjmp() and
  76. longjmp(). This context switching is available for 32-bit and 64-bit
  77. targets. You must, however, set the correct target in the configuration
  78. before you build: CONFIG_HOST_X86_64 or CONFIG_HOST_X86 for 64- and 32-bit
  79. targets, respectively. On a 64-bit machine, you can also force the 32-bit
  80. build with CONFIG_SIM_M32=y (which does not seem to be supported by more
  81. contemporary x86_64 compilers).
  82. There are other 64-bit issues as well. For example, addresses are retained in
  83. 32-bit unsigned integer types in a few places. On a 64-bit machine, the 32-bit
  84. address storage may corrupt 64-bit addressing. NOTE: This is really a bug --
  85. addresses should not be retained in uint32_t types but rather in uintptr_t types
  86. to avoid issues just like this.
  87. Compiler differences
  88. --------------------
  89. operator new:
  90. Problem: "'operator new' takes size_t ('...') as first parameter"
  91. Workaround: Add -fpermissive to the compilation flags
  92. Stack Size Issues
  93. -----------------
  94. When you run the NuttX simulation, it uses stacks allocated by NuttX from the
  95. NuttX heap. The memory management model is exactly the same in the simulation
  96. as it is real, target system. This is good because this produces a higher
  97. fidelity simulation.
  98. However, when the simulation calls into Linux/Cygwin libraries, it will still
  99. use these small simulation stacks. This happens, for example, when you call
  100. into the system to get and put characters to the console window or when you
  101. make x11 calls into the system. The programming model within those libraries
  102. will assume a Linux/Cygwin environment where the stack size grows dynamically
  103. and not the small, limited stacks of a deeply embedded system.
  104. As a consequence, those system libraries may allocate large data structures
  105. on the stack and overflow the small NuttX stacks. X11, in particular,
  106. requires large stacks. If you are using X11 in the simulation, make sure
  107. that you set aside a "lot" of stack for the X11 system calls (maybe 8 or 16Kb).
  108. The stack size for the thread that begins with user start is controlled
  109. by the configuration setting CONFIG_USERMAIN_STACKSIZE; you may need to
  110. increase this value to larger number to survive the X11 system calls.
  111. If you are running X11 applications as NSH add-on programs, then the stack
  112. size of the add-on program is controlled in another way. Here are the
  113. steps for increasing the stack size in that case:
  114. cd ../apps/builtin # Go to the builtin apps directory
  115. vi builtin_list.h # Edit this file and increase the stack size of the add-on
  116. rm .built *.o # This will force the builtin apps logic to rebuild
  117. Networking Issues
  118. -----------------
  119. I never did get networking to work on the sim target. It tries to use the tap device
  120. (/dev/net/tun) to emulate an Ethernet NIC, but I never got it correctly integrated
  121. with the NuttX networking (I probably should try using raw sockets instead).
  122. Update: Max Holtzberg reports to me that the tap device actually does work properly,
  123. but not in an NSH configuration because of stdio operations freeze the simulation.
  124. REVISIT: This may not long be an issue even with NSH because of the recent redesign
  125. of how the stdio devices are handled in the simulation (they should no longer freeze
  126. the simulation).
  127. X11 Issues
  128. ----------
  129. There is an X11-based framebuffer driver that you can use exercise the NuttX graphics
  130. subsystem on the simulator (see the sim/nx11 configuration below). This may require a
  131. lot of tinkering to get working, depending upon where your X11 installation stores
  132. libraries and header files and how it names libraries.
  133. For example, on UBuntu 9.09, I had to do the following to get a clean build:
  134. cd /usr/lib/
  135. sudo ln -s libXext.so.6.4.0 libXext.so
  136. (I also get a segmentation fault at the conclusion of the NX test -- that will need
  137. to get looked into as well).
  138. The X11 examples builds on Cygwin, but does not run. The last time I tried it,
  139. XOpenDisplay() aborted the program. UPDATE: This was caused by the small stack
  140. size and can be fixed by increasing the size of the NuttX stack that calls into
  141. X11. See the discussion "Stack Size Issues" above.
  142. Cygwin64 Issues
  143. ---------------
  144. There are some additional issues using the simulator with Cygwin64. Below is the
  145. summary of the changes that I had to make to get the simulator working in that
  146. environment:
  147. CONFIG_HOST_X86_64=y
  148. CONFIG_SIM_M32=n
  149. Need to select X64_64. Cygwin64 tools do not seem to support any option
  150. to build a 32-bit target.
  151. CONFIG_SIM_CYGWIN_DECORATED=n
  152. Older versions of Cygwin toolsdecorated C symbol names by adding an
  153. underscore to the beginning of the symbol name. Newer versions of
  154. Cygwin do not seem to do this. Deselecting CONFIG_SIM_CYGWIN_DECORATED
  155. will select the symbols without the leading underscore as needed by
  156. the Cygwin64 toolchain.
  157. How do you know if you need this option? You could look at the generated
  158. symbol tables to see if there are underscore characters at the beginning
  159. of the symbol names. Or, if you need this option, the simulation will not
  160. run: It will crash early, probably in some function due to the failure to
  161. allocate memory.
  162. In this case, when I tried to run nutt.exe from the command line, it
  163. exited silently. Running with GDB I get following (before hitting a
  164. breakpoint at main()):
  165. (gdb) r
  166. Starting program: /cygdrive/c/Users/Gregory/Documents/projects/nuttx/master/nuttx/nuttx.exe
  167. [New Thread 6512.0xda8]
  168. [New Thread 6512.0x998]
  169. 1 [main] nuttx 6512 C:\Users\Gregory\Documents\projects\nuttx\master\nuttx\nuttx.exe: *** fatal error - Internal error: Out of memory for new path buf.
  170. 736 [main] nuttx 6512 cygwin_exception::open_stackdumpfile: Dumping stack trace to nuttx.exe.stackdump
  171. [Thread 6512.0x998 exited with code 256]
  172. [Inferior 1 (process 6512) exited with code 0400]
  173. CONFIG_SIM_X8664_SYSTEMV=n
  174. CONFIG_SIM_X8664_MICROSOFT=y
  175. Selet Microsoft x64 calling convention.
  176. The Microsoft x64 calling convention is followed on Microsoft Windows and
  177. pre-boot UEFI (for long mode on x86-64). It uses registers RCX, RDX, R8,
  178. R9 for the first four integer or pointer arguments (in that order), and
  179. XMM0, XMM1, XMM2, XMM3 are used for floating point arguments. Additional
  180. arguments are pushed onto the stack (right to left). Integer return
  181. values (similar to x86) are returned in RAX if 64 bits or less. Floating
  182. point return values are returned in XMM0. Parameters less than 64 bits
  183. long are not zero extended; the high bits are not zeroed.
  184. SMP
  185. ---
  186. The configuration has basic support SMP testing. The simulation supports
  187. the emulation of multiple CPUs by creating multiple pthreads, each run a
  188. copy of the simulation in the same process address space.
  189. At present, the SMP simulation is not fully functional: It does operate
  190. on the simulated CPU threads for a few context switches then fails during
  191. a setjmp() operation. I suspect that this is not an issue with the NuttX
  192. SMP logic but more likely some chaos in the pthread controls. I have seen
  193. similar such strange behavior other times that I have tried to use
  194. setjmp/longmp from a signal handler! Like when I tried to implement
  195. simulated interrupts using signals.
  196. Apparently, if longjmp is invoked from the context of a signal handler,
  197. the result is undefined: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1318.htm
  198. You can enable SMP for ostest configuration by enabling:
  199. +CONFIG_SPINLOCK=y
  200. +CONFIG_SMP=y
  201. +CONFIG_SMP_NCPUS=2
  202. +CONFIG_SMP_IDLETHREAD_STACKSIZE=2048
  203. You also must enable near-realtime-performance otherwise even long
  204. timeouts will expire before a CPU thread even has a chance to execute.
  205. -# CONFIG_SIM_WALLTIME is not set
  206. +CONFIG_SIM_WALLTIME=y
  207. And you can enable some additional debug output with:
  208. -# CONFIG_DEBUG_SCHED is not set
  209. +CONFIG_DEBUG_SCHED=y
  210. -# CONFIG_SCHED_INSTRUMENTATION is not set
  211. +CONFIG_SCHED_INSTRUMENTATION=y
  212. The SMP configuration will run with:
  213. CONFIG_SMP_NCPUS=1
  214. In this case there is, of course, no muli-CPU processing, but this does
  215. verify the correctness of some the basic SMP logic.
  216. The NSH configuration can also be forced to run SMP, but suffers from
  217. the same quirky behavior. I can be made reliable if you modify
  218. arch/sim/src/up_idle.c so that the IDLE loop only runs for CPU0.
  219. Otherwise, often simuart_post() will be called from CPU1 and it will
  220. try to restart NSH on CPU0 and, again, the same quirkiness occurs.
  221. But for example, this command:
  222. nsh> sleep 1 &
  223. will execute the sleep command on CPU1 which has worked every time
  224. that I have tried it (which is not too many times).
  225. BASIC
  226. ^^^^^
  227. I have used the sim/nsh configuration to test Michael Haardt's BASIC interpreter
  228. that you can find at apps/interpreters/bas.
  229. Bas is an interpreter for the classic dialect of the programming language
  230. BASIC. It is pretty compatible to typical BASIC interpreters of the 1980s,
  231. unlike some other UNIX BASIC interpreters, that implement a different
  232. syntax, breaking compatibility to existing programs. Bas offers many ANSI
  233. BASIC statements for structured programming, such as procedures, local
  234. variables and various loop types. Further there are matrix operations,
  235. automatic LIST indentation and many statements and functions found in
  236. specific classic dialects. Line numbers are not required.
  237. There is also a test suite for the interpreter that can be found at
  238. apps/examples/bastest.
  239. Configuration
  240. -------------
  241. Below are the recommended configuration changes to use BAS with the
  242. stm32f4discovery/nsh configuration:
  243. Dependencies:
  244. CONFIG_LIBC_EXECFUNCS=y : exec*() functions are required
  245. CONFIG_LIBM=y : Some floating point library is required
  246. CONFIG_LIBC_FLOATINGPOINT=y : Floating point printing support is required
  247. CONFIG_LIBC_TMPDIR="/tmp" : Writeable temporary files needed for some commands
  248. Enable the BASIC interpreter. Other default options should be okay:
  249. CONFIG_INTERPRETERS_BAS=y : Enables the interpreter
  250. CONFIG_INTERPRETER_BAS_VT100=y
  251. The BASIC test suite can be included:
  252. CONFIG_FS_ROMFS=y : ROMFS support is needed
  253. CONFIG_EXAMPLES_BASTEST=y : Enables the BASIC test setup
  254. CONFIG_EXAMPLES_BASTEST_DEVMINOR=6
  255. CONFIG_EXAMPLES_BASTEST_DEVPATH="/dev/ram6"
  256. Usage
  257. -----
  258. This setup will initialize the BASIC test (optional): This will mount
  259. a ROMFS file system at /mnt/romfs that contains the BASIC test files:
  260. nsh> bastest
  261. Registering romdisk at /dev/ram6
  262. Mounting ROMFS filesystem at target=/mnt/romfs with source=/dev/ram6
  263. nsh>
  264. The interactive interpreter is started like:
  265. nsh> bas
  266. bas 2.4
  267. Copyright 1999-2014 Michael Haardt.
  268. This is free software with ABSOLUTELY NO WARRANTY.
  269. >
  270. Ctrl-D exits the interpreter.
  271. The test programs can be ran like this:
  272. nsh> bastest
  273. Registering romdisk at /dev/ram0
  274. Mounting ROMFS filesystem at target=/mnt/romfs with source=/dev/ram0
  275. nsh> bas /mnt/romfs/test01.bas
  276. 1
  277. hello
  278. 0.0002
  279. 0.0000020
  280. 0.0000002
  281. nsh>
  282. Or you can load a test into memory and execute it interactively:
  283. nsh> bas
  284. bas 2.4
  285. Copyright 1999-2014 Michael Haardt.
  286. This is free software with ABSOLUTELY NO WARRANTY.
  287. > load "/mnt/romfs/test01.bas"
  288. > run
  289. 1
  290. hello
  291. 0.0002
  292. 0.0000020
  293. 0.0000002
  294. >
  295. Configurations
  296. ^^^^^^^^^^^^^^
  297. Common Configuration Information
  298. --------------------------------
  299. 1. Each configuration is maintained in a sub-directory and can be selected
  300. as follow:
  301. cd <nuttx-directory>/tools
  302. ./configure.sh sim/<subdir>
  303. cd -
  304. Where <subdir> is one of the following sub-directories.
  305. 2. All configurations uses the mconf-based configuration tool. To
  306. change this configuration using that tool, you should:
  307. a. Build and install the kconfig mconf tool. See nuttx/README.txt
  308. see additional README.txt files in the NuttX tools repository.
  309. b. Execute 'make menuconfig' in nuttx/ in order to start the
  310. reconfiguration process.
  311. 3. Before building, make sure that the configuration is correct for you host platform:
  312. a. Linux, 32-bit CPU
  313. CONFIG_HOST_LINUX=y
  314. CONFIG_HOST_WINDOWS=n
  315. CONFIG_HOST_X86=y
  316. CONFIG_HOST_X86_64=n
  317. b. Linux, 64-bit CPU, 32-bit build
  318. CONFIG_HOST_LINUX=y
  319. CONFIG_HOST_WINDOWS=n
  320. CONFIG_HOST_X86=n
  321. CONFIG_HOST_X86_64=y
  322. CONFIG_SIM_X8664_MICROSOFT=n
  323. CONFIG_SIM_X8664_SYSTEMV=y
  324. CONFIG_SIM_M32=y
  325. c. Linux, 64-bit CPU, 64-bit build
  326. CONFIG_HOST_LINUX=y
  327. CONFIG_HOST_WINDOWS=n
  328. CONFIG_HOST_X86=n
  329. CONFIG_HOST_X86_64=y
  330. CONFIG_SIM_X8664_MICROSOFT=n
  331. CONFIG_SIM_X8664_SYSTEMV=y
  332. CONFIG_SIM_M32=n
  333. d. Cygwin, 32-bit
  334. CONFIG_HOST_LINUX=n
  335. CONFIG_HOST_WINDOWS=y
  336. CONFIG_WINDOWS_CYGWIN=y
  337. CONFIG_HOST_X86=y
  338. CONFIG_HOST_X86_64=n
  339. e. Cygwin64, 64-bit, 32-bit build
  340. I don't believe this configuration is supported by Cygwin64
  341. f. Cygwin64, 64-bit, 64-bit build
  342. CONFIG_HOST_LINUX=n
  343. CONFIG_HOST_WINDOWS=y
  344. CONFIG_WINDOWS_CYGWIN=y
  345. CONFIG_HOST_X86=n
  346. CONFIG_HOST_X86_64=y
  347. CONFIG_SIM_X8664_MICROSOFT=y
  348. CONFIG_SIM_X8664_SYSTEMV=n
  349. CONFIG_SIM_M32=n
  350. Configuration Sub-Directories
  351. -----------------------------
  352. configdata
  353. A unit test for the MTD configuration data driver.
  354. cxxtest
  355. The C++ standard libary test at apps/examples/cxxtest configuration. This
  356. test is used to verify the uClibc++ port to NuttX.
  357. NOTES
  358. -----
  359. 1. Before you can use this example, you must first install the uClibc++
  360. C++ library. This is located outside of the NuttX source tree in the
  361. NuttX uClibc++ GIT repository. See the README.txt file there for
  362. instructions on how to install uClibc++
  363. 2. At present (2012/11/02), exceptions are disabled in this example
  364. CONFIG_UCLIBCXX_EXCEPTION=n). It is probably not necessary to
  365. disable exceptions.
  366. 3. Unfortunately, this example will not run now.
  367. The reason that the example will not run on the simulator has
  368. to do with when static constructors are enabled: In the simulator
  369. it will attempt to execute the static constructors before main()
  370. starts. BUT... NuttX is not initialized and this results in a crash.
  371. To really use this example, I will have to think of some way to
  372. postpone running C++ static initializers until NuttX has been
  373. initialized.
  374. ipforward
  375. This is an NSH configuration that includes a simple test of the NuttX
  376. IP forwarding logic using apps/examples/ipforward. That example uses
  377. two TUN network devices to represent two networks. The test then sends
  378. packets from one network destined for the other network. The NuttX IP
  379. forwarding logic will recognize that the received packets are not destined
  380. for it and will forward the logic to the other TUN network. The
  381. application logic then both sends the packets on one network and receives
  382. and verifies the forwarded packet recieved on the other network. The
  383. received packets differ from the sent packets only in that the hop limit
  384. (TTL) has been decremented.
  385. Be default, this test will forward TCP packets. The test can be modified
  386. to support forwarding of ICMPv6 multicast packets with these changes to
  387. the .config file:
  388. -CONFIG_EXAMPLES_IPFORWARD_TCP=y
  389. +CONFIG_EXAMPLES_IPFORWARD_ICMPv6=y
  390. +CONFIG_NET_ICMPv6=y
  391. +CONFIG_NET_ICMPv6_PING=y
  392. +CONFIG_NET_ETHERNET=y
  393. +CONFIG_NET_IPFORWARD_BROADCAST=y
  394. Additional required settings will also be selected when you manually
  395. select the above via 'make menuconfig'.
  396. minibasic
  397. This configuration was used to test the Mini Basic port at
  398. apps/interpreters/minibasic.
  399. mount
  400. Configures to use apps/examples/mount.
  401. mtdpart
  402. This is the apps/examples/mtdpart test using a MTD RAM driver to
  403. simulate the FLASH part.
  404. mtdrwb
  405. This is the apps/examples/mtdrwb test using a MTD RAM driver to
  406. simulate the FLASH part.
  407. nettest
  408. Configures to use apps/examples/nettest. This configuration
  409. enables networking using the network TAP device.
  410. NOTES:
  411. 1. The NuttX network is not, however, functional on the Linux TAP
  412. device yet.
  413. UPDATE: The TAP device does apparently work according to a NuttX
  414. user (provided that it is not used with NSH: NSH waits on readline()
  415. for console input. When it calls readline(), the whole system blocks
  416. waiting from input from the host OS). My failure to get the TAP
  417. device working appears to have been a cockpit error.
  418. 2. As of NuttX-5.18, when built on Windows, this test does not try
  419. to use the TAP device (which is not available on Cygwin anyway),
  420. but inside will try to use the Cygwin WPCAP library. Only the
  421. most preliminary testing has been performed with the Cygwin WPCAP
  422. library, however.
  423. NOTE that the IP address is hard-coded in arch/sim/src/up_wpcap.c.
  424. You will either need to edit your configuration files to use 10.0.0.1
  425. on the "target" (CONFIG_EXAMPLES_NETTEST_*) or edit up_wpcap.c to
  426. select the IP address that you want to use.
  427. nsh
  428. Configures to use the NuttShell at apps/examples/nsh.
  429. NOTES:
  430. 1. This version has one builtin function: This configuration:
  431. apps/examples/hello.
  432. 2. This version has password protection enable. Here is the login:
  433. USERNAME: admin
  434. PASSWORD: Adminstrator
  435. The encrypted password is retained in /etc/passwd. I am sure that
  436. you will find this annoying. You can disable the password protection
  437. by de-selecting CONFIG_NSH_CONSOLE_LOGIN=y.
  438. 3. This configuration has BINFS enabled so that the builtin applications
  439. can be made visible in the file system. Because of that, the
  440. build in applications do not work as other examples.
  441. For example trying to execute the hello builtin application will
  442. fail:
  443. nsh> hello
  444. nsh: hello: command not found
  445. nsh>
  446. Unless you first mount the BINFS file system:
  447. nsh> mount -t binfs /bin
  448. nsh> ls /bin
  449. /bin:
  450. hello
  451. nsh> echo $PATH
  452. /bin
  453. nsh> hello
  454. Hello, World!!
  455. nsh>
  456. Notice that the executable 'hello' is found using the value in the PATH
  457. variable (which was preset to "/bin"). If the PATH variable were not set
  458. then you would have to use /bin/hello on the command line.
  459. nsh2
  460. This is another example that configures to use the NuttShell at apps/examples/nsh.
  461. Like nsh, this version uses NSH built-in functions: The nx, nxhello, and
  462. nxlines examples are included as built-in functions.
  463. NOTES:
  464. 1. X11 Configuration
  465. This configuration uses an X11-based framebuffer driver. Of course, this
  466. configuration can only be used in environments that support X11! (And it
  467. may not even be usable in all of those environments without some "tweaking"
  468. See discussion below under the nx11 configuration).
  469. nx
  470. Configures to use apps/examples/nx.
  471. NOTES:
  472. 1. Special Framebuffer Configuration
  473. Special simulated framebuffer configuration options:
  474. CONFIG_SIM_FBHEIGHT - Height of the framebuffer in pixels
  475. CONFIG_SIM_FBWIDTH - Width of the framebuffer in pixels.
  476. CONFIG_SIM_FBBPP - Pixel depth in bits
  477. 2. No Display!
  478. This version has NO DISPLAY and is only useful for debugging NX
  479. internals in environments where X11 is not supported. There is
  480. and additonal configuration that may be added to include an X11-
  481. based simulated framebuffer driver:
  482. CONFIG_SIM_X11FB - Use X11 window for framebuffer
  483. See the "nx11" configuration below for more information.
  484. 3. Multi- and Single-User Modes
  485. The default is the single-user NX implementation. To select
  486. the multi-user NX implementation:
  487. CONFG_NX_MULTIUSER=y
  488. CONFIG_DISABLE_MQUEUE=n
  489. nx11
  490. Configures to use apps/examples/nx. This configuration is similar
  491. to the nx configuration except that it adds support for an X11-
  492. based framebuffer driver. Of course, this configuration can only
  493. be used in environments that support X11! (And it may not even
  494. be usable in all of those environments without some "tweaking").
  495. 1. Special Framebuffer Configuration
  496. This configuration uses the same special simulated framebuffer
  497. configuration options as the nx configuration:
  498. CONFIG_SIM_X11FB - Use X11 window for framebuffer
  499. CONFIG_SIM_FBHEIGHT - Height of the framebuffer in pixels
  500. CONFIG_SIM_FBWIDTH - Width of the framebuffer in pixels.
  501. CONFIG_SIM_FBBPP - Pixel depth in bits
  502. 2. X11 Configuration
  503. But now, since CONFIG_SIM_X11FB is also selected the following
  504. definitions are needed
  505. CONFIG_SIM_FBBPP (must match the resolution of the display).
  506. CONFIG_FB_CMAP=y
  507. My system has 24-bit color, but packed into 32-bit words so
  508. the correct setting of CONFIG_SIM_FBBPP is 32.
  509. For whatever value of CONFIG_SIM_FBBPP is selected, the
  510. corresponding CONFIG_NX_DISABLE_*BPP setting must not be
  511. disabled.
  512. 3. Touchscreen Support
  513. A X11 mouse-based touchscreen simulation can also be enabled
  514. by setting:
  515. CONFIG_INPUT=y
  516. CONFIG_SIM_TOUCHSCREEN=y
  517. Then you must also have some application logic that will call
  518. board_tsc_setup(0) to register the touchscreen driver. See
  519. also configuration "touchscreen"
  520. NOTES:
  521. a. If you do not have the call to sim_tcinitialize(0), the build
  522. will mysteriously fail claiming that is can't find up_tcenter()
  523. and up_tcleave(). That is a consequence of the crazy way that
  524. the simulation is built and can only be eliminated by calling
  525. up_simtouchscreen(0) from your application.
  526. b. You must first call up_fbinitialize(0) before calling
  527. up_simtouchscreen() or you will get a crash.
  528. c. Call sim_tcunininitializee() when you are finished with the
  529. simulated touchscreen.
  530. d. Enable CONFIG_DEBUG_INPUT=y for touchscreen debug output.
  531. 4. X11 Build Issues
  532. To get the system to compile under various X11 installations
  533. you may have to modify a few things. For example, in order
  534. to find libXext, I had to make the following change under
  535. Ubuntu 9.09:
  536. cd /usr/lib/
  537. sudo ln -s libXext.so.6.4.0 libXext.so
  538. 5. Multi- and Single-User Modes
  539. The default is the single-user NX implementation. To select
  540. the multi-user NX implementation:
  541. CONFG_NX_MULTIUSER=y
  542. CONFIG_DISABLE_MQUEUE=n
  543. 6. apps/examples/nxterm
  544. This configuration is also set up to use the apps/examples/nxterm
  545. test instead of apps/examples/nx. To enable this configuration,
  546. First, select Multi-User mode as described above. Then add the
  547. following definitions to the defconfig file:
  548. -CONFIG_NXTERM=n
  549. +CONFIG_NXTERM=y
  550. -CONFIG_NX_MULTIUSER=n
  551. +CONFIG_NX_MULTIUSER=y
  552. -CONFIG_EXAMPLES_NX=y
  553. +CONFIG_EXAMPLES_NX=n
  554. -CONFIG_EXAMPLES_NXTERM=n
  555. +CONFIG_EXAMPLES_NXTERM=y
  556. See apps/examples/README.txt for further details.
  557. nxffs
  558. This is the apps/examples/nxffs test using a MTD RAM driver to
  559. simulate the FLASH part.
  560. nxlines
  561. This is the apps/examples/nxlines test.
  562. nxwm
  563. This is a special configuration setup for the NxWM window manager
  564. UnitTest. The NxWM window manager can be found here:
  565. nuttx-code/NxWidgets/nxwm
  566. The NxWM unit test can be found at:
  567. nuttx-code/NxWidgets/UnitTests/nxwm
  568. Documentation for installing the NxWM unit test can be found here:
  569. nuttx-code/NxWidgets/UnitTests/READEM.txt
  570. NOTES
  571. 1. There is an issue with running this example under the
  572. simulation. In the default configuration, this example will
  573. run the NxTerm example which waits on readline() for console
  574. input. When it calls readline(), the whole system blocks
  575. waiting from input from the host OS. So, in order to get
  576. this example to run, you must comment out the readline call in
  577. apps/nshlib/nsh_consolemain.c like:
  578. Index: nsh_consolemain.c
  579. ===================================================================
  580. --- nsh_consolemain.c (revision 4681)
  581. +++ nsh_consolemain.c (working copy)
  582. @@ -117,7 +117,8 @@
  583. /* Execute the startup script */
  584. #ifdef CONFIG_NSH_ROMFSETC
  585. - (void)nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH);
  586. +// REMOVE ME
  587. +// (void)nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH);
  588. #endif
  589. /* Then enter the command line parsing loop */
  590. @@ -130,7 +131,8 @@
  591. fflush(pstate->cn_outstream);
  592. /* Get the next line of input */
  593. -
  594. +sleep(2); // REMOVE ME
  595. +#if 0 // REMOVE ME
  596. ret = readline(pstate->cn_line, CONFIG_NSH_LINELEN,
  597. INSTREAM(pstate), OUTSTREAM(pstate));
  598. if (ret > 0)
  599. @@ -153,6 +155,7 @@
  600. "readline", NSH_ERRNO_OF(-ret));
  601. nsh_exit(&pstate->cn_vtbl, 1);
  602. }
  603. +#endif // REMOVE ME
  604. }
  605. /* Clean up */
  606. UPDATE: I recently implemented a good UART simulation to driver
  607. the serial console. So I do not believe that problem exists and
  608. I think that the above workaround should no longer be necessary.
  609. However, I will leave the above text in place until I get then
  610. oppotunity to verify that the new UART simulation fixes the problem.
  611. ostest
  612. The "standard" NuttX apps/examples/ostest configuration.
  613. pashello
  614. Configures to use apps/examples/pashello.
  615. pf_ieee802154
  616. This is the configuration that used for unit level test of the
  617. socket support for the PF_IEEE802154 address family. It uses
  618. the IEEE 802.15.4 loopback network driver and the test at
  619. apps/examples/pf_ieee802154.
  620. Basic usage example:
  621. nsh> pfserver ab:cd &
  622. nsh> pfclient ab:cd
  623. pktradio
  624. This configuration is identical to the 'sixlowpan configuration
  625. described below EXCEPT that is uses the genericl packet radio
  626. loopback network device.
  627. sixlowpan
  628. This configuration was intended only for unit-level testing of the
  629. 6LoWPAN stack. It enables networking with 6LoWPAN support and uses
  630. only a IEEE802.15.4 MAC loopback network device to supported testing.
  631. This configuration includes apps/examples/nettest and apps/examples/udpblaster.
  632. Neither are truly functional. The only intent of this configuration
  633. is to verify that the 6LoWPAN stack correctly encodes IEEE802.15.4
  634. packets on output to the loopback device and correctly decodes the
  635. returned packet.
  636. See also the 'pktradio' configuration.
  637. touchscreen
  638. This configuration uses the simple touchscreen test at
  639. apps/examples/touchscreen. This test will create an empty X11 window
  640. and will print the touchscreen output as it is received from the
  641. simulated touchscreen driver.
  642. Since this example uses the simulated frame buffer driver, the
  643. most of the configuration settings discussed for the "nx11"
  644. configuration also apply here. See that discussion above.
  645. See apps/examples/README.txt for further information about build
  646. requirements and configuration settings.
  647. traveler
  648. Configures to build the Traveler first person, 3-D ray casting game at
  649. apps/graphics/traveler. This configuration derives fromthe nx11
  650. configuration and many of the comments there appear here as well.
  651. This configuration defpends on X11 and, of course, can only be used in
  652. environments that support X11! (And it may not even be usable in all of
  653. those environments without some "tweaking").
  654. 1. Special Framebuffer Configuration
  655. This configuration uses the same special simulated framebuffer
  656. configuration options as the nx configuration:
  657. CONFIG_SIM_X11FB - Use X11 window for framebuffer
  658. CONFIG_SIM_FBHEIGHT - Height of the framebuffer in pixels
  659. CONFIG_SIM_FBWIDTH - Width of the framebuffer in pixels.
  660. CONFIG_SIM_FBBPP - Pixel depth in bits
  661. 2. X11 Configuration
  662. But now, since CONFIG_SIM_X11FB is also selected the following
  663. definitions are needed
  664. CONFIG_SIM_FBBPP (must match the resolution of the display).
  665. CONFIG_FB_CMAP=y
  666. My system has 24-bit color, but packed into 32-bit words so
  667. the correct setting of CONFIG_SIM_FBBPP is 32.
  668. 3. X11 Build Issues
  669. To get the system to compile under various X11 installations
  670. you may have to modify a few things. For example, in order
  671. to find libXext, I had to make the following change under
  672. Ubuntu 9.09:
  673. cd /usr/lib/
  674. sudo ln -s libXext.so.6.4.0 libXext.so
  675. udgram
  676. This is the same as the nsh configuration except that it includes
  677. two addition build in applications: server and client. These
  678. applications are provided by the test at apps/examples/udgram.
  679. This configuration enables local, Unix domain sockets and supports
  680. the test of the datagram sockets.
  681. To use the test:
  682. nsh> mount -t binfs /bin
  683. nsh> server &
  684. nsh> client
  685. For the sake of sanity, binfs and logins are disabled in this
  686. configuration.
  687. unionfs
  688. This is a version of NSH dedicated to performing the simple test
  689. of the Union File System at apps/exmaples/uniofs. The command
  690. 'unionfs' will mount the Union File System at /mnt/unionfs. You
  691. can than compare what you see at /mnt/unionfs with the content
  692. of the ROMFS file systems at apps/examples/unionfs/atestdir and
  693. btestdir.
  694. Here is some sample output from the test:
  695. NuttShell (NSH)
  696. nsh> unionfs
  697. Mounting ROMFS file system 1 at target=/mnt/a with source=/dev/ram4
  698. Mounting ROMFS file system 2 at target=/mnt/b with source=/dev/ram5
  699. nsh> ls /mnt/unionfs
  700. /mnt/unionfs:
  701. .
  702. afile.txt
  703. offset/
  704. When unionfs was created, file system was joined with and offset called
  705. offset". Therefore, all of the file system 2 root contents will appear
  706. to reside under a directory called offset/ (although there is no
  707. directory called offset/ on file system 2). Fie system 1 on the other
  708. hand does have an actual directory called offset/. If we list the
  709. contents of the offset/ directory in the unified file system, we see
  710. he merged content of the file system 1 offset/ directory and the file
  711. system 2 root directory:
  712. nsh> cat /mnt/unionfs/afile.txt
  713. This is a file in the root directory on file system 1
  714. nsh> ls /mnt/unionfs/offset
  715. /mnt/unionfs/offset:
  716. afile.txt
  717. .
  718. adir/
  719. bfile.txt
  720. bdir/
  721. nsh> cat /mnt/unionfs/offset/afile.txt
  722. This is a file in the offset/ directory on file system 1
  723. nsh> cat /mnt/unionfs/offset/bfile.txt
  724. This is another file in the root directory on file system 2
  725. The directory offset/adir exists on file system 1 and the directory\
  726. adir/ exists on file system 2. You can see that these also overlap:
  727. nsh> ls /mnt/unionfs/offset/adir
  728. /mnt/unionfs/offset/adir:
  729. ..
  730. asubdir/
  731. adirfile.txt
  732. bsubdir/
  733. bdirfile.txt
  734. .
  735. The unified directory listing is showing files from both file systems in
  736. their respective offset adir/ subdirectories. The file adirfile.txt
  737. exists in both file system 1 and file system 2 but the version if file
  738. system 2 is occluded by the version in file system 1. The only way
  739. that you can which are looking at is by cat'ing the file:
  740. nsh> cat /mnt/unionfs/offset/adir/adirfile.txt
  741. This is a file in directory offset/adir on file system 1
  742. The file on file system 1 has correctly occluded the file with the same
  743. name on file system 2. bdirfile.txt, however, only exists on file
  744. system 2, so it is not occluded:
  745. nsh> cat /mnt/unionfs/offset/adir/bdirfile.txt
  746. This is another file in directory adir on file system 2
  747. You can see the files in the two file systems before they were unified at
  748. apps/examples/unionfs/atestdir and btestdir.
  749. ustream
  750. This is the same as the nsh configuration except that it includes
  751. two addition built in applications: server and client. These
  752. applications are provided by the test at apps/examples/ustream.
  753. This configuration enables local, Unix domain sockets and supports
  754. the test of the stream sockets.
  755. To use the test:
  756. nsh> mount -t binfs /bin
  757. nsh> server &
  758. nsh> client