Transplantation of uC/GUI on the Cortex-M3 Kernel

Source: Internet
Author: User

Qu huanyu-Jiaxing University
I. Introduction
It is a graphical interface support system designed for embedded systems. All its code is composed of Standard C
Write, modular design, strong portability. UC/GUI adapts to most black/white or
Color LCD applications also provide a scalable 2D graphics library and a window that occupies a very small amount of RAM
Management System.
Ii. Requirements
Target System (hardware)
Your target system must meet the following requirements:
[1]. CPU (8/16/32/64 bits)
[2]. Necessary Ram and Rom Storage
[3]. LCD display (any type and resolution)
The memory requirement depends on the ucgui function module you choose and the purpose you use.
The efficiency of the compiler on the system. The memory usage cannot be accurately estimated.
The value is applicable to most target systems.
Small System (excluding Window Management)
[1]. Ram: 100 bytes
[2]. STACK: 500 bytes
[3]. Rom: 10 ~ 25 K (depending on the ucgui function module selected)
Large System (including window management and various forms control functions)
[1]. Ram: 2-6 kb (determined by the number of windows created in the selected Application)
[2]. STACK: 1200 bytes
[3]. Rom: 30-60 kb (determined by the ucgui function module selected)
Note that the ROM demand increases with the number of fonts you use in the application,
All the values above are rough estimates and inaccurate.
Iii. Overview before transplantation
The target system is the stm32f103rb Microprocessor Based on the cortex-M3 kernel. Select
It uses uC/gui3.90a. LCD is a TFT color LCD screen controlled by ili93xx.
Open ucgui390a \ gui. The following lists the functions of each folder.
Table uC/GUI directory structure
Config configuration file directory
Support for guis/antialias farming
Gui \ convertmono grayscale color conversion support
Gui \ convertcolor color conversion support
Gui \ core files
Gui \ font file
Support for GUI/JPEG format Image Display
Gui \ lcddriver LCD Driver File
Gui \ memdev Storage Device Support
Gui \ multilayer multi-layer drawing support
GUI/widget Component Library
Gui \ WM Window Manager
Among them, antialias, convertmono, convertcolor, memdev, widget, WM
Are optional configuration components. μC/GUI provides some configuration options to exclude some components during compilation,
Yes. Sometimes, you need to manually remove the c file from the project file and divide it by to avoid compiling the file. Closest to user
Components used are component libraries, Window managers, LCD drivers, and font files.
Iv. Design of uC/GUI interface functions
The premise of porting uC/GUI is that the LCD Driver function has been designed, because
In the system structure, uC/GUI is located at the operating system layer, and its interaction with hardware is driven by the device.
Layer.
The interfaces between uC/GUI and the device driver layer are the following three functions:
Void LCD _drawpoint );
LCD _readpoint (x, y );
Void LCD _myinit ();
Note that the LCD initialization function name cannot use LCD _init (); this is already defined in UC/GUI.
Function, leading to redefinition.
The interface function is designed to be related to the processor and LCD. It must be completed before porting uC/GUI
The last three functions are designed to implement LCD initialization using LCD _myinit,
,
The color of the corresponding vertex is displayed on the LCD.
V. Transplantation of uC/GUI
Add all files in the ugui folder to the Project
The Startup Folder contains the boot file and kernel file of the processor.
The fwlib folder contains the Firmware Library file.
The user folder contains the main function file and related user-defined files.
Careful friends will find that there is an additional ugui/config folder. This is related to UC/GUI.
Configuration file. It contains the following three files:
Gui_x.c ucgui390a \ sample \ gui_x
Because uC/GUI provides interface functions corresponding to UC/OS
The function does not exist and leads to compilation errors. gui_x.c is used to declare these functions to prevent compilation errors.
Error.
U32 gui_x_gettaskid (void) {return 0 ;}
Void gui_x_lock (void ){;}
Void gui_x_unlock (void ){;}
Void gui_x_initos (void ){;}
Void gui_x_log (const char * s) {gui_use_para (s );}
Void gui_x_warn (const char * s) {gui_use_para (s );}
Void gui_x_errorout (const char * s) {gui_use_para (s );}
Add the declaration of these functions to gui_x.c to prevent compilation errors.
Guiconf. h ucgui390a \ Start \ config
This file is used to configure uC/GUI applications.
# Ifndef guiconf_h
# Define guiconf_h
# Define gui_ OS (0) // the operating system is not supported
# Define gui_support_touch (0) // touch screen not supported
# Define gui_support_unicode (1) // supports ASCII Encoding
# Define gui_default_font & gui_font6x8 // font size
# Define gui_alloc_size 5000 // memory provided for Window Management
Size
# Define gui_winsupport 1 // Window Manager package available
# Define gui_support_memdev 1 // memory devices available
# Define gui_support_aa 1 // anti aliasing available
# Endif/* avoid multiple compression sion */
Lcdconf. h ucgui390a \ Start \ config
This file is used for LCD application configuration, as described below
# Ifndef lcdconf_h
# Define lcdconf_h
# Define LCD _xsize (240)
# Define LCD _ysize (320)
# Define LCD _controller (9320) // Controller No.
# Define LCD _bitsperpixel (16) // 16-point display format
# Define LCD _fixedpalette (565) // 565 bits for red, green, and blue
# Define LCD _swap_rb (1)
# Define LCD _init_controller () LCD _init ();
# Endif/* lcdconf_h */
Next, the function interface is matched. Open the lcddummy. c file in Gui \ lcddriver.
Define the LCD _l0_init function as follows:
Int LCD _l0_init (void)
{
LCD _myinit ();
Return 0;
}
Define the LCD _l0_setpixelindex function as follows:
Void (int x, int y, int pixelindex)
{
LCD _drawpoint (X, Y, pixelindex );
}
Define the LCD _l0_getpixelindex function as follows:
Unsigned int LCD _l0_getpixelindex (INT X, int y)
{
Return LCD _readpoint (x, y );
}
So far, the uC/GUI has been transplanted. After the program is executed as shown in, it will be displayed on the LCD (50, 50)
"Hello World" indicates that the uC/GUI has been transplanted successfully.
Vi. Summary
The transplantation of uC/GUI does not need to understand the Cortex-M3 kernel and Its interrupt mechanism.
And the components that need to be compiled at the underlying hardware layer. Difficulty lies in the compilation of device driver functions and gui_x.c
Interface Design with uC/OS.
This is transplanted this summer, just translated the uC/OS-III user manual, and transplanted
UC/OS-III to stm32 processor, I want to put uC/GUI on the internet, hope
It can help you.
-- Qu huanyu
-- Late January 1, November 6, 2011

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.