readme-nanox.txt 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. Nano-X port
  2. ===========
  3. What is it?
  4. ===========
  5. The Nano-X port is based on the wxX11 code, and therefore shares
  6. almost all of wxX11's code, including the use of the wxUniversal
  7. widget set. Nano-X is the X-like API of the overall Microwindows
  8. project, which also has a WIN32 API.
  9. The Microwindows web site is at
  10. http://microwindows.org/
  11. Nano-X is intended to work on devices with very small amounts
  12. of memory. wxWidgets is quite a large library, so if your
  13. memory is measured in KB instead of MB you will need to use
  14. an alternative library, such as FLTK. However, with memory
  15. capacity increasing all the time, wxWidgets could become
  16. an appropriate embedded GUI solution for many projects.
  17. Also, it's possible to think of ways to cut wxWidgets
  18. further down to size, such as disabling advanced controls
  19. or rewriting utility functions. See the section on code size
  20. below.
  21. An alternative to using Nano-X is to use the standard
  22. wxX11 port with Tiny-X, which (as I understand it)
  23. maintains the Xlib API while being sufficiently cut
  24. down to run on small devices, such as the iPAQ.
  25. The Familiar Linux Distribution contains Tiny-X. See:
  26. http://handhelds.org/mailman/listinfo/familiar
  27. Building wxNano-X
  28. =================
  29. Building is as per the instructions for wxX11 (see readme.txt,
  30. install.txt) but passing --enable-nanox to configure. You also need
  31. to export the MICROWIN variable, setting it to the top-level of the
  32. Microwindows hierarchy. Remember that MICROWIN needs to be defined
  33. both at configuration time and at subsequent make time, so you
  34. may find it convenient to put it in your .bash_profile or similar
  35. file.
  36. Typically, various features in wxWidgets will be switched off to
  37. conserve space. The sample script below calls configure with typical
  38. options for Nano-X.
  39. Before compiling wxNano-X, you will also need to edit your
  40. Microwindows 'config' file to match the values hard-coded into
  41. configure:
  42. ERASEMOVE=N (otherwise moving windows will look messy)
  43. X11=Y
  44. OPTIMIZE=N
  45. DEBUG=Y
  46. VERBOSE=Y
  47. Compile Microwindows by typing 'make' from within the Microwindows src
  48. directory.
  49. Port notes
  50. ==========
  51. Nano-X has a different API from Xlib, although there
  52. are many similarities. Instead of changing the wxWidgets
  53. code to reflect Nano-X conventions, a compatibility
  54. layer has been added, in the form of these files:
  55. include/wx/x11/nanox/X11/Xlib.h ; Xlib compatibility
  56. include/wx/x11/privx.h ; Useful macros
  57. src/x11/nanox.c ; Xlib compatibility
  58. There is also an XtoNX.h compatibility header file
  59. in Microwindows, which we augment with our Xlib.h
  60. and nanox.c.
  61. Unfortunately it is not always possible, or economical,
  62. to provide a complete Xlib emulation, so there are
  63. still wxUSE_NANOX preprocessor directives in the code
  64. for awkward cases. It may be possible to eliminate
  65. some, but probably not all, of these in future.
  66. Port Status
  67. ===========
  68. The port is in a very early stage: so far it links
  69. and a window pops up, but that's about it. (The
  70. wxX11 port using straight X11 is much more advanced.)
  71. Things to do:
  72. - implement some incomplete compatibility functions
  73. in src/x11/nanox.c
  74. - implement the colour database
  75. - add mask capability, without which controls won't
  76. display properly
  77. - add further configuration options for disabling
  78. code not normally needed in an embedded device
  79. - optimization and code size reduction
  80. - figuring out why libstdc++-libc is linked to
  81. binaries -- is this done for any C++ program?
  82. Code Size
  83. =========
  84. Allow about 2.5 MB for a shared wxWidgets library, with the
  85. dynamically linked minimal sample taking about 24KB. If statically
  86. linked, minimal takes up just over 1MB when stripped. This 1MB
  87. includes all of wxWidgets used in the minimal sample including some of
  88. the wxUniversal widgets. As application complexity increases,
  89. the amount of wxWidgets code pulled into statically linked
  90. executables increases, but for large applications, the overhead
  91. of wxWidgets becomes less significant.
  92. Sample sizes:
  93. -------------
  94. Statically-linked minimal (release): 1,024,272 bytes
  95. Statically-linked widgets (release): 1,171,568 bytes
  96. Shared lib, stripped (debug): 2,486,716 bytes
  97. Shared-lib minimal (debug), stripped: 23,896 bytes
  98. Shared lib, stripped (release): 2,315,5004 bytes
  99. Shared-lib minimal (release), stripped: 23,896 bytes
  100. (note: the -O flag was not passed to the minimal
  101. makefile, for some reason)
  102. Strategies for reducing code size
  103. ---------------------------------
  104. - Look at the .o files compiled in a build and check
  105. for particularly large files, or files you wouldn't
  106. expect to be there in an embedded build.
  107. - Disable options for features that aren't necessary,
  108. for example: image handlers (BMP, JPEG etc.),
  109. wxVariant, wxWizard, wxListCtrl, src/univ/themes/gtk.c.
  110. - Add options to configure.in/setup.h where necessary,
  111. for finer-grained configuration.
  112. - Rewrite functions or classes for alternative stripped-down
  113. functionality.
  114. - Remove unnecessary functionality or obsolete code from
  115. wxWidgets.
  116. - Factor out wxWidgets code to reduce repetition.
  117. - Add inlining, remove unnecessary empty functions.
  118. - Separate code out into individual files so that all of
  119. a .o file doesn't get pulled in, just because an app
  120. references something else in that file. For example,
  121. advanced event types could be separated out.
  122. This assumes that the linker isn't clever enough to
  123. eliminate redundant functions. The fact that the
  124. minimal and widgets samples are very close in size
  125. is evidence that gcc is not doing a good job here.
  126. - Experiment with compiler options.
  127. - Commercially supported compilers may have better
  128. code generation and/or linker optimisation than the
  129. one you're currently using.
  130. Sample script for building wxNano-X
  131. ===================================
  132. This script assumes that you will invoke it
  133. from a build directory under the wxWidgets
  134. top level. So you might type:
  135. % cd wx2
  136. % mkdir nano-x
  137. % cd nano-x
  138. % makewxnanox
  139. If you need to restart compilation without
  140. reconfiguring, just type 'make' from the same
  141. directory.
  142. -----------------------------:x----------------------
  143. #!/bin/sh
  144. # makewxnanox
  145. export MICROWIN=/home/julians/microwindows/microwindows-0.89pre8
  146. #DEBUGFLAGS="--enable-debug --enable-debug_cntxt --disable-optimise"
  147. DEBUGFLAGS="--disable-debug --disable-debug_cntxt --enable-optimise"
  148. export CONFIGCMD="./configure $DEBUGFLAGS --enable-shared --enable-gui --with-x11 --enable-nanox --enable-log --with-threads --without-sockets --without-odbc --without-libjpeg --without-libtiff --without-png --without-regex --enable-no_exceptions --disable-protocols --disable-ipc --disable-dialupman --disable-apple_ieee --disable-fraction --disable-dynlib --disable-dynamicloader --disable-geometry --disable-fontmap --disable-std_iostreams --disable-filesystem --disable-fs_inet --disable-fs_zip --disable-zipstream --disable-snglinst --disable-mimetype --disable-url --disable-html --disable-constraints --disable-printarch --disable-mdi --disable-postscript --disable-PS-normalized --disable-afmfonts --disable-prologio --disable-resources --disable-dnd --disable-metafile --disable-treelayout --disable-grid --disable-propsheet --disable-splines --disable-joystick --disable-pcx --disable-iff --disable-pnm --disable-tabdialog --disable-newgrid"
  149. echo $CONFIGCMD
  150. if [ ! -f ./configure ]; then
  151. CONFIGCMD=".$CONFIGCMD"
  152. fi
  153. echo Invoking $CONFIGCMD
  154. rm -f *.cache
  155. $CONFIGCMD
  156. make
  157. -----------------------------:x----------------------