uclinux移植项目及说明

合集下载

uClinux 的编译和运行

uClinux 的编译和运行

uClinux 的编译和运行说明:这个编译过程是基于uClinux-dist-51EDA.tar.bz2这个文件可以在51EDA论坛的客服中心找到。

1.创建开发环境首先需要编译的环境。

我们最好使用Linux作为开发平台,因为Linux以及uClinux的开发者们基本都是在Linux下完成的开发。

为了能够编译uClinux,我们需要下载uClinux的编译器。

这个文件可以在uClinux的官方网站得到,也可以在论坛的客服中心下载。

官方的下载地址是:/pub/uClinux/arm-elf-tools/arm-elf-tools-20030314.sh但是这个网站的速度比较慢,因此您也可以在论坛的客服中心下载。

是一样的文件。

在这里需要注意的是,虽然同为gcc和binutils工具,但是必须使用uClinux发布的版本,因为这个gcc和binutils都是为了能够编译FLAT格式的文件而订制的,另外也加入了ARM对PIC(Position Independent Code,位置无关代码)的支持。

PIC的支持是用来编译动态库或者XIP模式的可执行文件。

关于XIP的介绍有一篇文章:/article.pl?sid=02/08/28/0434210大家可以了解一下XIP。

但是由于XIP并不是很稳定,所以在我们发布的uClinux版本中并没有使用这个技术。

然后,将下载得到的文件,是一个sh文件。

这是一个自解压的文件(就好比Windows 下面的自解压zip或者rar一样)。

为了能够运行,我们需要:./arm-elf-tools-20030314.sh这样如果不能运行的话,那应该使用下面的命令:chmod 755 arm-elf-tools-20030314.sh得到了编译环境,就可以编译源代码了。

当然,首先要把代码解压缩到你的目录下面:tar xjvf uClinux-dist-51EDA.tar.bz2它会把全部的文件解压缩到uClinux-dist的目录下。

基于uClinux系统的MiniGUI的研究与移植

基于uClinux系统的MiniGUI的研究与移植

定 时 器等 。

的外观非常华丽的图形界面。 通过两种不同的内部软件结构支持低端显

示设 备( 如单色 L D 和高端显示设备( C ) 如彩色显 示器) 后者在前 者 的基 础上提供 了强大 的图形 ,
功能 。

2 M nG 1 iiU 的特 点和体 系结构
2 1 MiiU 的特 点 . nG I
l s s te sr c ue a d c aa trsiso n G ,a d p e e t a s h me ta r n p a t Mi i UIt a g tp afr fe o f u y e h t t r n h r ce it fMi i UI n r s ns c e h tt s ln s n G o tr e l t m atrc n g — u c a o i
T 9 17 N 1 .3
和特点 , 并在配置和编译好 u l u 后 , Ci x 提出一种将 Mi G 1 n n U 移植到 目标平 台上的方案 。 u 关键词 移植
中图分类号
Re e r h a d P ri g o ii sa c n o t fM nGUIBa e n u iu y tm n sd o Ci x S se n
l 引言
嵌入式系统是当今一个非常重要的发展方向,
嵌入 式 的广 泛应 用 已经 无所不 在 , 手机 、 电话 座机 、
G I 统 : 缩 的 X Widw 系 统 、 nG IMi U 系 紧 no MiiU 、 —
co n o s pn U 及 Q / m e d d 等 ,而 r d w 、O e G I Wi T E bde
( o p t ea m n , egagN r l o ee , egag4 10 ) C m u r pr e tH n n oma C l g H n n 2 08 eD t y l y

uClinux上Microwindows的移植与中文化

uClinux上Microwindows的移植与中文化
维普资讯
Mi o o ue p l ain o. 2 N . ,0 6 c c mp t A pi t s 12 , o 7 2 0 r r c o V 文 章 编 号 :0 7 7 7 2 0 ) 6 o 6 4 1 o — 5 X(0 6 0 —0 4 一O
2 Mlr w d w c o io s系统 介 绍
Mi o n o c wid ws的最 新 版本 已经 更 新 到 0 9 。 们 采 用 了 r .1 我
Mi o n o 是 一 个 开 放 源码 的嵌 入 式 GUI 目 , c wid ws r 项 目的 在 于 把 现 代 图 形 视 窗 环 境 的 特 性 引 入 到 小 型 设 备 上 。 Mi .
co id ws起 源 于 Na o rW n o n GUl 目, 前 的 发 布 包 括 M i 项 目 r .
比较 稳 定 的发 布 版 0 9 . 0版 , 9 提 供 了放 多 新 增 功 能 , 0. O版 并 修止 08 . 9版 的一 些 B UG。增 强 和新 增 功 能 主要 包 括 : 新 的 对 N I XL B项 目的 支 持 , 置 触 摸 屏 校 准 与 一 些 新 的 基 于 AR 内 M 平 台 的硬 件 支 持 ; 善 x 1 屏 幕 驱动 与绘 图 速 度 : 体 的增 改 l的 字
对 Mio no c wid ws的 中 文 化 进 行 了 研 究 和 分 析 , 对 几 种 方 r 并 法 进 行 了 比较 。 于 本项 目对 多 国 语 言 的需 求 , 际 采 用 了基 基 实 于F e tp 2的 T u tp rey e r ey e中 文 字 库 , 国 际 化 与 本 地 化 嵌 入 图 将
应 用 程 序 接 口 ( Ps A I)

STM32_uClinux应用文档

STM32_uClinux应用文档

AN3012Application noteGetting started with uClinux™for STM32F10x high-density devicesIntroductionuClinux, pronounced “you-see-Linux”, literally means “microcontroller (µC) Linux®”.uClinux is a Linux kernel fork for microcontrollers (MCUs, embedded systems). It does nothave a memory management unit (MMU). Originally derived from version 2.0 (1996) of theLinux kernel, it now has ports based on Linux 2.6. Since version 2.6, the major parts ofuC linux have been integrated with the mainline kernel for a number of processorarchitectures. The project continues to develop patches and supporting tools to use Linuxon microcontrollers. uClinux supports many architectures, and this new version supports theSTM3210E-EVAL evaluation board.The purpose of this application note is to explain you how to:1.Install the uClinux operating system, the toolchain, and configure the kernel for theSTM3210E-EVAL board2. Build a uClinux image and download it to the STM3210E-EVAL board3. Add applications to the kernelSeptember 2009Doc ID 16051 Rev 11/36Contents AN3012Contents1Package description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2Hardware description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Getting the tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.1uClinux package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.1.1Standard distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.1.2STM3210E-EVAL uClinux software kit . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2GNU toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.3DFuSe & Flash loader demonstrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.3.1DFuSe applet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.3.2Flash loader demonstrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Building the uClinux image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.1Installing the toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.2Preparing the source code tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124.3Configure uClinux for STM3210E-EVAL . . . . . . . . . . . . . . . . . . . . . . . . . . 134.3.1Configuring the kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154.3.2Application/library settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.4Running the build process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185Loading the images to the board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195.1Loading the “kernel loader / software updater” . . . . . . . . . . . . . . . . . . . . . 195.1.1Software installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195.1.2Hardware installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195.1.3Load the hex file to the Flash memory . . . . . . . . . . . . . . . . . . . . . . . . . . 205.2Loading the kernel/root file system images . . . . . . . . . . . . . . . . . . . . . . . 215.2.1DfuSe demonstration installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.2.2Generating the .dfu image and upgrading the board . . . . . . . . . . . . . . . 22 6First run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 7Command examples/tutorials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272/36Doc ID 16051 Rev 1AN3012Contents8How to add new features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298.1How to add a new hardware driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298.1.1References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298.1.2Example of a kernel driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298.2How to add a new application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 9Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35Doc ID 16051 Rev 13/36List of tables AN3012 List of tablesTable 1.Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4/36Doc ID 16051 Rev 1AN3012List of figures List of figuresFigure 1.STM3210E-EVAL board. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Figure 2.Configuring the installation parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Figure 3.uClinux-dist directory.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Figure 4.uClinux kernel directory.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Figure 5.uClinux configuration main menu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Figure 6.Vendor & Product selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Figure 7.Kernel / Library / Defaults selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Figure 8.System Type configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Figure 9.STM3210-EVAL demonstration menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Figure 10.Device Manager window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Figure 11.Flash loader demonstrator download configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Figure 12.Multi Bin injection window (STM3210E-EVAL-jffs configuration) . . . . . . . . . . . . . . . . . . . . 22 Figure 13.Multi Bin injection window (STM3210E-EVAL-MCU_Flash configuration). . . . . . . . . . . . . 23 Figure 14.DfuSe demonstration window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Figure 15.Example of MS HyperTherminal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Figure 16.uClinux boot log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Figure 17.Linux device driver architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Figure 18.STM3210E-EVAL uart_driver struct. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Figure 19.STM3210E-EVAL uart_port struct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Figure 20.STM3210E-EVAL uart_ops struct. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Figure 21.STM3210E-EVAL console struct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Figure 22.STM3210E-EVAL console Init function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Figure 23.Simple GPIO file_operations struct. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Figure 24.Simple GPIO write operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Doc ID 16051 Rev 15/36Package description AN30126/36Doc ID 16051 Rev 11 Package descriptionThis section presents all the files in the package, that are needed to get started with uClinuxon STM32F101xC/D/E and STM32F103xC/D/E devices.●uClinux_on_stm32.patch.gz : the uClinux patch, using which the ARM Cortex-M3 CPU and STM3210E-EVAL board are supported.●AN3012.pdf : the purpose of this guide is to show all the steps necessary to successfully configure, build and run uClinux on the board. It also presents theprocedure to add new hardware driver and applications to the kernel.●Tiny_kernel_boot_loader.hex / kernel_boot_loader.hex : these are the boot loaders required to boot up the board and load uClinux (kernel loader / firmware updater).●uClinux_on_stm32-jffs.dfu / uClinux_on_stm32-MCU_Flash.dfu : these are the binary image files that can immediately be downloaded to the board to get uClinux running.AN3012Hardware description Doc ID 16051 Rev 17/362 Hardware descriptionThe STM3210E-EVAL evaluation board is designed as a complete development platform forSTMicroelectronics's ARM™ Cortex ®-M3 core-based STM32F103xx microcontrollersdelivered in 144-pin packages. This device features: full speed USB2.0, CAN2.0A/Bcompliant interface, two I 2S channels, two I 2C channels, five USART channels withSmartcard support, three SPI channels, two DAC channels, FSMC interface, SDIO, 64Kbyte of internal SRAM and 512 Kbyte of Flash memory, JTAG and SWD debug support.The STM3210E-EVAL has the following onboard hardware features:●Three 5 V power supply options: power jack, USB connector or daughterboard ●Boot from user Flash memory, system memory or SRAM ●I2S audio DAC, stereo audio jack ●128 Mbyte MicroSD card ●A- and B-type Smartcard support ●64 or 128 Mbit serial Flash memory, 512 Kbit × 16 SRAM, 512 Mbit or 1 Gbit NAND Flash and 128 Mbit NOR Flash memory ●I2C/SMBus compatible serial interface temperature sensor ●Two RS-232 channels with RTS/CTS handshake support on one channel ●IrDA transceiver ●USB2.0 full speed connection ●CAN2.0A/B compliant connection ●Inductor motor control connector ●JTAG and trace debug support ●240 × 320 TFT color LCD ●Joystick with 4-direction control and selector ●Reset, wakeup, tamper and user buttons ●4 color LEDs ● RTC with backup batteryHardware description AN3012 Figure 1.STM3210E-EVAL board8/36Doc ID 16051 Rev 1AN3012Getting the tools Doc ID 16051 Rev 19/363 Getting the toolsThis section explains how to get the software tools that are required to build and run uClinuxon the STM3210E-EVAL evaluation board.3.1 uClinux package3.1.1 Standard distributionY ou should first download the original uClinux source files from the uClinux project page(/), or simply follow the following direct link:/pub/uClinux/dist/uClinux-dist-20080808.tar.bz2To get the uClinux-dist-20080808.tar.bz2 file (281Mbytes), which is compatible with theSTM3210E-EVAL uClinux kit.Porting is based on the latest stable version of uClinux which implements the Linux kernel2.6.26-uc0.Y ou also need the uClinux distribution update patch file: uClinux-dist-20080808-20090112.patch.gz (47.1Mbytes) available from:/pub/uClinux/dist/patches/uClinux-dist-20080808-20090112.patch.gz3.1.2 STM3210E-EVAL uClinux software kitThis package contains the kernel patch (update of 399 files) and the kernel boot loader (seeSection 1: Package description ). The package is available from /stm32.3.2 GNU toolchainA toolchain known to successfully build the kernel for ARM Cortex-M3 targets can bedownloaded from the CodeSourcery web site /, or using thefollowing link: /sgpp/lite/arm/portal/release827The G++ Lite 2009q1 toolchain is a free version of the CodeSourcery G++ toolchain, whichis an improvement of the GNU toolchain for ARM processors. It supports ARM, thumb andthumb-2 compilation for all architectures, including Version 7 of the ARM Architecture.Note:1This application note only shows how to Install the “easy-to-install recommended packages”.2Y ou need a PC running on the Linux operating system to be able to install and compileuClinux. The Linux distribution (Fedora, Mandriva, Ubuntu, etc.) should have the kerneldevelopment kit.3.3 DFuSe & Flash loader demonstratorThese two tools are needed to load the final binary images to the board.Getting the tools AN301210/36Doc ID 16051 Rev 13.3.1 DFuSe appletDFuSe stands for Device firmware upgrade application. This applet, coupled to the kernelboot loader firmware, allows the upgrade of the final .dfu file to the external NOR Flashmemory.It can be downloaded from the STMicroelectronics website or directly, using the followinglink: /stonline/products/support/micro/files/um0412.zip .3.3.2 Flash loader demonstratorThis applet, together with the System memory boot loader capabilities, is used to upgradekernel_boot_loader.hex to the STM32F101/103xC/D/E’s 512-Kbyte internal Flash memory.The Flash loader demonstrator is available from at:/stonline/products/support/micro/files/um0462.zipNote:Y ou need a PC running on the Microsoft ® Windows ® operating system to be able to run anduse these two applets.4 Building the uClinux imageThis section shows the kernel building process from scratch; to successfully build theuClinux image, you have to Install GNU toolchain, extract the uClinux source files, apply thepath to the source, configure uClinux for the STM3210E-EVAL board and finally run thebuild process.4.1 InstallingtoolchaintheOn a host PC running with the Linux OS:1.Move to the directory containing the previously downloaded arm-2009q1-163-arm-uclinuxeabi.bin file.2. Execute the installer by double clicking on the bin file or from the command line bytyping:#./arm-2009q1-163-arm-uclinuxeabi.bin3. Follow the installer Wizard to install the typical toolchain settings.Figure 2.Configuring the installation parametersNote:When no windowing server is running you can use the console installation mode, which is enabled with the “-i console” parameter:# ./arm-2009q1-163-arm-uclinuxeabi.bin -i consoleDoc ID 16051 Rev 111/364.2 Preparing the source code treeLet us assume that all the downloaded files are present under the ~/sources directory.Make a new workspace directory, where the build process will take place.# mkdir ~/workspace1.Extract the original uClinux distribution files: make sure you have enough free space(more than 2 Gbytes).# cd ~/workspace# tar -xjvf ~/sources/uClinux-dist-20080808.tar.bz2Figure3 shows what is under the uClinux-dist directory.Figure 3.uClinux-dist directory.2. Update the uClinux distribution with the uClinux-dist-20080808-20090112.patch.gzpatch:# cd ~/workspace/uClinux-dist/# zcat ~/sources/uClinux-dist-20080808-20090112.patch.gz | patch -p13. To enable support of STM32 MCUs, patch the uClinux distribution withuClinux_on_stm32.patch.gz from the STM3210E-EVAL uClinux kit:# zcat ~/sources/uClinux_on_stm32.patch.gz | patch -p112/36Doc ID 16051 Rev 1Figure 4.uClinux kernel directory.4.3 Configure uClinux for STM3210E-EVALNow that you have enabled support of the STM3210E-EVAL evaluation board by uClinux,you need to set up the configuration for the kernel and the final application. Many types ofkernel binary images can be built depending on how you configure uClinux.In this section you will see how to configure the uClinux kernel to run from the STM32’sinternal Flash memory or the external NOR Flash memory.# make menuconfigFrom the main menu, select the vendor / product as shown in Figure5.Doc ID 16051 Rev 113/36Figure 5.uClinux configuration main menuSelect “STMicroelectronics” for “Vendor” and, depending on the type of kernel image youwant to build, select “STM3210E-EVAL-jffs” or “STM3210E-EVAL-MCU_Flash” for“Product”.By selecting “STM3210E-EVAL-jffs” you apply the default configuration that enables supportof an external Flash memory, and boot from it.If you choose the “STM3210E-EVAL-MCU_Flash” configuration, the compilation script willbuild a mini image that runs from the microcontroller’s internal Flash memory.Figure 6.Vendor & Product selectionReturn to the main menu (with the “Exit” button or the “ESC“ key).14/36Doc ID 16051 Rev 1Under the Kernel / Library / Defaults Selection menu, choose Linux-2.6.x for the “kernelversion” and “none” for the “libc version” and toggle the next three menus as shown inFigure7:●“Default all settings” will apply the default vendor/product configuration to the kerneland application.●“Customize Kernel Settings” is used to edit the kernel configuration.●“Customize Application/Library Settings” is used to choose the application that willbe add to the root file system.●Finally “Update Default Vendor Settings” is used to save the new configuration as thevendor default configuration for future use.Figure 7.Kernel / Library / Defaults selectionY ou can now exit the configuration menu. When prompted to save, choose “yes”.kernel4.3.1 ConfiguringtheThe Linux kernel has many configuration items. If you have followed the above describedsteps, the kernel should be configured to meet the STM3210E-EVAL evaluation boardspecifications. Let us now look into some of the main configuration menus.●The System Type menu (see Figure8) shows the MMU setting, ARM System type,processor type, Flash and SRAM settings. All these options should coincide with theboard specifications.Doc ID 16051 Rev 115/36Figure 8.System Type configuration●The boot options menu is used to enable the XIP (execute in place) mode and set thephysical location of the kernel xipImage. Y ou can also specify the default kernelcommand line. The “XIP Kernel Physical Location” parameter points to the Flashmemory address where the kernel image is located.For example, if “STM3210E-EVAL-jffs” was selected, the kernel binary will be written tothe external Flash memory address 0x64000000 set in the configuration menu (asdescribed in Section5.2.2: Generating the .dfu image and upgrading the board).If “STM3210E-EVAL-MCU_Flash” was chosen, the XIP setting will point to0x08003000.[ * ] Kernel Execute-In-Place from ROM(0x64000000) XIP Kernel Physical Locationor(0x08003000) XIP Kernel Physical Location●For console input/output, enter “Device Drivers” ->“Character Device”-> “SerialDrivers”. Set the two following options:[ * ] STM3210E-EVAL USART Port[ * ] Support for console on STM3210E-EVAL USART Port●Many file systems are supported by the uClinux kernel and can be enabled from the“File systems” menu. Y ou can determine which file system will be supported accordingto your product memory size. For example if you need the jffs2 file system you have toenable it.In the case of the STM3210E-EVAL-jffs configuration, this file system is mandatorybecause it is used as the root file system.Under the “File systems” -> “Miscellaneous File system” submenu, toggle JFFS2 fs(with fs standing for file system).[ * ] Journalling Flash File System v2 (JFFS2) support16/36Doc ID 16051 Rev 14.3.2 Application/library settingsIn this menu, leave the vendor default settings. In “Miscellaneous Applications” ->“STM3210E-EVAL Demo(s)”, you will find a few applications examples exploiting theSTM32 hardware and the uClinux features and drivers.Applications under development will also appear there.Figure 9.STM3210-EVAL demonstration menu1.If you use the STM3210E-EVAL-MCU_Flash configuration, the Show Logo application will not be selectedbecause the LCD is not initialized during the boot process hardware initialization.When exiting the configuration menu, save the settings.Doc ID 16051 Rev 117/364.4 Running the build processY ou are now ready to start building the uClinux system. Depending on the previouslyselected configuration (“STM3210E-EVAL-jffs” or “STM3210E-EVAL-MCU_Flash”), you willuse one of the two following processes to build the kernel image:●If you chose the STM3210E-EVAL-jffs configuration:Simply type the “make” command and wait the end of the build process. At this step,the kernel and the selected application are built.After this operation, the xipImage.bin, rootfs.img.bin and logo.bin files are generatedand copied to the “uClinux-dist/images/” folder.●If you chose the STM3210E-EVAL-MCU_Flash configuration:To build the minimal image, proceed as follows:a) Run the “make ucfront” command to prepare tools to build user applications.b) Run the “make user_only” command to prepare user applications.c) Run the “make romfs” command to build the initramfs folder tree.d) Run the “make image” command to copy the kernel image to the “uClinux-dist/images/” folder.At the end of this step a single xipImage.bin file is generated.Whatever the configuration you used (“STM3210E-EVAL-jffs” or “STM3210E-EVAL-MCU_Flash”), now all you need to do is copy the generated image(s) and jump to the nextstep: Loading the images to the board.18/36Doc ID 16051 Rev 15 Loading the images to the board5.1 Loading the “kernel loader / software updater”On a host PC running with a recent version of Microsoft Windows, you need to verify thatyou have an available COM port to communicate with the board.To check that you have an available communication port, right-click on the “My Computer”icon on the desktop and select “Properties” from the pop-up menu. The “System Properties”dialog box appears. Click on the “Hardware” tab, and then on the “Device manager” buttonto display the system hardware configuration. Available COM ports are grouped under the“Ports (COM & LPT)” node in the hardware tree as shown in Figure10.Figure 10.Device Manager window5.1.1 SoftwareinstallationRun the Flash_Loader_Demonstrator_VX.Y_Setup.exe file: the InstallShield Wizard willguide you through the installation of the Flash loader demonstrator application on yourcomputer. Once the software has been successfully installed, click on the “Finish” button. 5.1.2 HardwareinstallationConnect the device to a spare COM port on your PC.Doc ID 16051 Rev 119/365.1.3 Load the hex file to the Flash memoryBefore loading the file, move the boot jumpers to “System Memory Mode” then power up theboard. Run the Flash loader demonstrator application from the “Programs” menu.1.The first step consists in selecting the connection settings: UART port, baud rate andtimeout.2. In the second step, the connection is established and communication has started. Thisstep consists in displaying the Flash memory status. If this status is read-protected, the“Next” button is disabled until the read protection is removed by clicking on the“Remove protection” button. Removing the read protection causes all the Flashmemory pages to be erased.3. At this step the Wizard displays the available device information such as the target ID,the firmware version, the supported device, the memory map and the memoryprotection status. Select the target from the target combobox and click on “Next”.4. At this step, select the Download operation and set the related parameters as shown inFigure11. “Download from file” should point to the Kernel boot loader file from theSTM3210E-EVAL uClinux kit.Depending on the board configuration selected in Section4.3: Configure uClinux forSTM3210E-EVAL when booting from the STM32’s internal Flash memory, you requirea tiny boot loader to preserve some Flash pages for the kernel. In the case when thekernel is placed in an external Flash memory you can use a standard boot loader.–Use Tiny_kernel_boot_loader.hex (< 12 Kbytes) when booting from the STM32’s Flash memory (with the “STM3210E-EVAL-MCU_Flash” configuration).–Use Kernel_boot_loader.hex when booting from the NOR Flash memory (with the STM3210E-EVAL-jffs configuration).20/36Doc ID 16051 Rev 1Figure 11.Flash loader demonstrator download configuration5. The last Wizard page shows the operation page. It gives the size of the data to bedownloaded, the percent completed and the duration of the operation.Note:If an error message appears, you can consult the Flash Loader demonstrator user manual available from the “Programs” menu.5.2 Loading the kernel/root file system imagesMove the boot jumpers to select the “User Flash” boot mode, set the JP14 board jumper toconnected mode and reset the board.5.2.1 DfuSedemonstration installationSoftware InstallationRun the DfuSe_Demo_VX.Y.Z_Setup.exe file: the InstallShield Wizard will guide you toinstall DfuSe applications and source code on your computer. When the software issuccessfully installed, click on the “Finish” button. Y ou can then explore the driver directory.The driver files are in the “Driver” folder located at your install path (C:\Programfiles\STMicroelectronics\DfuSe).Doc ID 16051 Rev 121/36Hardware installation●Connect the device to a spare USB port on your PC.●The “Found New Hardware Wizard” then starts. Follow the wizard to install the newhardware driver available in the “Driver” folder at your install path.5.2.2 Generating the .dfu image and upgrading the boardLet us assume that the files generated from Running the build process have been copied toa local folder on the MS Windows host (e.g. C:\Workspace\Images).DFU file managerStart the DFU file manager application (Start -> All Programs -> STMicroelectronics ->DfuSe-> DFU File Manager), select “i want to GENERATE a DFU file from S19, HEX orBIN files” then click on “OK”.1.Set an unused Target ID number.2. Fill the VID, PID, Version and target name fields3. Click on the “Multi Bin” button to show the “Multi Bin Injection” dialog box.If you chose the “STM3210E-EVAL-jffs” configuration in Section4.3: Configure uClinuxfor STM3210E-EVAL you have to:–Set the start address in the Address field to “6400 0000”.–Click the Browse button to select the xipImage.bin file atC:\Workspace\Images\xipImage.bin.–Click on the Add to list button to add the selected binary file at the given address.–Redo the same sequence to add C:\Workspace\Images\rootfs.img.bin at address “64100 0000”, and C:\Workspace\Images\logo.bin at address “64160 0000”.–Click on “OK” to validate.Figure 12.Multi Bin injection window (STM3210E-EVAL-jffs configuration)22/36Doc ID 16051 Rev 1Doc ID 16051 Rev 123/36If you chose the “STM3210E-EVAL-MCU_Flash” configuration in Section 4.3:Configure uClinux for STM3210E-EVAL you have to:–Set the start address in the Address field to “08003000”.–Click the Browse button to select the xipImage.bin file at C:\Workspace\Images\xipImage.bin .–Click on the Add to list button to add the selected binary file at the given address.–Click on “OK ” to validate.Figure 13.Multi Bin injection window (STM3210E-EVAL-MCU_Flash configuration)4. To create the DFU file, click on “Generate ”.How to download a DFU fileRun the “DfuSe demonstration” application (Start -> All Programs ->STMicroelectronics ->DfuSe -> DfuSe Demonstration).1.Click on the “Choose ” button to select the previously generated DFU file. The displayed Information such as VID, PID, Version and target number is read from the DFU file.2.Choose “NOR Flash” or “internal Flash” in the “Select target(s)” area.3. Check the “Verify after download ” checkbox if you want to launch the verificationprocess after downloading data (this step is optional ).4. Click on the “Upgrade ” button to start upgrading the file content to the memory.5.Wait until the end of the upgrade process.。

uCLinux开发介绍

uCLinux开发介绍

uCLinux开发介绍严永红Linux是当前一种非常受欢迎的操作系统,它与UNIX系统兼容,并开放源代码。

它包含所有现代操作系统所具有的一切特性,包括多任务,虚拟内存,代码共享,按需载入,内存管理,以及TCP/IP网络。

并且,它遵循POSIX标准,只要是遵循POSIX API的应用程序很容易被移植。

目前,随着嵌入式系统的蓬勃发展。

Linux也已对嵌入式系统的开发产生具大影响。

大多数流行的CPU都被移植上去,ARM, PowerPC , MIPS, 68K, SPARC, Alpha, SH 等等. 这些CPU都含有一种叫做内存管理单元(MMU)的硬件,来支持标准Linux所需要的虚拟内存。

但在嵌入式世界里,还有很多CPU是没有MMU的,象ARM7、68328等等。

uClinux 正是为了解决这种没有MMU的CPU而产生的。

在uCLinux这个英文单词中,u表示Micro,小的意思,C表示Control,控制的意思,连起来就是Micro-Control-Linux, ―运行在微控制器上的Linux.‖针对这种没有MMU的CPU架构,uCLinux采用了一种平板式(Flat)的内存模型来去除对MMU的依赖, 并且改变了用户程序的加载方式,开发了运用于uCLinux的C函数库--uCLibc. 由于这些变化,一般的Linux开发工具(例如GDB)在开发uCLinux时会碰到一些困难,包括内核的移植,驱动程序及应用程序的调试。

针对这样状况。

Hitool System公司开发了Hitool for uClinux开发套件,来帮助用户开发基于uClinux的系统。

Hitool for uClinux与其它的Linux开发工具相比,有几个优点:A.整个开发过程只在Windows环境下完成,包括内核的配臵、编译,应用程序的编译,文件系统的生成,内核的调试,用户程序的调试。

B.可以采用多种调试方式,既可以采用JTAG方式来调试,也可通过网口用Hitool自己的监控程序(MDB)来调试。

基于ARM-LPC2210芯片的uClinux移植及应用

基于ARM-LPC2210芯片的uClinux移植及应用
e n t i p p r h e u so x e me t a e p o e h tt e meh d p o s d i h s p p ri c re ta d e e t e n i s a e .T e rs h fe p r n sh v rv d t a h t o r p e n t i a e or c n f c i . h i o s v Ke r s P 2 1 y wo d :L C 2 0;e e d d o eai n s se ;u ln x r n p a t mb d e p r t y tm o C i u ;t s ln a
Hale Waihona Puke 器上 , 不仅可 以合理 地对软 硬件 资 源进 行 调 度 , 而且 为用户 提供 方便 的应 用 接 1… .Ciu 针 对工 业 = u l x是 I n 控 制领域 , Lnx24内核 派生 出来 的嵌 入式 操 作 从 i . u
高 端 新 兴 领 域 中 网络 、 信 、 通 多媒 体 技 术 的 发 展, 以及 控制领 域应 用对数 据处 理 能力 的提 升要 求 ,
促进了 3 2位 A M7 D 系列 L C 2 0嵌入 式处 理 R T MI P 21 器 的广 泛应 用. 果将 操 作 系统 移 植 到嵌 入 式 处 理 如
As t e o e ain s se whc s d r e r m i u u ln x i u e n mirp o e s rwi o tme r n g me tu i h p r t y tm ih i e v d f o i o l x, C i u s sd o c o r c s o t u mo y ma a e n nt n h .
UClnu r d ll c me h an e b d e p r to y tm . whih i i e a te fed o n sra o to . Ho t i x ga ua y be o s te m i m e d d o e a in s se c S am d t h il f idu tl c nr 1 l w o

嵌入式Web server在uClinux上的移植

嵌入式Web server在uClinux上的移植
SC } ENC 任 & T「 CHNOLOGY INF ORMA I } ON
学 术 论 坛
嵌入式 Web ser ver 在 uC南许昌
461000 )
摘 要: 本文介绍了嵌人式 Web server 在u Clinux 上的移植技术。 关键词: 嵌人式 移植 文章编号: 1672一 3791(2007)12(b)一 0203一 02 文献标识码 : A 中图分类号 : T P 3 1 库和操作系统提供的 AP (应用程序接口)库。 I 如果是在各种嵌入式 linux(除了uClinux 以 外, 还有好几种)平台上开发, 那么针对该平台 以及l nux平台上的源代码都可以使用, l 但是要 层次结构及内核完全开放、网络功能强大、 完 牢记他们之间的差异。 整开发工具、 广泛的硬件支持、 遵循通用国际 移植应用程序的前提是有源代码, 移植的 标准、便干程序的移植等优点, 被嵌人式系统 关键工具是编译器, 源代码中和硬件平台相关 广泛应用。嵌入式 Web 服务器(Embedded 的东西越少越好(这里主 要指使用了 汇编, 或做 Web se ve , r r EWS)在现场测试和控制设备中 了针对自己平台的事) , 另一方面, 如果该程序 应用非常广泛。在通信领域的远程控制中的 是基于某个操作系统(利用了 操作系统提供的 应用, 正是由 于有了 标准的接口 形式和通信协 特殊服务, I ), 即AP 要看自己的操作系统是否 议, 内嵌于设备的We 服务器可以向任何接入 b 提供 了相关服 务。 它所在网 络的合法用户 提供统一的基于浏览器 移植时需要考虑的问题 : 方式的操作和控制界面, 浏览器成了设备的前 (1 自 ) 己的操作系统的特点以及在当前版 3 嵌入式we明反 务器 端控制板。 本下支持的特性 。 嵌人式Web 服务器(Er b edd ed w eb n 例如: u Clinux 不支持MMU, 同样就无 1 嵌入式系统 Server , EWs )是指将Web 服务器引 人到现 在相应的硬件平台和软 法支持相应的特性。 .嵌入式系统是以应用为中心、以计算机 场测试和控制设备中, (2 硬件资源。 ) 件系统的支持下, 使传统的测试和控制设备转 技术为基础、软件硬件可裁剪、适应应用系 因为嵌人式系统资源比较紧张, 硬件资源 l Web 统对功能、可靠性、成本、体积、功耗严 变为具备了以TCP/ P 为底层通信协议, 络测试和控制设 考虑必须要周全 : 格要求的专用计算机系统。嵌入式系统的核 技术为核心的基干互联网的网 a 软件存储空间的大小 心是嵌入式微处理器。嵌入式操作系统是嵌 备。 嵌人式设备只要实现We 服务器功能, b 再 这一般要等用目 标编译器重新编译完以后 人式系统的灵魂。嵌入式 L nux 正处于一个 i I t r e 所以只能大概估算, 但千万不要 方兴未艾的发展时期, 手机、 DA 、智能终 加上T CP/ P 网络协议就可以上In e n t 网。 可能才会知道, P 就认为程序 端等设备的制造商, 都把眼光瞄向了开放源码 在MCU 执行数据采集和控制功能的同时把数 看这个程序在hnux 下只有几十k , 很小, 这是因为hnux 下程序多时使用动态库, 发送到 I te net 上。在应用层, n r 嵌人 的L nu , i x 可以预见, 未来几年嵌入式L nu 的 据打包, i x 很有可能是把用到的库都 TP 发展将会迎来一个热潮。L n ux 作为一个开 式WEB服务器模块实现 H下 作为单片机系 而在嵌入式系统中, i 所以程序的尺寸会大大增加。 放源码性能优异而且代码精炼的操作系统, 在 统与In e n t 远程管理终端之间的通讯协议。 链接在一起, t r e 可将数据包发到以太网 b 程序运行空间 嵌入式系统中具有得天独厚的优越性。虽然 外加以太网控制芯片, c 硬件以及相应的驱动是否字备 通过以太网接人In e n t 。在客户端We t r e b 近年嵌入式系统的硬件条件正在不断地得到改 上, 善, 但无论如何嵌入式系统因其对于资源、 浏览器可打开嵌入式Web 服务器上网页。并 功耗以及成本等方面的敏感性 , 总会要求嵌入 通过 HTT P 的POST 方法, 把控制数据传给 5 嵌入式系统发展趋势 以信息家电为代表的互联网时代嵌入式产 式系 统能够更大程度上提高它的 性能同 时降低 We b 服务器。 对于资源的要求。 品, 不仅为 嵌人式市场展现了美好前景, 注入了 4 嵌入式Web server系统开发 新的生命;同时也对嵌人式系统技术, 特别是软 对干一个项目 的开发, 如何选择开发平台 件技术提出新的挑战。这主要包括: 支持日 2 嵌入式操作系统 随着微处理器的产生, 价格低廉、结构 (主要是指CPU 和操作系统以及开发环境和工 趋增长的功能密度、灵活的网络联接、轻便 有时这不光影响进度, 产 的移动应用和多媒体的信息处理, 小巧的CPU 和外设连接提供了稳定可靠的硬 具)应该说至关重要, 此外, 当然还 品质量, 可维护性等一般问题, 甚至涉及到方案 需对付更加激烈的市场竞争。 件架构, 那么限制嵌入式系统发展的瓶颈就突 1 、嵌入式应用软件的开发需要强大的 出表现在了 软件方面。Li nux 对厂商不偏不 的可实现性 。 1、从系统功能实现考虑: 是否有片上外 开发工具和操作系统的支持 倚而且成本极低, 能够很快成为用于各种设备 设 、价 格 、功 耗 、处理 速度 ; 随着因特网技术的成熟、带宽的提高, 的操作系统。如今, 业界已经达成共识, 即嵌 2、够的技术支持包括dem。 版及原理图, I CP 和 AS P 在网上提供的信息内容日 入式l u 是大势所趋, 大的市场潜力与酝 n l x 其巨 趋丰 像电话手机、电话 酿的无限商机必然会吸引 众多的厂商进入这一 d mo程序, e 操作系 统和BSP, 测试开发工 具等。 富、应用项目多种多样, 领域。 开发时, 宿主机完全使用的是l nux ,nux l l 座机及电冰箱、微波炉等嵌入式电子设备的 而且开发程序可以先 功能不再单一 , 电气结构也更为复杂。为了 Li ux 为嵌人操作系统提供了一个极有吸 的使用没有想象的复杂, n 然后用交叉编译工具为目 标 引力的选择, 它是个和 Un x 相似、以核心为 在宿主机上调试, i 满足应用功能的升级, 设计师们一方面采用更 可以这样做是因为宿主机 强大的嵌人式处理器如3 位、 位RI C 芯 2 4 6 S 基础的、完全内存保护、多任务多进程的操 系统重新编译一遍, 作系统。支持广泛的计算机硬件, 包括X86 , 是hnux , 标系统跑uC i ux , 目 l n 两个操作系统 片或信号处理器DSP 增强处理能力;同时还采 几乎是一样的, 所以程序 用实时多任务编程技术和交叉开发工具技术来 AIPll a ,5娜r ,MIPS ,PP C ,ARM ,NEC , 提供的应用程序接口 c 控制功能复杂性, 简化应用程序设计、保障 MOTOROLA 等现有的大部分蕊片。程式源 几乎不用修改。 程序的移植最终只针对CPU , 其实和操作 软件质量和缩短开发周期。 码全部公开, 任何人可以修改并在GNU 通用 统没什么关系, 一 面, 为代码中可能 但另 因 公共许可证( NU Ge er 1 Pu li L c s )下 系 G n a b c i e e n 2 、联网成为必然趋势 会使用一些库函 , 这些库会包括 C 语言标准 为适应应嵌入式分布处理结构和应用上网 发行, 这样, 开发人员可以对操作系统进行定

nios2移植uClinux软件架构

nios2移植uClinux软件架构

软件架构能用到的linux基本的操作有:VirtualBox 共享设置一、VirtualBox在winxp下虚拟ubuntu在winxp下虚拟ubuntu,在ubuntu下访问win的共享文件夹时出现如下错误:/sbin/mount.vboxsf: mounting failed with the error: No such device1,若要使用共享文件夹功能,必须安装linux guest additions,安装增强功能,这一步得注意不然没戏2,lsmod | grep vboxvfs,确保加载了vboxvfs模块,若没有,使用sudo modprobe vboxvfs 加载3,新建一个文件夹,sudo mkdir /home/js/dxn4,sudo mount -t vboxsf xuni /home/js/dxn 即:sudo mount -t vboxsf “共享文件夹名” “虚拟机共享文件夹目录”5,cd /home/js/dxn中途可能出现错误yacc -d grammar.ymake: yacc:命令未找到make: *** [grammar.c] 错误 127需要安装yaccinux下是用flex和bison来分别代替lex和yacc的,安装直接使用命令:sudo apt-get install bisonLinux切换root用户问题命令模式下直接用su,然后输入密码就可以了,像ubuntu如果还没有为root设置密码的话,可以用第一个用户(它默认有权使用sudo命令)来设置密码,sudo passwd root。

添加路径: export PATH=$PATH:路径名检查路径: echo $PATH桌面有光驱图标,这是加载linux系统增强工具的软件,打开:里面有个autorun.sh然后打开,在终端中运行在终端中运行,输入密码,稍等片刻。

之后出现以下界面,回车退出,工具安装完成。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

uclinux移植项目及说明4.4.移植项目及说明4.1压缩内核代码起始地址修改修改文件:uClinux-dist/linux-2.4.x/arch/armnommu/boot/Makefile 修改内容:ifeq ($(CONFIG_BOARD_MBA44),y)ZTEXTADDR = 0x0c100000ZRELADDR = 0x0c008000endif说明:ZTEXTADDR:自解压代码的起始地址。

ZRELADDR:内核解压后代码输出起始地址。

4.2处理器配置选项的修改修改文件:uClinux-dist/linux-2.4.x/arch/armnommu/config.in修改内容:define_bool CONFIG_NO_PGT_CACHE ydefine_bool CONFIG_CPU_WITH_CACHE ydefine_bool CONFIG_CPU_WITH_MCR_INSTRUCTION n- define_int CONFIG_ARM_CLK 60000000- define_bool CONFIG_SERIAL_S3C44B0X y- define_int CONFIG_FORCE_MAX_ZONEORDER 5+ define_int CONFIG_ARM_CLK 64000000 #72000000+# define_bool CONFIG_SERIAL_S3C44B0X y+# define_int CONFIG_FORCE_MAX_ZONEORDER 5if [ "$CONFIG_SET_MEM_PARAM" = "n" ]; then- define_hex DRAM_BASE 0x00000000+ define_hex DRAM_BASE 0x0C000000define_hex DRAM_SIZE 0x00800000- define_hex FLASH_MEM_BASE 0x01000000+ define_hex FLASH_MEM_BASE 0x00000000define_hex FLASH_SIZE 0x00200000fifi……说明:修改了对ARM处理器主频的定义:define_int CONFIG_ARM_CLK 64000000修改了存储器大小和起始地址的定义:define_hex DRAM_BASE 0x0C000000;SDRAM的起始地址define_hex DRAM_SIZE 0x00800000;SDRAM的大小define_hex FLASH_MEM_BASE 0x00000000;flash的起始地址define_hex FLASH_SIZE 0x00200000;flash的大小4.3内核起始地址的修改修改文件:uClinux-dist/linux-2.4.x/arch/armnommu/Makefile修改内容:ifeq ($(CONFIG_BOARD_MBA44),y)-TEXTADDR = 0x0c000000+TEXTADDR = 0x0c008000MACHINE = S3C44B0XINCDIR = $(MACHINE)-CORE_FILES := $(CORE_FILES) romfs.o+CORE_FILES := $(CORE_FILES) #romfs.oendif说明:TEXTADDR:内核的起始地址,通常取值:DRAM_BASE+0x8000。

4.4ROM文件系统的定位修改修改文件:uClinux-dist/linux-2.4.x/drivers/block/blkmem.c修改内容:+#ifdef CONFIG_BOARD_MBA44+ {0, 0xc700000, -1},/*{0, 0x100000, -1},*/#endif说明:将ROM file system在SDRAM中的地址定位在0xc700000。

4.5修改存储空间配置修改文件:uClinux-dist/linux-2.4.x/include/asm-armnommu/arch-S3C44B0X/memory.h 修改内容:-#define PHYS_OFFSET (DRAM_BASE + 2*1024*1024)+#define PHYS_OFFSET (DRAM_BASE)//(DRAM_BASE + 2*1024*1024)#define PAGE_OFFSET (PHYS_OFFSET)-#define END_MEM (DRAM_BASE + DRAM_SIZE - 2*1024*1024)+#define END_MEM (DRAM_BASE+DRAM_SIZE)//(DRAM_BASE +DRAM_SIZE - 2*1024*1024)说明:PHYS_OFFSET:RAM第一个bank的起始地址。

4.6初始化节拍定时器修改文件:uClinux-dist/linux-2.4.x/include/asm-armnommu/arch-S3C44B0X/time.h修改内容:-extern void s3c44b0x_timer_interrupt(int irq, void *dev_id, struct pt_regs*regs);+//extern void s3c44b0x_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs);+static inline void s3c44b0x_timer_interrupt(int irq, void *dev_id, structpt_regs *regs)+{+ do_leds();+ do_timer(regs);+}//modified by hzh/* TODO: THE, 2003-08-13, do timer setup like in eCos */-#define S3C44B0X_TIMER5_PRESCALER 16+#define S3C44B0X_TIMER5_PRESCALER 32extern __inline__ void setup_timer (void){u_int32_t tmod;u_int32_t period;+ __u32 rw_tmp;period = (CONFIG_ARM_CLK/S3C44B0X_TIMER5_PRESCALER)/HZ;outl(period, S3C44B0X_TCNTB5);@@ -36,8 +42,14 @@outl(tmod, S3C44B0X_TCON);/* initialize the timer period and prescaler */- outl((5-1) << 16, S3C44B0X_TCFG0);- outl( (0x3 <<20), S3C44B0X_TCFG1); /* prescaler */+ rw_tmp = inl(S3C44B0X_TCFG0);+ rw_tmp &= ~(0xff<<16);+ rw_tmp |= (16-1)<<16;+ outl(rw_tmp, S3C44B0X_TCFG0); // prescaler = 1/16+ rw_tmp = inl(S3C44B0X_TCFG1);+ rw_tmp &= ~(0xf<<20);+ rw_tmp |= 0<<20;+ outl(rw_tmp, S3C44B0X_TCFG1); // mux = 1/2说明:这里,uClinux使用了S3C44B0X的内部定时器5,并利用定时器5的中断来产生节拍。

4.7定义二级异常中断矢量表的起始地址修改文件:uClinux-dist/linux-2.4.x/include/asm-armnommu/proc/system.h 修改内容:+#ifdef CONFIG_BOARD_MBA44+#undef vectors_base()+#define vectors_base() (DRAM_BASE)+#endif说明:vectors_base()定义了二级异常中断矢量表的起始地址,这个地址与Bootloader 中的_IRQ_BASEADDRESS相对应。

4.8定义CPU体系结构和交叉编译器修改文件:uClinux-dist/linux-2.4.x/Makefile修改内容:-# ARCH := armnommu+ARCH := armnommu# ARCH := m68knommu# ARCH := h8300# ARCH := niosnommu……HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer# CROSS_COMPILE = m68k-elf--# CROSS_COMPILE = arm-elf-+CROSS_COMPILE = arm-elf-# CROSS_COMPILE = h8300-elf-# CROSS_COMPILE = nios-elf-# CROSS_COMPILE = e1-coff-说明:这里定义了CPU体系结构:ARCH := armnommu和对应的交叉编译器名称:CROSS_COMPILE = arm-elf-。

4.9以太网卡寄存器地址的偏移量修改这里针对ARMSYS的硬件结构,要做两处特殊的修改:修改文件:uClinux-dist/linux-2.4.x/driver/net/8390.h修改内容:#define ETH_ADDR_SFT 8说明:访问RTL8019内部寄存器地址的偏移量。

4.10以太网设备基地址修改修改文件:uClinux-dist/linux-2.4.x/driver/net/ne.c修改内容:dev->base_addr = base_addr = 0x08000000;说明:修改了以太网设备的基地址。

5.移植的步骤5.1解压uClinux-dist发行包到以下地址下载uClinux-dist-20040408.tar.gz源代码包:/pub/uClinux/dist/uClinux-dist-20040408.tar.gz该版本在很多方面比早先的20030522版本要完善很多,这也使我们的移植工作变得方便很多。

其中使用的内核版本是Linux 2.4.24。

以下工作在装有Linux操作系统(例如RedHat9.0)的PC机上进行。

相关文档
最新文档