Based on S3C2440 digital photo frame

Publisher:zeta16Latest update time:2024-07-29 Source: cnblogsKeywords:S3C2440 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

【Reference】Wei Dongshan's teaching notes

1. Program framework
1.1 Touch screen:
main press thread, sent to display process through socket
---------------------------
Package event: ts thread key thread
---------------------------
Operating system

The encapsulated data includes:
time,
type (click, up, down, left, right)
, position
, speed
, amplitude

1.2 Display

Zoom in (up) Zoom out (down) Left Right Current display control receiving sochket

libjpeg
mmap
----------------------------------------
memory memory memory memory

framebuffer
-----------
LCD

2. Display text
2.1 Text encoding method
If the source file is written in different encoding methods, the execution results will be different.
How to solve it? When compiling a program, you need to specify the character set
man gcc, /charset
-finput-charset=charset indicates the encoding method of the source file, and UTF-8 is used for parsing by default
-fexec-charset=charset indicates the encoding method used to represent the characters in the executable program, and UTF-8 is used by default

gcc -oa ac //

gcc -finput-charset=GBK -fexec-charset=UTF-8 -o utf-8_2 ansi.c


2.2 Dot matrix display of English letters and Chinese characters
Test:
A. Configure and modify kernel support to compile lcd.c into it
cp /work/drivers_and_test_new/10th_lcd/lcd.c drivers/video/
modify drivers/video/Makefile
#obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o
obj-$(CONFIG_FB_S3C2410) += lcd.o

nfs 32000000 192.168.1.123:/work/nfs_root/uImage; bootm 32000000

set bootargs console=ttySAC0,115200 root=/dev/nfs nfsroot=192.168.1.123:/work/nfs_root/fs_mini_mdev_new ip=192.168.1.17
nfs 32000000 192.168.1.123:/work/nfs_root/uImage_jz244 0; bootm 32000000
nfs 32000000 192.168.1.123 :/work/nfs_root/uImage_tq2440; bootm 32000000
nfs 32000000 192.168.1.123:/work/nfs_root/uImage_mini2440; bootm 32000000


B. Boot with a new kernel


2.3 Using FreeType to display text of any size
Section 2.3.1_Digital Photo Frame_Introduction to FreeType theory
Section 2.3.2_Digital Photo Frame_Testing FreeType on a PC

On PC:
tar xjf freetype-2.4.10.tar.bz2
./configure
make
sudo make install

gcc -o example1 example1.c -I /usr/local/include/freetype2 -lfreetype -lm
gcc -finput-charset=GBK -fexec-charset=UTF-8 -o example1 example1.c -I /usr/local/include /freetype2 -lfreetype -lm
./example1 ./simsun.ttc abc

Section 2.3.3_Digital Photo Frame_Displaying a vector font on the LCD

Cross-compile:
tar xjf freetype-2.4.10.tar.bz2
./configure --host=arm-linux
make
make DESTDIR=$PWD/tmp install

The compiled header files should be placed in:
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include

The compiled library files should be placed in:
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib

Copy tmp/usr/local/lib/* to /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib
sudo cp * /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib -d -rf
cp *so* /work/nfs_root/fs_mini_mdev_new/lib -d


Copy tmp/usr/local/include/* to /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include
cp * /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include -rf
cd /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include
mv freetype2/freetype .

arm-linux-gcc -finput-charset=GBK -o example1 example1.c -lfreetype -lm
arm-linux-gcc -finput-charset=GBK -o show_font show_font.c -lfreetype -lm


freetype/config/ftheader.h
freetype2/freetype/config/ftheader.h

arm-linux-gcc -finput-charset=GBK -fexec-charset=GBK -o show_font show_font.c -lfreetype -lm

Section 2.3.4_Digital Photo Frame_Display several lines of text on the LCD
a. Display several lines of text starting from the left
arm-linux-gcc -finput-charset=GBK -o show_lines show_lines.c -lfreetype -lm


b. Display several lines of text in the center


100ask gif
www.100ask.net


3. Display any coded text file on LCD to make an e-book

Lesson 1 Section 3.1_Digital Photo Frame_Extra Project_Electronic Book Effects and Frames

Lesson 1 Section 3.2_Digital Photo Frame_Extra Project_E-book Code Reading and Writing

Lesson 1 Section 3.3_Digital Photo Frame_Extra Project_E-book Pointer Operation

Lesson 1 Section 3.4_Digital Photo Frame_Extra Project_Link List Operation of E-book

Lesson 1 Section 3.5_Digital Photo Frame_Extra Project_Displaying eBooks on PC

ctrl+alt+shift+f1

Download address:
https://launchpad.net/ubuntu/+source/svgalib/1:1.4.3-30
svgalib_1.4.3.orig.tar.gz
svgalib_1.4.3-30.debian.tar.gz
svgalib_1.4.3-30.dsc

patch
tar xzf svgalib_1.4.3.orig.tar.gz
tar xzf svgalib_1.4.3-30.debian.tar.gz
cd svgalib-1.4.3.orig/
for file in ../debian/patches/*.patch; do patch -p1 < $file; done

Compile and install:
sudo make install // Compilation error, you need to install libx86
and then sudo make install


Download address
: http://packages.ubuntu.com/lucid/libx86-1

tar xzf libx86_1.1+ds1.orig.tar.gz
gunzip libx86_1.1+ds1-6.diff.gz
cd libx86-1.1/
patch -p1 < ../libx86_1.1+ds1-6.diff
make // Error, modify lrmi.c, add macros, refer to 561491.patch
make
sudo make install

When I run the PC program, I get an error: error while loading shared libraries: libvga.so.1: cannot open shared object file: No such file or directory. This is a very common error. The shared library cannot be found. However, I found that the library has been installed and exists in the /usr/local/lib directory, but the program just can't find it.

That means the system does not know which directory xxx.so is in.
At this time, you need to add the directory where xxx.so is located in /etc/ld.so.conf.
Generally speaking, there are many so files in the directory /usr/local/lib, so adding the line /usr/local/lib in /etc/ld.so.conf can solve this problem. When adding, just add: /usr/local/lib at the end. After saving and exiting, use the ldconfig command to update. Also note that if these commands are due to permissions, you can add sudo

sudo vim /etc/ld.so.conf

/usr/local/lib

sudo ldconfig

After doing this, there will be no errors when running again.

sudo ./show_file -s 16 -d crt -f ./FZYTK.ttf ./utf8.txt

http://security.ubuntu.com/ubuntu/pool/main//libx/libx86/
libx86_1.1+ds1.orig.tar.bz2 // Modify

sudo apt-get source libx86


4. Write a generic Makefile

Method to compile test_Makefile:
a. gcc -o test ac bc
For ac: preprocessing, compiling, assembling
For bc: preprocessing, compiling, assembling
Finally linking
Advantages: simple command
Disadvantages: if there are many files, even if you only modify one file, all files need to be "preprocessed, compiled, assembled" again, which is
inefficient

b. Write the Makefile
core: rules

Target: Dependency 1 Dependency 2
Command

Conditions for command execution:
i. The "dependency" file is newer than the "target" file
ii. There is no "target" file

5. Use multiple methods to support multiple inputs
http://cc.byexamples.com/2007/04/08/non-blocking-user-input-in-loop-without-ncurses/

http://www.groad.net/bbs/simple/?t3959.html

5.1 Use polling method // High CPU usage
Experimental method:
a. insmod s3c_ts.ko
to determine which device node corresponds to the touch screen
b.
export TSLIB_TSDEVICE=/dev/event0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0

c. Calibration
ts_calibrate

d. telnetd -l /bin/sh //Start the telnet service to log in and observe the CPU usage

e. ./show_file -s 24 -d fb -f ./MSYH.TTF ./utf8_novel.txt

(If it fails, kill the conflicting process first)

f. Execute the top command on the development board to observe


5.2 Use select, poll // Low CPU usage, suitable for many simple occasions

Reference: Advanced Programming I/O Multiplexing in UNIX Environment

Monitor multiple files. As long as one file is readable/writable/abnormal or timed out, it returns
int select(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, struct timeval *timeout);
maximum file handle + 1. Timeout of
the file being monitored for readability.
...

5.3 Use multithreading // Low CPU usage, very flexible
Refer to Unix_Linux_Windows_OpenMP multithreaded programming.pdf P18 3.3.2 Conditional variables

To achieve sliding page turning:
1. If the displacement difference of the touch point in the X direction exceeds 1/5 of the x resolution, the page will be turned.


gcc -o example1 example1.c -L/usr/local/lib/ -lfreetype -lm -I /usr/local/include/freetype2
gcc -finput-charset=GBK -fexec-charset=UTF-8 -o example1 example1. c -L/usr/local/lib/ -lfreetype -lm -I /usr/local/include/freetype2
gcc -finput-charset=UTF-8 -fexec-charset=UTF-8 -o example1 example1.c -L/ usr/local/lib/ -lfreetype -lm -I /usr/local/include/freetype2

6.1 Simple example of network programming6.2
Modify the e-book source code to support remote printing6.3
Improve remote printing


7. Use of libjpeg
1. Cross-compile libjpeg
tar xzf libjpeg-turbo-1.2.1.tar.gz
cd libjpeg-turbo-1.2.1
./configure --prefix=/work/projects/13.libjpeg/libjpeg-turbo-1.2.1/tmp/ --host=arm-linux
make
make install

2. Cross-compile jpg2rgb.c
2.1
arm-linux-gcc -o jpg2rgb jpg2rgb.c -I /work/projects/13.libjpeg/libjpeg-turbo-1.2.1/tmp/include -L /work/projects/13. libjpeg/libjpeg-turbo-1.2.1/tmp/lib -ljpeg
cp jpg2rgb /work/nfs_root/fs_mini_mdev_new
cp libjpeg-turbo-1.2.1/tmp/lib/*so* /work/nfs_root/fs_mini_mdev_new/lib/ -d

2.2
The compiled header files should be put into:
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include
:
cd /work/projects/13.libjpeg/libjpeg-turbo-1.2.1/tmp/include
cp * /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include

[1] [2]
Keywords:S3C2440 Reference address:Based on S3C2440 digital photo frame

Previous article:ubuntu18: Create a new S3C2440 emulator in QEMU
Next article:ARM Linux bootloader notes

Recommended ReadingLatest update time:2024-11-16 09:31

How to use JLINK to burn U-boot to NAND Flash on S3c2440
Many students use laptops as their ARM development and learning platforms. Most laptops do not have parallel ports, which means they cannot use JTag to debug and burn programs into Nand Flash. Fortunately, we still have JLINK. It is very simple to use JLINK to burn U-boot into Nor Flash. Most NOR Flashes are supported
[Microcontroller]
Analysis of s3c2440 startup process
The 2440 startup process is a difficult point and not easy to understand. The understanding of the 2440 startup process affects the subsequent analysis of the bare metal code execution process, thus showing the importance of the 2440 startup process.   2440 startup mode and startup mode selection Search for map in th
[Microcontroller]
Introduction to the S3C2440 USB Host Driver protocol based on OHCI protocol (I)
What is OHCI The USB protocol specifies four types of transfers: interrupt transfer, control transfer, isochronous transfer, and bulk transfer. There are two types here: periodic transfer and non-periodic transfer. Periodic transfer includes interrupt transfer and isochronous transfer, because periodic transfer must
[Microcontroller]
Introduction to the S3C2440 USB Host Driver protocol based on OHCI protocol (I)
Memory Controller and SDRAM (S3C2440)
S3C2440 belongs to unified addressing, that is, the memory and peripherals are uniformly addressed. The CPU can access different devices such as a.GPIO, b.UART, IIC, c.NOR, NAND, network card, etc. through addressing. Q: So how does the CPU access the different registers? Answer: The CPU only sends an address to t
[Microcontroller]
Memory Controller and SDRAM (S3C2440)
Porting linux-2.6.30.4 to S3C2440
1. Download the linux-2.6.30.4 source code and decompress it ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.4.tar.gz tar zxvf linux-2.6.30.4.tar.gz 2. Add support for ARM in the system $vim Makefile 193#ARCH ?= $(SUBARCH)  194#CROSS_COMPILE ?=  195 ARCH=arm  196 CROSS_COMPILE=arm-linux- 3. Modify the system
[Microcontroller]
Interrupts of S3C2440
When an interrupt occurs at the interrupt source, this signal is automatically suspended PEND and automatically masked MASK S3C2440 has a total of 60 interrupt sources, of which 15 are sub-interrupt sources, which correspond to each bit in the SUBSRCPND register, and the other 45 interrupt sources cor
[Microcontroller]
Interrupts of S3C2440
S3C2440 development board file transfer
Looking at the various software in the tutorial, I feel dizzy and need to organize them well. 1. The first step of blank development board --- write bootloader It is similar to installing an operating system on a computer. Without an operating system, it is just an integrated circuit board, which is useless. Bootloade
[Microcontroller]
s3c2440 chip serial port operation
The S3C2440A Universal Asynchronous Receiver and Transmitter (UART) provides three independent asynchronous serial input/output (SIO) ports, each of which can operate in interrupt or DMA-based mode. In other words, the UART can generate an interrupt or DMA request to transfer data between the CPU and the UART. The UAR
[Microcontroller]
s3c2440 chip serial port operation
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号