world leader in high performance signal processing
Trace: » microwindows

MicroWindows for Blackfin

Microwin is no longer supported since 2012 release.

Due to conflicts with the Windows trademark registered by Microsoft, MicroWindows has been renamed to The Nano-X Window System. The Nano-X Window System is an Open Source project aimed at bringing the features of modern graphical windowing environments to smaller devices and platforms. Nano-X allows applications to be built and tested on the Linux desktop, as well as cross-compiled for the target device. The Nano-X Window System has been ported to Blackfin uClinux platform, the newest version 0.92 is used. Its homepage is here.

Build MicroWindows

MicroWindows is included in every Blackfin uClinux released version since R05R4. Before running it on Blackfin uClinux platform, make sure your linux kernel has video framebuffer support. In our released uClinux-dist package, there are three framebuffer device drivers available: adv7171, adv7393 and TFT LCD LQ035Q7DB03. We also tested nano-X on BF548-EZKIT.

The following is a basic configuration of Microwin:

 [*] MicroWindows
 --- Compiling Options
 [*] Optimize
 [ ] Debug
 [ ] Verbose
 --- Libraries
 [*] Microwin
 [*] NanoX
 [ ] SharedLibs
 [ ] NWidget
 [ ] OBJFramework
 --- Demos
 [*] MicrowinDemo
 [*] NanoXDemo
 --- Applications
 [*] NanoWM
 --- Settings
 (CONFIG_USER_MICROWIN_MWPF_TRUECOLOR0888) Screeen PixType
 [ ] Link App into server
 [*] Have File IO
 [ ] Have BMP Support
 [ ] Have GIF Support
 [ ] Have PNM Support
 [ ] Have XPM Support
 [ ] Have JPEG Support
 [ ] Have PNG Support
 [ ] Have T1LIB Support
 [ ] Have FreeType Support
 [ ] Have SharedMemory Support
 [ ] Have Han Zi Ku font Support
 [ ] Have Big5 Support
 [ ] Have GB2312 Support
 [ ] Have MS Fonts
 [ ] Build Screen Driver only
 [ ] Window Erase Move
 [ ] Window UpdateRegions Move
 [ ] Gray Palette
 --- Display Config
 [ ] X11 Display
 [*] Frame Buffer Display
 [ ] Frame Buffer VGA
 [ ] VT Switch
 [ ] Portrait Mode
 [ ] Frame Buffer Reverse
 [ ] VGA Lib
 [ ] HW VGA
 [ ] Cleopatra VGA
 --- Mouse/Touch Screen
 [ ] GPM Mouse
 [ ] Serial Mouse
 [ ] TP Mouse
 [ ] TP Helio
 [ ] ADS Mouse
 [ ] IPAQ Mouse
 [ ] Harrier Mouse
 [ ] PSION Mouse
 [ ] uClinux/Palm TS
 [ ] DragonEngine TS
 [ ] Cleopatra Mouse
 [*] No Mouse
 --- Keyboard
 [ ] TTY Keyboard
 [ ] Scan Keyboard
 [ ] Pipe Keyboard
 [ ] Cleopatra Keyboard
 [*] No Keyboard
 --- Install These Applications
 [ ] Landmine
 [ ] Launcher
 [ ] Move
 [ ] MTerm
 [ ] MTest
 [ ] MTest2
 [ ] MUserFd
 [*] Nano-X
 [*] NanoWM
 [ ] NPanel
 [ ] NTerm
 [ ] NTest
 [ ] NTetris
 [*] NXclock
 [ ] NXev
 [*] NXkbd
 [ ] NXlsclients
 [ ] NXterm
 [ ] NXView
 [ ] Slider
 [ ] VNC
 [ ] World

Run MicroWindows on Blackfin

  1. run server in the background.
    root:~> nano-X &
    30
  2. run window manager for Nano-X in the background.
    root:~> nanowm &
    31
  3. Now it's turn to run application.
    root:~> nxclock

    Or

    root:~> nxkbd

Using USB Keyboard and Mouse/Touchscreen together with Nano-X / Microwindows

Asian fonts support

Fonts introduction

To successfully display a “character” on screen, it requires a font file contains information of how each “character” maps to pixels or how to draw the “character”. Since the “character” is usually encoded in some format, e.g, UTF8, UTF16, gb2312, big5 etc, before using a font file it is necessary to understand how the font file maps an encoded “character” to its “glyphs”. For example, the “pcf” font file “src/fonts/pcf/gb24st.pcf” is indexed using gb2312 encoding. To display a Chinese character “啊”, whose gb2312 encoding is “B0A1”, and gb24st.pcf uses “B0A1” as the index to “啊”.

Two kind of fonts are of interest to us: Bitmap fonts and Truetype fonts. For bitmap fonts, we care about “pcf” and “bdf” fonts. For Truetype fonts, we care about fonts supported by FreeType library.

Configure nanox

nanox is configured using “microwin/src/config”. Bellow are options related with fonts support in nanox

####################################################################
# native .fnt loadable font support
####################################################################
HAVE_FNT_SUPPORT         = Y
HAVE_FNTGZ_SUPPORT       = N
FNT_FONT_DIR             = "fonts/bdf"

####################################################################
# T1 adobe type1 font support thru t1lib
####################################################################
HAVE_T1LIB_SUPPORT       = N
INCT1LIB                 = /usr/include
LIBT1LIB                 = /usr/local/lib/libt1.a

####################################################################
# TrueType font support thru FreeType 1.x
####################################################################
HAVE_FREETYPE_SUPPORT    = N
INCFTLIB                 = /usr/include/freetype1
LIBFTLIB                 = /usr/lib/libttf.so
FREETYPE_FONT_DIR        = "/usr/fonts/truetype"

####################################################################
# Support for many kinds of font thru FreeType 2.x
# Must also set FREETYPE_FONT_DIR in the Freetype 1.x section
####################################################################
HAVE_FREETYPE_2_SUPPORT  = Y
INCFT2LIB                = $(STAGEDIR)/usr/include
LIBFT2LIB                = -lfreetype -lz

####################################################################
# PCF font support
# Selecting HAVE_PCFGZ_SUPPORT will allow you to directly read
# .pcf.gz files, but it will add libz to the size of the server
####################################################################
HAVE_PCF_SUPPORT         = Y
HAVE_PCFGZ_SUPPORT       = N
PCF_FONT_DIR             = "fonts/pcf"

####################################################################
# Chinese BIG5 compiled in font support (big5font.c)
####################################################################
HAVE_BIG5_SUPPORT        = N

####################################################################
# Chinese GB2312 compiled in font support (gb2312font.c)
####################################################################
HAVE_GB2312_SUPPORT      = N

####################################################################
# Japanese JISX0213 compiled in font support (jisx0213-12x12.c)
####################################################################
HAVE_JISX0213_SUPPORT    = N

####################################################################
# Korean HANGUL font support (jo16x16.c)
####################################################################
HAVE_KSC5601_SUPPORT     = N

####################################################################
# Japanese EUC-JP support using loadable MGL font
####################################################################
HAVE_EUCJP_SUPPORT       = N
EUCJP_FONT_DIR           = "fonts/japanese"

Here in the configure, we enabled “bdf” and “pcf” fonts. FreeType is not tested, while the FreeType library has been ported to blackfin uclinux. It should be able to work.

Please note that, we don't including full fonts file provided by nano-x release in uclinux-dist. If you need additional font support, please download from nanox site: ftp://microwindows.censoft.com/pub/microwindows/. Also you may find many other fonts from web.

How nanox handles fonts

Nanox has a layered architecture. The common font driver is located in: /microwin/src/engine/devfont.c, while different fonts are supported in different low level font drivers:

$ ls microwin/src/engine/font_*
font_dbcs.c  font_eucjp.c  font_fnt.c  font_freetype2.c  font_freetype.c  font_freetype.cache.c  font_hzk.c  font_pcf.c  font_t1lib.c

By default the font demo “pcfdemo” is built when select to build nanox. You may refer to it for nanox APIs to manipulate fonts. But the font file need to be download to board. The demo reads from the font file “gb24st.pcf” and display each fonts sequentially:

On host:
$ rcp src/fonts/pcf/gb24st.pcf root@<board_ip>:/
On board:
root:> nano-X &
root:> nanowm &
root:> pcfdemo /gb24st.pcf

The demo looks like:

Truetype font using freetype2 library

Firstly need to build freetype2 library:

Library Configuration  ---> 
[*] Build freetype 

Note that nano-x does not support freetype-2.3.5 (current version in uclinux-dist) well. The font cache is disabled by default, which will decrease performance. Please follow nano-x mailing list for latest update.

Build nano-x demos, we will need “ftdemo”

 --- Demos
[ ] MicrowinDemo
[*] NanoXDemo 

This demo requires keyboard support, see fbcon. Before runnint “ftdemo”, check bellow files are on your board:

root:/> ls /bin/ftdemo*                                                                                                                                     
/bin/ftdemo      /bin/ftdemo.txt                                                                                                                            
root:/> ls /usr/fonts/truetype/lt1-r-omega-serif.ttf                                                                                                        
/usr/fonts/truetype/lt1-r-omega-serif.ttf   

And start nanox:

root:/> export TSLIB_TSDEVICE=/dev/input/event(?) // your touchscreen device. ignore if disabled.
root:/> export CONSOLE=/dev/tty2 // you can use CTRL+ALT+F2 to switch to nano-x
root:/> nano-X &
root:/> nanwm &
root:/> ftdemo &
([CTRL+ALT+F2] switch to nano-x.)

Follow this instruction in the demo, you should see display like this:

Create GUI application for nano-X

nxlib and FLTK

nxlib allows X11 binaries to run unmodified using the Microwindows Nano-X server. According to the README:

This software has been used to run the following libraries
and applications, although much work is yet to be completed:
fltk-1.0.11
fltk-1.1.3
gtk+-1.2.7, glib-1.2.7
gtk+-1.2.10, glib-1.2.10
gtk+-2.0.6, glib-2.0.6, atk-1.0.3, pango-1.0.4
qt-x11-2.3.1
xfreecell-1.0.5a
xsunclock-1.5
xscreensaver-3.26

FLTK(Fast Light ToolKit) is is a cross-platform C++ GUI toolkit. With the help of nxlib, GUI application built with FLTK can run on nano-X. Bellow is a screenshot of FLTK sample “editor”:

FLTK also includes a UI designer fluid. You will need to download FLTK (e.g 1.1.8rc3) and build it on your Linux PC. Here is what it looks like on Linux PC running gnome:

To build nxlib (and FLTK samples), select

Microwindows -->
 NXLIB

flnx

Nano-X also ports FLTK to use nano-X API instead of X API, resulting a project named flnx. To build flnx, select

Microwindows -->
 FLNX

If you want to use the soft keyboard nxkbd with FLTK applications, FLNX is the choice.