u-boot-2009.08在mini2440上的移植 增加LCD显示功能

发布者:温柔的心情最新更新时间:2024-07-01 来源: elecfans关键字:u-boot  mini2440  移植 手机看文章 扫描二维码
随时随地手机看文章

移植环境

1,主机环境:VMare下CentOS 5.5 ,1G内存。

2,集成开发环境:Elipse IDE

3,编译编译环境:arm-linux-gcc v4.4.3,arm-none-eabi-gcc v4.5.1。

4,开发板:mini2440,2M nor flash,128M nand flash。

5,u-boot版本:u-boot-2009.08


7.1添加 LCD 显示功能


对于这个 LCD 的支持是参考Openmoko 的代码移植的。Openmoko 的GTA2 使用的是S3C2442 的CPU,在LCD 控制器上是一样的。而GTA2 在U-boot 的可以在LCD 上显示字符,而且对于软件分层的U-boot 来说,只要将底层驱动移植过来并调整好初始化参数就可以在LCD 上显示console。下图是LCD驱动软件分层执行流程示意。可以看到LCD在执行时最终调用的是底层的board_video_init()函数,其主要作用是对LCD控制寄存器进行初始化。可由用户根据实际LCD硬件编写。

u-boot-2009.08在mini2440上的移植(七)---增加LCD显示功能

由于友善之臂使用了两种屏,他们在一个参数上有很小的差别,而屏有不可以通过程序去识别,所以只能简单的通过Nand Flash 配置来区分导入的参数(64MB Nand 的板子使用的都是NEC 的,其他的都是统宝的)。这个功能的移植修改了5 个文件(包括drivers/video/Makefile,以及前面已经修改过的board/samsung/mini2440/mini2440.c 文件)。

【1】在/drivers/video/下添加一个驱动文件名为s3c2410_fb.c,将下面内容粘贴进去:

/*
 * (C) Copyright 2006 by OpenMoko, Inc.
 * Author: Harald Welte
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

#include
 
#if defined(CONFIG_VIDEO_S3C2410)
 
#include
#include 'videomodes.h'
#include
/*
 * Export Graphic Device
 */
GraphicDevice smi;
 
#define VIDEO_MEM_SIZE  0x200000        /* 240x320x16bit = 0x25800 bytes */
 
extern void board_video_init(GraphicDevice *pGD);
 
/*******************************************************************************
 *
 * Init video chip with common Linux graphic modes (lilo)
 */
void *video_hw_init (void)
{
    S3C24X0_LCD * const lcd = S3C24X0_GetBase_LCD();
    GraphicDevice *pGD = (GraphicDevice *)&smi;
    int videomode;
    unsigned long t1, hsynch, vsynch;
    char *penv;
    int tmp, i, bits_per_pixel;
    struct ctfb_res_modes *res_mode;
    struct ctfb_res_modes var_mode;
//    unsigned char videoout;
 
    /* Search for video chip */
    printf('Video: ');

    tmp = 0;
 
         videomode = CFG_SYS_DEFAULT_VIDEO_MODE;
         /* get video mode via environment */
         if ((penv = getenv ('videomode')) != NULL) {
                 /* deceide if it is a string */
                 if (penv[0] <= '9') {
                         videomode = (int) simple_strtoul (penv, NULL, 16);
                         tmp = 1;
                 }
         } else {
                 tmp = 1;
         }
         if (tmp) {
                 /* parameter are vesa modes */
                 /* search params */
                 for (i = 0; i < VESA_MODES_COUNT; i++) {
                         if (vesa_modes[i].vesanr == videomode)
                                 break;
                 }
                 if (i == VESA_MODES_COUNT) {
                         printf ('no VESA Mode found, switching to mode 0x%x ', CFG_SYS_DEFAULT_VIDEO_MODE);
                         i = 0;
                }
                 res_mode =
                         (struct ctfb_res_modes *) &res_mode_init[vesa_modes[i].
                                                                  resindex];
                 bits_per_pixel = vesa_modes[i].bits_per_pixel;
         } else {
 
                res_mode = (struct ctfb_res_modes *) &var_mode;
                 bits_per_pixel = video_get_params (res_mode, penv);
         }
 
         /* calculate hsynch and vsynch freq (info only) */
         t1 = (res_mode->left_margin + res_mode->xres +
               res_mode->right_margin + res_mode->hsync_len) / 8;
         t1 *= 8;
         t1 *= res_mode->pixclock;
         t1 /= 1000;
         hsynch = 1000000000L / t1;
         t1 *=
                 (res_mode->upper_margin + res_mode->yres +
                  res_mode->lower_margin + res_mode->vsync_len);
         t1 /= 1000;
         vsynch = 1000000000L / t1;
 
         /* fill in Graphic device struct */
         sprintf (pGD->modeIdent, '%dx%dx%d %ldkHz %ldHz', res_mode->xres,
                  res_mode->yres, bits_per_pixel, (hsynch / 1000),
                  (vsynch / 1000));
         printf ('%sn', pGD->modeIdent);
         pGD->winSizeX = res_mode->xres;
         pGD->winSizeY = res_mode->yres;
         pGD->plnSizeX = res_mode->xres;
         pGD->plnSizeY = res_mode->yres;
            
         switch (bits_per_pixel) {
         case 8:
                 pGD->gdfBytesPP = 1;
                 pGD->gdfIndex = GDF__8BIT_INDEX;
                 break;
         case 15:
                 pGD->gdfBytesPP = 2;
                 pGD->gdfIndex = GDF_15BIT_555RGB;
                 break;
         case 16:
                 pGD->gdfBytesPP = 2;
                 pGD->gdfIndex = GDF_16BIT_565RGB;
                 break;
         case 24:
                 pGD->gdfBytesPP = 3;
                 pGD->gdfIndex = GDF_24BIT_888RGB;
                 break;
         }
 
         /* statically configure settings */
        pGD->winSizeX = pGD->plnSizeX = 240;
         pGD->winSizeY = pGD->plnSizeY = 320;
         pGD->gdfBytesPP = 2;
         pGD->gdfIndex = GDF_16BIT_565RGB;
 
         pGD->frameAdrs = LCD_VIDEO_ADDR;
         pGD->memSize = VIDEO_MEM_SIZE;
 
         board_video_init(pGD);
 
         lcd->LCDSADDR1 = pGD->frameAdrs >> 1;
 
         /* This marks the end of the frame buffer. */
         lcd->LCDSADDR2 = (lcd->LCDSADDR1&0x1fffff) + (pGD->winSizeX+0) * pGD->winSizeY;
         lcd->LCDSADDR3 = (pGD->winSizeX & 0x7ff);
 
         /* Clear video memory */
         memset((void *)pGD->frameAdrs, 0, pGD->memSize);
 
         /* Enable  Display  */
         lcd->LCDCON1 |= 0x01;   /* ENVID = 1 */
 
         return ((void*)&smi);
 }
 
 void
 video_set_lut (unsigned int index,      /* color number */
                unsigned char r, /* red */
                unsigned char g, /* green */
                unsigned char b  /* blue */
  )
 {
 }
 
 #endif /* CONFIG_VIDEO_S3C2410 */

[1] [2] [3]
关键字:u-boot  mini2440  移植 引用地址:u-boot-2009.08在mini2440上的移植 增加LCD显示功能

上一篇:u-boot-2009.08在mini2440上的移植 增加DM9000网卡驱动
下一篇:u-boot-2009.08在mini2440上的移植 增加USB功能

推荐阅读最新更新时间:2026-02-21 13:16

mini2440 u-boot linux 内核启动,移植较新(Linux3.19)内核至mini2440开发板(一)
s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns s3c24xx-nand s3c2440-nand: NAND soft ECC nand: device found, Manufacturer ID: 0xec, Chip ID: 0xda nand: Samsung NAND 256MiB 3,3V 8-bit nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 Creating 5 MTD partitions on nand : 0x000000
[单片机]
U-boot移植mini2440
本文章中的很多内容参考友善之臂的说明文档《mini2440之U-boot移植详细手册-20100419》,使用的U-boot的版本是u-boot-2010.03 说明:此次移植的目的不是为了制作一个功能强大的U-boot,只是做一个最简单的U_boot。该U-boot能够实现通过串口和电脑通信,可以将环境变量保存在NOR Flash中,通过TFTP服务器将使用NFS根文件系统的内核镜像从电脑拷贝到内存中执行。而且这个U-boot只支持从NOR中启动。 在移植U-Boot之前建议对U-Boot中的源码组织结构有较深的理解,可参考我的另一篇博文Bootloader介绍和Uboot源码结构 移植U-Boot的原则是,先选取与
[单片机]
【ARM】使用J-Link下载u-bootMini2440开发板
#1各种引导系统介绍 ##1.1 bios 1 BIOS是英文 Basic Input Output System 的缩略语,直译过来后中文名称就是 基本输入输出系统 。其实,它是一组固化到计算机内主板上一个ROM芯片上的程序,它保存着计算机最重要的基本输入输出的程序、系统设置信息、开机后自检程序和系统自启动程序。 其主要功能是为计算机提供最底层的、最直接的硬件设置和控制。 ##1.2 Grub 2 GNU GRUB(GRand Unified Bootloader简称“GRUB”)是一个来自GNU项目的多操作系统启动程序。GRUB是多启动规范的实现,它允许用户可以在计算机内同时拥有多个操作系统,并在计算机启动时选择希望运行的
[单片机]
【ARM】使用J-Link下载<font color='red'>u-boot</font>到<font color='red'>Mini2440</font>开发板
u-boot 移植 --->2、在u-boot新增SOC和板子
本次主要是要新增一个samsung的芯片到u-boot中,网上查阅资料发现s5pc1xx是与手上的S5PV210的友善的Tiny版子寄存器兼容的比较多,所以就准备以他为基础增加一个我的板子的支持到u-boot中。 step1 拷贝archarm目录下的mach-s5pc1xx目录修改名称为mach-s5pv210,注意这里的mach-xxx后面的xxx的命令是和Kconfig文件一会的修改相关的。 step2 在archarmKconfig 文件中增加新的芯片这里参考s5pc1xx的内容 。 。 。 config ARCH_S5PC1XX bool Samsung S5PC1XX select CPU_V7 sele
[单片机]
u-boot分析与移植——基于u-boot-2011.3和FL2440
关于移植的基本方法可以先阅读u-boot的README文档 If the system board that you have is not listed, then you will need to port U-Boot to your hardware platform. To do this, follow these steps: 1. Add a new configuration option for your board to the toplevel Makefile and to the MAKEALL script, using the existing entries as example
[单片机]
linux移植u-boot(一)——U-Boot详解+自定义命令实战
一、Bootloader 简单地说:Bootloader主要功能就是 在系统上电时开始执行,初始化硬件和设备,准备好软件环境,最后调用操作系统。 具体的包含:关闭你看门狗WATCHDOG,改变系统时钟,初始化存储控制器 ,将操作系统内核代码复制到内存中去运行。 为了开发方便,可以增加网络功能,从PC上通过串口或者网络下载文件,烧写文件,将flash上的内核代码解压后运行等。 Bootloader分为两种模式: (1):启动加载模式:上电后,Bootloader在板子上的某个固态存储设备上将操作系统加载到RAM中运行,没有用户的介入 (2):下载模式:开发人员可以使用各种命令,允许在各种工作模式之间切换,通过串口或者网络
[单片机]
linux<font color='red'>移植</font><font color='red'>u-boot</font>(一)——<font color='red'>U-Boot</font>详解+自定义命令实战
u-boot移植总结(二)LED点灯调试 和 u-boot加载地址
(一)LED点灯调试 FL2440电路总共有4个LED0,LED1,LED2,LED3,分别接到板子GPB5,GPB6,GPB8,GPB10引脚。通过设置三个寄存器GPBCON(0x56000010),GPBDAT(0x56000014),GPBUP(0x56000018),控制GPB 引脚可控LED的亮灭。 控制LED亮灭有三步: 1,设置GPB5,GPB6,GPB8,GPB10为输出工作方式,即GPBCON = 01 GPBCON = 01,GPBCON = 01,GPBCON = 01 2,GPBUP置0000 0101 0110 0000 即GPB5,GPB6,GPB8,GPB10皆禁止使能上拉 3,设置GPBD
[单片机]
<font color='red'>u-boot</font><font color='red'>移植</font>总结(二)LED点灯调试 和 <font color='red'>u-boot</font>加载地址
u-boot移植总结(四)u-boot-2010.09框架分析
(一)本次移植是基于FL2440,板子的基本硬件: CPU 型号为S3C2440,基于ARM920T,指令集ARMV4,时钟主频400MHz SDRAM H57V2562GTR-75C 2片*32MB=64MB,挂载于nGCS6 (0x3000 0000) NANDFLASH 型号:K9F2G08U0B 大小:256MB Network Adapter (网卡) DM9000AEP 10/100M自适应,挂载于nGCS4 (0x2000 0000) LED 5个LED(LED0~3)I/O口指示灯,LED5电源指示灯,LED9核心板3.3V指示灯 L
[单片机]
<font color='red'>u-boot</font><font color='red'>移植</font>总结(四)u-boot-2010.09框架分析
小广播
最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

厂商技术中心

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

电子工程世界版权所有 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2026 EEWORLD.com.cn, Inc. All rights reserved