在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<abbr id="27omo"></abbr>

<menu id="27omo"><dl id="27omo"></dl></menu>
    • <label id="27omo"><tt id="27omo"></tt></label>

      新聞中心

      EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 基于uClinux內核移植ARM開發(fā)板應用

      基于uClinux內核移植ARM開發(fā)板應用

      作者: 時間:2011-12-05 來源:網(wǎng)絡 收藏

      3.項目及說明

      3.1壓縮代碼起始地址修改

      修改文件:-dist/linux-2.4.x/arch/armnommu/boot/Makefile

      修改內容:

      ifeq

      ($(CONFIG_BOARD_MBA44),y)

      ZTEXTADDR = 0x0c100000

      ZRELADDR =

      0x0c008000

      endif

      說明:

      ZTEXTADDR:自解壓代碼的起始地址。

      ZRELADDR:解壓后代碼輸出起始地址。

      3.2處理器配置選項的修改

      修改文件:-dist/linux-2.4.x/arch/armnommu/config.in

      修改內容:

      define_bool

      CONFIG_NO_PGT_CACHE y

      define_bool CONFIG_CPU_WITH_CACHE y

      define_bool

      CONFIG_CPU_WITH_MCR_INSTRUCTION n

      - define_int CONFIG__CLK 60000000

      -

      define_bool CONFIG_SERIAL_S3C44B0X y

      - define_int CONFIG_FORCE_MAX_ZONEORDER

      5

      + define_int CONFIG__CLK 64000000 #72000000

      +# define_bool

      CONFIG_SERIAL_S3C44B0X y

      +# define_int CONFIG_FORCE_MAX_ZONEORDER 5

      if [

      $CONFIG_SET_MEM_PARAM = n ]; then

      - define_hex DRAM_BASE 0x00000000

      +

      define_hex DRAM_BASE 0x0C000000

      define_hex DRAM_SIZE 0x00800000

      -

      define_hex FLASH_MEM_BASE 0x01000000

      + define_hex FLASH_MEM_BASE

      0x00000000

      define_hex FLASH_SIZE

      0x00200000

      fi

      fi

      ……

      說明:

      修改了對處理器主頻的定義:

      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的大小

      3.3起始地址的修改

      修改文件:-dist/linux-2.4.x/arch/armnommu/Makefile

      修改內容:

      ifeq

      ($(CONFIG_BOARD_MBA44),y)

      -TEXTADDR = 0x0c000000

      +TEXTADDR =

      0x0c008000

      MACHINE = S3C44B0X

      INCDIR = $(MACHINE)

      -CORE_FILES :=

      $(CORE_FILES) romfs.o

      +CORE_FILES := $(CORE_FILES)

      #romfs.o

      endif

      說明:

      TEXTADDR:內核的起始地址,通常取值:DRAM_BASE+0x8000。

      3.4ROM文件系統(tǒng)的定位修改

      修改文件: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。

      3.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的起始地址。

      3.6初始化節(jié)拍定時器

      修改文件: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, struct pt_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 32

      extern __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 = ~(0xff16);

      +

      rw_tmp |= (16-1)16;

      + outl(rw_tmp, S3C44B0X_TCFG0); // prescaler =

      1/16

      + rw_tmp = inl(S3C44B0X_TCFG1);

      + rw_tmp =

      ~(0xf20);

      + rw_tmp |= 020;

      + outl(rw_tmp, S3C44B0X_TCFG1);

      // mux = 1/2

      說明:這里,uClinux使用了S3C44B0X的內部定時器5,并利用定時器5的中斷來產生節(jié)拍。

      3.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相對應。

      3.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-。

      3.9以太網(wǎng)卡寄存器地址的偏移量修改

      這里針對ARMSYS的硬件結構,要做兩處特殊的修改:

      修改文件:uClinux-dist/linux-2.4.x/driver/net/8390.h

      修改內容:#define

      ETH_ADDR_SFT 8

      說明:訪問RTL8019內部寄存器地址的偏移量。

      3.10以太網(wǎng)設備基地址修改

      修改文件:uClinux-dist/linux-2.4.x/driver/net/ne.c

      修改內容:dev->base_addr =

      base_addr = 0x08000000;

      說明:修改了以太網(wǎng)設備的基地址。

      4.的步驟

      4.1解壓uClinux-dist發(fā)行包

      到以下地址下載uClinux-dist-20040408.tar.gz源代碼包:

      http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20040408.tar.gz

      該版本在很多方面比早先的20030522版本要完善很多,這也使我們的工作變得方便很多。其中使用的內核版本是Linux

      2.4.24。

      以下工作在裝有Linux操作系統(tǒng)(例如RedHat9.0)的PC機上進行。

      將uClinux-dist-20040408.tar.gz拷貝到/home/下(或者其它目錄都可以),運行解壓命令:

      tar xvzf uClinux-ARMSYS-20040801.tar.gz

      解壓結束后會在/home/下生成uClinux-dist目錄。

      4.2安裝補丁

      到以下地址下載補丁文件:

      http://www.hzlitai.com.cn/download/uClinux-20040408-ARMSYS.rar

      解壓后產生patch文件,安裝patch文件:

      patch –p1 uClinux-20040408-ARMSYS.patch

      安裝過程中可能會出現(xiàn)一些錯誤信息,可以手動地按照patch文件的內容在指定的文件處進行修改一下。

      5.配置與編譯

      5.1安裝編譯環(huán)境

      到以下地址下載arm-elf工具鏈:

      http://www.uclinux.org/pub/uClinux/m68k-elf-tools/arm-elf-tools-20030314.sh

      將arm-elf-tools-20030314.sh拷貝到根目錄,運行安裝:

      sh arm-elf-tools-20030314.sh

      5.2內核配置

      下面就可以開始配置uClinux的內核和用戶選項了。打開終端。

      # cd /home/uClinux-dist

      # make

      menuconfig

      進入uClinux配置(uClinux v3.1.0 Configuration),選中“Kernel/Library/Defaults

      Selectionà”敲空格進入。其中有兩個選項:定制內核設置和定制用戶選項設置:

      [*] Customize Kernel Settings

      [

      ] Customize Vendor/User Settings

      選中定制內核設置選項,按下ESC鍵退出,在詢問是否保存時,選擇Yes并回車。

      終端將首先進入內核配置選單。我們在配置uClinux內核時,就可以通過對這些選項的選擇和取消選擇來設定內核所具有的功能項。這也是裁減uClinux內核的基本方法。

      每個選項都對應著一個宏定義,make

      menuconfig執(zhí)行結束后,自動將配置結果保存為.config文件,將前一次的配置結果備份為.config.old文件。

      讀者可到http://www.hzlitai.com.cn/download/linux/8019/kernelconfig_eth

      處下載內核配置文件(其中包括對網(wǎng)卡驅動的配置),讀者可對照進行配置。

      5.3交叉編譯

      按下面的步驟對uClinux源碼包進行編譯:

      # make dep

      # make clean (非必要)

      # make

      lib_only

      # make user_only

      # make romfs

      # make image

      #

      make

      初次移植時,在make

      lib_only到make這5步編譯過程中很可能產生錯誤,無法繼續(xù)下去。如果產生了錯誤,可以嘗試根據(jù)報告的錯誤內容修改一下源程序,這一過程將有助于你熟悉uClinux內核源程序的結構,或者可以跟我們聯(lián)系

      [email protected]

      。

      交叉編譯成功后,在 uClinux-dist/目錄下產生images目錄,其中包含的3個文件:image.ram,

      image.rom和romfs.img就是我們可以使用的二進制文件。參考《uClinux的移植包在ARMSYS上的使用說明》的方法,下載或燒錄這些二進制文件,并啟動運行uClinux。

      6.啟動信息

      正確啟動信息的例子如下:

      Linux version 2.4.24-uc0 (root@localhost) (gcc

      version 2.95.3 20010315

      (release)(ColdFire patches - 20010318 from http://fiddes

      .net/coldfire/)(uClinux XIP and shared

      lib patches from http://www.snapgear.com/

      )) #165 五 10月 8

      20:04:10 CST 2004

      Processor: Samsung S3C44B0X revision 0

      Architecture:

      S3C44B0X

      On node 0 totalpages: 2048

      zone(0): 0 pages.

      zone(1): 2048

      pages.

      zone(2): 0 pages.

      Kernel command line: root=/dev/rom0

      init=/linuxrc

      Calibrating delay loop... 31.84 BogoMIPS

      Memory: 8MB = 8MB

      total

      Memory: 6592KB available (1270K code, 155K data, 40K init)

      Dentry

      cache hash table entries: 1024 (order: 1, 8192 bytes)

      Inode cache hash table

      entries: 512 (order: 0, 4096 bytes)

      Mount cache hash table entries: 512

      (order: 0, 4096 bytes)

      Buffer cache hash table entries: 1024 (order: 0, 4096

      bytes)

      Page-cache hash table entries: 2048 (order: 1, 8192 bytes)

      POSIX

      conformance testing by UNIFIX

      Linux NET4.0 for Linux 2.4

      Based upon

      Swansea University Computer Society NET3.039

      Initializing RT netlink

      socket

      Starting kswapd

      ttyS0 at I/O 0x1d00000 (irq = 3) is a

      S3C44B0

      ttyS1 at I/O 0x1d04000 (irq = 2) is a S3C44B0

      ne.c:v1.10 9/23/94

      Donald Becker ([email protected])

      Last

      modified Nov 1, 2000 by Paul Gortmaker

      NE*000 ethercard probe at 0x8000000:

      00 00 e8 12 34 56

      eth0: NE1000 found at 0x8000000, using IRQ 22

      Blkmem

      copyright 1998,1999 D. Jeff Dionne

      Blkmem copyright 1998 Kenneth

      Albanowski

      Blkmem 1 disk images:

      0: C400000-C47CBFF [VIRTUAL

      C400000-C47CBFF] (RO)

      RAMDISK driver initialized: 16 RAM disks of 1024K size

      1024 blocksize

      NET4: Linux TCP/IP 1.0 for NET4.0

      IP Protocols: IC

      IP:

      routing cache hash table of 512 buckets, 4Kbytes

      TCP: Hash tables configured

      (established 512 bind 512)

      VFS: Mounted root (romfs filesystem)

      readonly.

      Freeing init memory: 40K

      Shell invoked to run file:

      /etc/rc

      Command: hostname Samsung

      Command: /bin/expand /etc/ramfs.img

      /dev/ram0

      Command: mount -t proc proc /proc

      Command: mount -t ext2

      /dev/ram0 /var

      Command: mkdir /var/config

      Command: mkdir

      /var/tmp

      Command: mkdir /var/log

      Command: mkdir /var/run

      Command: mkdir

      /var/lock

      Command: cat /etc/motd

      Welcome to

      ____ _ _

      / __| ||_|

      _

      _| | | | _ ____ _ _ _ _

      | | | | | | || | _ | | | | / /

      | |_| | |__| ||

      | | | | |_| |/

      | _______|_||_|_| |_|____|_/_/

      | |

      |_|

      For further information check:

      http://www.uclinux.org/

      Command: ifconfig lo 127.0.0.1

      Command: route add -net 127.0.0.0 netmask

      255.255.255.0 lo

      Command: ifconfig eth0 192.168.253.2 netmask 255.255.255.0

      up

      Execution Finished, Exiting

      Sash command shell (version

      1.1.1)

      />

      出現(xiàn)以上信息后,可以嘗試從鍵盤輸入ls、ping命令,來查看系統(tǒng)的運行情況。我們還建議讀者按照uClinux-dist

      Documentation下的Adding-User-Apps-HOWTO文檔編寫一個簡單的Helloworld程序,看是否能夠正確運行。


      上一頁 1 2 下一頁

      評論


      相關推薦

      技術專區(qū)

      關閉