How to solidify the font library in ucgui

Source: Internet
Author: User

How can I fix the font library in ucgui? Thank you! ---- Existing solution

I now use 44b0x, and UCOS and ucgui can run. There is no simulator, and every time you modify the program, you need to install it. Because the Chinese font is too large, the burning time is too long. I hope to burn the font library at one time and then burn the program. Problems to be Solved:
1. How to Make the font into a separate. hex or. binfile
2. How to compile the ucgui font structure based on the specified address?
3. How to enable ucgui to obtain a fixed font library
Thank you for your advice!

Admin-ucgui:

Benefits:

1. The Font does not occupy Ram space and is stored in flash.

2. Once the font is written to flash, you do not need to download it again.

3. Facilitate debugging and reduce unnecessary data downloads.

[This post was edited by admin-ucgui at 16:44:22]

Admin-ucgui

Level: Administrator
Article: 1042
Credit: 7778
Registration: 2003-12-30

2nd floor

 

The question raised by the landlord is a good one.

Indeed, the font in ucgui is not an independent binary file. It contains the dot matrix data of characters and the structure associated with the data. therefore, the separation is based on its structure, which can be as follows:

1. The. c file in the font has the following similar structure:

Gui_const_storage gui_font gui_font8_1 = {
Gui_fonttype_prop/* type of font */
, 8/* Height of font */
, 8/* space of font y */
, 1/* magnification x */
, 1/* magnification y */
, {& Gui_font8_1_prop}
, 7, 5, 7
};

We extract this structure, and specify the absolute address for the remaining font. c file to compile it into a binfile, and then fill in the address value & gui_font8_1_prop to the gui_font Font font structure.

In this separation method, the font is used. the C file is separated from the ucgui. In fact, if the C compiler itself supports absolute addressing, no need to use it. I found that the C compiler in iccavr supports the following definitions:

# Pragma abs_address: <address>

# Pragma end_abs_address

Use:

# Pragma abs_address: 0X4000

Const unsigned char string [] = "this is a test ";

# Pragma end_abs_address

For details, refer to the book "Introduction to the C Language Development Guide for AVR single-chip microcomputer", published by Tsinghua University, which can be downloaded here:

Http://www.mcu123.com/news/Soft/ebook/uc/AVR/200608/16.html

The absolute positioning of the program area is as follows:

4.6.4 absolute positioning of program memory ----- page 220.

You can download and take a look. I think if this type of compiler keyword is supported, it will be easy to use if this program area is definitely located, and the font will be available. the C file is absolutely located. I don't know how other compilers support it.

There is also support for absolute location in the program area in the C51. You can specify the starting address of a specific function. but I don't know how to implement the absolute positioning of the font library in the ucgui. If you are familiar with it, I can help you.

Studying uC/GUI and creating a new embedded GUI is challenging and refreshing .......
Network Name: ucgui
Google wave: ucgui.com@gmail.com
QQ: 106719880
Ucgui Study Group-12111753
Ucgui wave, find with: Public ucgui

Report post
Delete a single sticker
Copy a post
Add as essence
Single sticker shielding
Post comment

Admin-ucgui

Level: Administrator
Article: 1042
Credit: 7778
Registration: 2003-12-30

 

It has been nearly a year since this problem was solved...

Now I can come up with a perfect solution, hoping to help you.

The previous methods have not been clearly stated in several places. In fact, the people who ask the questions have made it clear, mainly including the following questions:

1. Specify how to compile constant data to flash or other Rom.

2. How to precisely locate the frequent volume of data, because in addition to constants and code, flash must be carefully arranged in space.

3. Is there a download tool that supports constant data during debugging, that is, a tool similar to flash loader.

Now let's talk about it in detail:

I. METHODS OF THE ads1.2 environment.

[1]. Here is an article in Article E, which specifically describes the format of the file to be loaded discretely, as follows:

Http://www.ucgui.com/ucgui/DUI0151A_ADS1_2_LinkUt.pdf

[2]. In addition, in another ebook:

"Armband structure and programming skills", this book is relatively large and will not be uploaded here. You can easily find it on Google. This book also describes the knowledge of ADS linker aslink.

[3]. Here we provide the following details about how to separately load files with SCF:

If the font f6x8. C is included, compile and link the font to 0xf000. The SCF file is as follows:

Rom_load 0x0
{
Er_ro + 0
{
* (+ RO)
}
Er_rw + 0
{
* (+ RW)
}
Er_ro_const 0xf000
{
F6x8. O (+ RO-DATA)
}

Er_zi + 0
{
* (+ Zi)
}
}

As above, when the above files are specified for the link, the constant in f6x8. O is compiled to the starting position of 0xf000, The RO-DATA represents the font of the read-only attribute.

After defining the font in flash, you don't have to load it into RAM. You just need to burn the font to the specified font once, which greatly facilitates the download process, this reduces unnecessary data downloads and RAM usage.

Ii. IAR environment practices.

Similar link command files are available in the IAR environment. Here I only provide a reference, which details how to write link command files, to locate constant data in flash.

Http://www.ucgui.com/ucgui/armbegin.pdf

Iii. GNU environment practices.

It is easier to achieve this purpose in the GNU tool chain. Similarly, only one LD linker is provided as follows:

Http://www.ucgui.com/ucgui/ld.pdf

Conclusion: in embedded systems, the memory layout of each device varies widely. Therefore, when linking, various connectors have corresponding link files, and some do not use link files by default, or use the default link file. In the ads environment, you can configure the file by using the number of resources. The generated file contains only three default segments: RO, RW, and Zi.

4. other ideas on font SOLIDIFICATION.

Later versions of ucgui390 may also consider that. the font of the C file format is not very good. It is not convenient to specify the address of the font constant data independently. Therefore, the ucgui later introduced the font of the other two formats:

[1]. Sif font ----- system independent font.

Advantage: Compared. the main advantage of a C font format file is that it is independent from the specific ucgui code. It can independently arrange a memory space to store the binary data of the SIF font, this actually solves the problem that we have specifically specified through the link method above. c format font constant number position problem.

Disadvantage: compared with the xbf font, the disadvantage is that the binary data block of the SIF font must be allocated with a memory space, which is not ideal when the memory space is tight.

[2]. xbf font ----- external bitmap font.

Advantage: The xbf font is the same as the SIF font, and you do not need to use the linker to specify the link address in the image. Its binary font data is also two separate parts from the ucgui code, in addition, it does not need to map the font data to a memory space. xbf fonts can be placed on a storage medium that does not need to be mapped to the memory space (such as reading and writing through I/O ), a callback function is used to read the xbf font data.

Disadvantages: currently, in addition to the slow reading speed of the media, it seems that the font display is slightly affected. It does not need to use link to specify the memory address of the font data; second, you do not need to map a piece of memory space. Third, you can also provide enough font support, as long as the storage space is large.

For more information about the fonts in these three formats supported by ucgui, see the following post:

Post: Ask, the Chinese Character Library of ucgui is fixed. Thank you!

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.