Göm meny

Simple_OS documentation

Table of contents

  • Delivery and directory structure
  • Quick start Linux
  • Quick start Windows

Delivery and directory structure

A Simple_OS delivery is bundled in a zip-file, named simple_os_<date>.zip.
The current version of Simple OS is simple_os_2020_11_04.zip. This version makes it possible to set a communication port dynamically (via the environment variable SIMPLE_OS_PORT (se below)), without the need to recompile anything. The default port value is 2000.
(The previous version of Simple OS simple_os_2013_03_05.zip is available for reference only.)

When unzipping this file, the following three directories are created, inside the simple_os_ directory:
  • simple_os_apps - containing Simple_OS applications, for demonstration purpose, and from which code can be re-used if needed when making your own Simple_OS applications. For additional info, please see the README-file in this directory
  • java_gui - containing a graphical user interface, for communication with an executing Simple_OS program. For additional info, please see the README-file in this directory
  • simple_os - with the actual RTOS, pre-built as a library, but also including the source code. Here, you can also find makefiles for use on a Linux host for building the library for execution on Linux host (native compilation, running the RTOS as a soft-kernel inside a Linux program), or on ARM target (cross-compilation for ARM on Beagleboard). If you have a Windows host, it is possible to build the library for execution on a Windows host (running the RTOS as a soft-kernel inside a Windows program), using a Visual Studio Express project, stored inside the win subdirectory (some levels down, the project file i.e. the file to be opened in Visual Studio Express is called simple_os.sln)

Quick start Linux

  • start a terminal window
  • go to simple_os_/simple_os_apps/barber/gui directory
  • run the program using
    ./prog_x86_host
    
  • this should result in a printout indicating that the program is waiting for a socket connection
  • start another terminal window
  • go to simple_os_/java_gui/java
  • start the Java GUI program using
    java GUISimpleOS
    
The GUI should now be connected to the running Simple_OS application
Create some customers with File->Send text to Simple_OS and then enter the string new
The customers will visit the barber shop, and after they have had their hair cuts, they will rest for a while, and then come back again
You can close the Simple_OS application (and keeping the GUI running), using File->Exit Simple_OS
Then you can modify the Simple_OS application if you want, and build it. NOTE: this requires that you set the environment variable SIMPLE_OS_DIR.

Setting the SIMPLE_OS_DIR and SIMPLE_OS_PORT environment variables[1]

First find out which shell (tcsh or bash) you are running, by using the command:
echo $0
The variables SIMPLE_OS_DIR and SIMPLE_OS_PORT shall be set to the simple_os directory inside your installation directory, e.g.
like this for tcsh
setenv SIMPLE_OS_DIR /home/ola/simple_os_2020_11_04/simple_os
setenv SIMPLE_OS_PORT 2000
(put those lines in the file .cshrc in your home folder to avoid typing them at every login)

and like this for bash:
export SIMPLE_OS_DIR=/home/ola/simple_os_2020_11_04/simple_os
export SIMPLE_OS_PORT=2000
(put those lines in the file .bash_profile in your home folder to avoid typing them at every login)

Making and running Simple OS applications

If you now try
make -f Makefile_32
the program will be rebuilt.
Start it again, using
./prog_x86_host

Quick start Windows

Simple_OS in Windows can be used with Visual C++ Express Edition.
Visual C++ Express Edition can be obtained from
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express
It may be possible to use also other C compilers, but that has not been verified.
Supposing that Visual C++ Express Edition is available, the following steps can be taken:
  • start a Windows explorer (or My computer application)
  • go to simple_os_\simple_os_apps\win\vs_cpp_2010_express\simple_os_prog directory
  • double-click or press enter on the file simple_os_prog.sln
  • Visual C++ Express Edition should now be open. Ensure that the project is active by clicking once on simple_os_prog (in bold) in the Solution Explorer window.
  • In Visual C++ Express Edition, choose Project -> Add Existing Item (or use Shift-Alt-A)
  • Then navigate to the directory simple_os_/simple_os_apps/barber/gui/src, and add all c-files and h-files found there to the project
  • Build the program using Debug->Build Solution (or use F7 for build, or Ctrl-Alt-F7 for Rebuild)
  • Run the program by choosing Debug->Start Debugging (or use Ctrl-F5)
  • this should result in a printout indicating that the program is waiting for a socket connection
  • start a Windows command window
  • go to simple_os_\java_gui\java
  • start java GUI program using
    java GUISimpleOS
    
The GUI should now be connected to the running Simple_OS application
Create some customers with File->Send text to Simple_OS and then enter the string new
The customers will visit the barber shop, and after they have had their hair cuts, they will rest for a while, and then come back again
You can close the Simple_OS application (and keeping the GUI running), using File->Exit Simple_OS
Then you can modify the Simple_OS application if you want, and build it.
If you now try
  • Debug->Build Solution (or use F7 for build, or Ctrl-Alt-F7 for Rebuild)
the program will be rebuilt.
Start it again, using
  • Debug->Start Debugging (or use Ctrl-F5)
and it will connect to the GUI again.
When tired of running the GUI, close it by using File->Exit

Simple_OS applications

Table of contents

  • Simple_OS applications
  • Build on a Linux host
  • Build on a Windows host
  • Linux host - create new applicaton
  • Windows host - create new application

Simple_OS applications

The following application directories are available:
  • barber/console - a Sleeping barber program with text output
  • barber/gui - a Sleeping barber program with GUI communication
  • hello_console - a hello world program with text output
  • hello_gui - a hello world program with GUI communication

Build on a Linux host

There are Linux host makefiles available in the application directories:
  • Makefile_32 - for Linux 32-bit hosts
In some application directories, the application is prepared for execution also on an ARM target (Beagleboard, running Simple_OS). For these applications, there is a makefile for ARM in the application directory:
  • Makefile_arm_bb - for ARM target on Beagleboard

Building on a Windows host

The directory
win\vs_cpp_2010_express\simple_os_prog
contains a Visual Studio Express project file, which can be used when applications shall be built and executed using Windows

Linux host - create new application

If you want to create a new application and you use a Linux host, a shell script is available, and can be used, e.g. like
source start_new_app_32.sh my_app
for creating a directory my_app, with src and obj directories created, and with symbolic links to Makefile_32 and rules.mk automatically created.
Then, store your source files in the src subdirectory of your new directory (my_app in this case), and using
make -f Makefile_32 
your application can be built for Linux host.
If you want to build for Linux 64-bit then create a symbolic link to the Makefile_64 file, in the same way as the link to Makefile_32 was created (see the file start_new_app_32.sh for information about this).
If you want to build for ARM you need a cross compiler. Simple_OS is prepared for use with CodeSourcery's ARM compiler on a Linux host.
The ARM compiler can be downloaded and installed as described on this post on the Intobooks blog.
Provided you have access to this compiler (or another one, but then you need to verify yourself that it can be used to build Simple_OS and Simple_OS applications), a build for ARM can be done by creating a symbolic link to Makefile_arm_bb, and then using
make -f Makefile_arm_bb
for compilation and linking. This results in a file prog_arm_bb.srec, which then can be downloaded to a Beagleboard using e.g. gtkterm.

Windows host - create new application

If you want to create a new application and you use a Windows host, please create a new subdirectory where your sourcefiles are stored. Then, use the already available Visual Studio project (the simple_os_prog.sln file), and include your source files into this project (and if needed, remove source files belonging to any one of the applications mentioned above from the project)
NOTE: when removing old source files and adding new files to a project, it is advised to do a complete rebuild the first time the new source files are compiled. This is achived using the command
Ctrl-Alt-F7

Simple_OS GUI Java program

A GUI Java program is found in this directory.
It can be started with
cd java
java GUISimpleOS
The program communicates with a Simple_OS application using TCP/IP
Port number 2000 is used
The current version supports communication within the same computer
Communication with a Beagleboard running Simple_OS can be done using a bridge program. An example bridge program is found in the file
file:../simple_os_apps/tcp_serial/tcp_serial_redirect_mod.py
If a Java SDK is installed, the program can be rebuilt using
cd java
javac *.java


[1] SIMPLE_OS_PORT solution, courtesy of Anders Leffler.


Informationsansvarig: Kent Palmkvist
Senast uppdaterad: 2020-12-02