Files
minigui-docs/programming-guide/MiniGUIProgGuidePart5Chapter04.md
Vincent Wei 0a727c6de7 tune format
2019-10-28 15:09:35 +08:00

4.3 KiB

Appendix A Universal Startup API for RTOSes

MiniGUI provides universal startup API for RTOSes and spare startup reference files in V2.0.4/1.6.9. MiniGUI 3.0 continues to use these files. These files are saved in the MiniGUI source code rtos/ directory. The rules of nomenclature in these files are like >os_name<_startup.c. In startup file, there are an introduction to malloc, printf and POSIX pthread initialization interface. The following is detailed description.

Malloc Initialization Interface

MiniGUI provides an own-implemented malloc set of functions. We can use macro _USE_OWN_MALLOC to open it. MiniGUI provides the following interface to initialize MiniGUI malloc set of functions.

To use MiniGUI malloc set of functions, you should pass the information of heap address, lock and unlock heap function pointer, and stack size.

The following is the reference implementation on ThreadX OS.

Standard Output Initialization Interface

MiniGUI provides an own-implemented printf set of functions. We can use macro _USE_OWN_STDIO to open it. MiniGUI provides the following interface to initialize MiniGUI printf set of functions.

The following is a reference implementation.

So the information which is printed to standard output and standard error by printf/fprintf functions will be printed to serial port of the device.

POSIX Threads Initialization Interface

MiniGUI provides an own-implemented POSIX threads system. We can use macro _USE_OWN_PTHREAD to open it. MiniGUI provides the following interface to initialize RTOS POSIX threads system.

The first argument pth_entry will run as main thread. In reality, we can pass minigui_entry for it. For example:

The following list shows the relationship between RTOS and macros above.

| RTOS | Macro | | VxWorks | _MGUSE_OWN_STDIO
_MGUSE_OWN_MALLOC
_MGUSE_OWN_PTHREAD | | uC/OS-II | _MGUSE_OWN_STDIO
_MGUSE_OWN_MALLOC
_MGUSE_OWN_PTHREAD | | eCos | none | | pSOS | _MGUSE_OWN_PTHREAD | | Win32 | _MGUSE_OWN_STDIO| | OSE | _MGUSE_OWN_PTHREAD| | ThreadX | _MGUSE_OWN_STDIO
_MGUSE_OWN_MALLOC
_MGUSE_OWN_PTHREAD | | Nucleus |_MGUSE_OWN_STDIO
_MGUSE_OWN_MALLOC
_MGUSE_OWN_PTHREAD |

-- Main.XiaodongLi - 26 Oct 2009


<< | Table of Contents | >>