Development on Pocket OS
To develop programs on pocket OS you need
- PocketOSdev.zip archive
- Visual C++ 6 or Visual Studio Express (Exemples tested with Visual Studio
Express 9 (free to download))
First unpack the PocketOSdev.zip archive in a Windows directory (ex:
The archive content is:
C compiler libraries
Simple hello world (+ display command line arguments)
- <DIR> CurveDraw Simple
CurveAnim Simple graphic animation demo
Memspeed Bench memory transfer speed (not
compiler sources for Pocket OS
emulator, used to test a program
image for emulators.
- Mounted as C: with Windows or qemu
- Executable compiled in release mode are copied into the root of
this disc. (Can be changed in the project options in Visual
Studio). Attention, qemu mounts the directory image in read only.
- mkprj.exe Command
line program used to create a Visual Studio (6 and Express) project
for Pocket OS. (and set all required link options)
- Syntax: mkprj projectname
- Created the directory and file projectname. Dsp and. Dsw (VC6) and.
vcproj (VS Express) + main.c
- Two configurations are defined:
- Debug: allows you to debug a program using
visual Windows emulator (POSemu.exe)
- Release: generates an executable for pocket OS, it can be tested with
qemu or on a real PC . The executable is copied on the root of windrv
in order to be tested by the emulator.
Batch file used to launch qemu. The drive 'windrv' is mounted
as drive C: (in read only mode). Used to test an executable compiled in
Executable of Pocket OS emulator for Windows.
Start Visual Studio.
- Open a project in an example directory (use
.vcproj for express, do not load .dsw)
- Select build configuration (default is debug)
- In Debug
- Build project
- Run Project. It start the windows emulator automatically and you can
- In Release
- Build project. The executable is copied on root of
windrv (emulator disk image)
- Start an emulator (qEmu or POSemu.exe), and launch the program using
To test on real PC, just copy the executable on the flash key, reboot the PC
with Pocket OS and launch it using command line.
To create a new project:
- Open Windows console
- Move to the Pocket OS dev directory you have created.
- Create project using mkprj.exe command line tool
- ex: mkprj myproj. This will create myproj
- myproj.vcproj (visual express project file)
- myproj.dsp (visual c++ 6 project file. Can be
deleted if unused)
- myproj.dsw (visual c++ 6 project file. Can be
deleted if unused)
- main.c (simple main doing nothing, just include "pos.h" header and debug function
that is required to link in debug)
- Open the project with Visual Studio. You can
then build/debug as described in examples.
- Note: The project must be created in dev directory (here
C:\PosApp) because generated project files refer to paths relative to
this directory. So it will not work if you create a project somewhere else
(unless you modify path in project configuration)
- It is convenient to create a shortcut to runqemu.bat
and POSemu.exe in Windows task bar.
- In the qemu emulator, the hard drive is mounted as
read only, so an application cannot write to it. To test an application that
makes disk writes, it is possible to create a volume 'ramdisk' with
- ramdrive R: 16 (creates a ramdisk of 16MB named R: (can be
- If the content of C: is small, you can copy all the
content to R: using:
- xcopy C:\* R: (copy all the contents into the
- path = R:\bin;R:\tcc (change path to R:)
- You can add these command to autoexec.sh to avoid typing them at each
- Programming in C++. Currently the programming in C++
is not expected, however it is possible but with restrictions:
- Classes must not use Constructors/Destructors
(can use explicitly called init functions)
- The new/delete must be replaced by some
- Try/Catch not supported (but you can use setjmp / longjump)
- Under POS, it is possible to compile examples with
integrated compilator TCC, you can use the script 'build.sh' contained in
each example directory (type command 'sh build.sh'.) (Remember, the
disk on qemu emulator is read only, but it writable on Windows emulator)
- TCC library (libpostcc.a) is currently very small,
it allows just TCC to rebuild itself.
- It is possible to 'recover' the mingw32 libraries,
but they need to be converted to ELF32.
- Extract objects (.o) from
mingw library using 'ar':
- Convert the objects to ELF32-i386 format using
- objcopy -O xxx.o ELF32-i386 - remove-leading-char
- Create the new TCC library with converted objects
- ar rcs obj1.o obj2.o ... libnew.a
- Be careful not to include functions specific to Windows kernel (eg
malloc, printf, etc ...)