ARM-Linux驅動移植--RTC(實時時鐘)移植

2021-01-11 電子產品世界

硬體平臺:FL2440

本文引用地址:http://www.eepw.com.cn/article/201611/318866.htm

內核版本:2.6.28

主機平臺:Ubuntu 11.04

內核版本:2.6.39

首先修改內核源碼/arch/arm/mach-s3c2410/mach-smdk2410.c

添加紅色字體部分

staticstructplatform_device*smdk2410_devices[]__initdata={&s3c_device_usb,&s3c_device_lcd,&s3c_device_wdt,&s3c_device_i2c,&s3c_device_iis,&s3c_device_sdi,&s3c_device_dm9000,&s3c_device_ts,&s3c_device_rtc,};
make zImage重新編譯內核,然後燒寫內核(編譯內核前,make menuconfig時選擇rtc相關的驅動,如下圖)

燒寫完成後啟動開發板,啟動信息如下:

++
| FL2440 Bootloader VER-5.1 Modified By Yan Ming! |
||
||
|CPU ID is 0x32440001 |
|FCLK=400MHz,HCLK=100MHz,PCLK=50MHz, CPU is running at 400MHz|
|UPLL=96MHz, UCLK=48MHz |
|Serial port 0, Baud rate is 115200. |
|OS image stored in NAND Flash. |
|Autoboot delay is 2 seconds. |
++
Set boot params = root=/dev/mtdblock3 init=/linuxrc load_ramdisk=0 console=ttyS
Load Kernel...
Uncompressing Linux.............................................................
Linux version 2.6.28.7 (yan@yan-laptop) (gcc version 3.4.1) #343 Sun Jul 3 19:11
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: SMDK2410
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
MM: CPU does not support supersection mapping for 0x55000000000 at 0xf0d00000
S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/mtdblock3 init=/linuxrc load_ramdisk=0 console=t
irq: clearing pending ext status 00080000
irq: clearing subpending status 00000092
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500d00, tcnt a2c1, tcfg 0000020f,00000030, usec 00001eb8
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 61120KB available (3288K code, 312K data, 144K init)
Calibrating delay loop... 199.47 BogoMIPS (lpj=498688)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 288 bytes
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (extended precision)
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) (SUMMARY) 2001-2006 Red Hat, Inc.
yaffs Jul 3 2011 19:14:41 Installing.
msgmni has been set to 119
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 40x30
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver4 ports, IRQ sharing enabled
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
dm9000 Ethernet Driver, V1.31
eth0: dm9000a at c487a300,c487e304 IRQ 51 MAC: 00:12:34:56:80:49 (chip)
Uniform Multi-Platform E-IDE driver
ide-gd driver 1.18
ide-cd driver 5.00
Driver sd needs updating - please use bus_type methods
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns
NAND device: Manufacturer ID: 0xad, Chip ID: 0xda (Hynix NAND 256MiB 3,3V 8-bit)
NAND_ECC_NONE selected by board driver. This is not recommended !!
Scanning device for bad blocks
Bad eraseblock 1771 at 0x0dd60000
Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x00000000-0x00100000 : "Boot"
0x00140000-0x00500000 : "MyApp"
0x00500000-0x00800000 : "Kernel"
0x00800000-0x0f800000 : "fs_yaffs"
usbmon: debugfs is not available
ohci_hcd: USB 1.1 Open Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usbcore: registered new interface driver libusual
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.4.3:USB FTDI Serial Converters Driver
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
s3c2440-sdi s3c2440-sdi: host detect has no irq available
mapped channel 0 to 0
s3c2440-sdi s3c2440-sdi: powered down.
s3c2440-sdi s3c2440-sdi: initialisation done.
s3c2440-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).
s3c2440-sdi s3c2440-sdi: running at 196kHz (requested: 195kHz).
s3c2440-sdi s3c2440-sdi: running at 196kHz (requested: 195kHz).
s3c2440-sdi s3c2440-sdi: running at 196kHz (requested: 195kHz).
s3c2440-sdi s3c2440-sdi: powered down.
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
mapped channel 10 to 2
mapped channel 9 to 1
UDA1341 audio driver initialized
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
s3c2410-rtc s3c2410-rtc: setting system clock to 2011-07-04 20:15:05 UTC (13098)
yaffs: dev is 32505859 name is "mtdblock3"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.3, "mtdblock3"
yaffs: auto selecting yaffs2
yaffs: restored from checkpoint
yaffs_read_super: isCheckpointed 1
VFS: Mounted root (yaffs filesystem).
Freeing init memory: 144K
usb 1-1: new full speed USB device using s3c2410-ohci and address 2
usb 1-1: configuration #1 chosen from 1 choice
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
Mounting /proc,/sys,/dev......
Starting mdev......
init started: BusyBox v1.9.2 (2011-06-13 18:52:29 CST)
starting pid 900, tty : /etc/init.d/rcS
dm9000 dm9000.0: WARNING: no IRQ resource flags set.
eth0: link down

Please press Enter to activate this console. eth0: link up, 100Mbps, full-duple1

後色部分顯示RTC工作正常。

使用命令

date 命令修改系統時間後,執行hwclock -w,保存到硬體的實時時鐘

每次開機執行hkclock -s,這樣每次開機後,系統從硬體讀取時間信息,保存到系統。

相關焦點

  • linux內核移植-移植2.6.35.4內核到s3c2440
    硬體平臺:FL2440主機平臺:Ubuntu 11.04交叉編譯器:arm-linux-gcc 4.3.2原創作品,轉載請標明出處http://blog.csdn.net/yming0221/article/details/6604616本來是想移植最新的內核2.6.39但是總是在編譯快完成的時候報錯
  • ARM在嵌入式linux內核裁剪與移植的應用
    文章以將linux移植到ARM920T內核的s3c2410處理器晶片為例,介紹了嵌入式linux內核的裁剪以及移植過程,文中介紹的基本原理與方法技巧也可用於其它晶片。2 內核移植過程2.1 建立交叉編譯環境在一種計算機環境中運行的編譯程序,能編譯出在另外一種環境下運行的代碼,我們就稱這種編譯器支持交叉編譯。這個編譯過程就叫交叉編譯。
  • USB無線網卡的Linux驅動移植
    也就是說,整個移植過程要求USB無線網卡驅動必須是Realtek 8188SU,且工作環境是Linux2.6.12.7。Realtek公司對8188SU主晶片驅動提供的建議是PC機Fedora Linux 2.6.24測試通過。經測試,若直接將驅動使用Linux 2.6.12.7內核編譯,將出現大量錯誤。如何將驅動移植到Linux 2.6.12.7還需要進一步研究。
  • 移植SSH到ARM Linux開發板成功
    在移植到友善2440的時候很容易,因為他4.3.2交叉編譯器等庫文件做等好。但是在移植到天漠devkit8000時,遇到非常多的問題。一個月之前遇到問題沒有找到-lgcc_s的問題一直沒有解決,以致後來非常影響開發進度。
  • 詳解USB無線網卡的Linux驅動移植
    1 移植要求移植目標是在原有ARM監測系統的基礎上實現USB無線網卡功能擴展,為系統提供數據遠程無線採集方案。原ARM監測系統是在優龍YLE2440開發板上開發的,其Linux內核版本為2.6.12.7。
  • 淺談分析Arm linux 內核移植及系統初始化的過程二
    If yes, let it do all* the work //啟動用戶空間的init進程9、淺談分析Arm linux 內核移植及系統初始化的過程 諮詢QQ:313807838 */if (!調用驅動初始化函數初始化子系統。
  • tmux在ARM上的移植
    在Linux PC機上我們可以使用GNU Screen對終端進行復用,不過GNU Screen移植到ARM還是比較困難的。而且還有比GNU Screen更好的終端復用器,就是我們今天要用到的tmux. 我選擇移植的版本是tmux-1.2,從tmux-1.2開始,它依賴於libevent包,當然,它還依賴於ncurses.ncurses我之前都已經移植好了的,這裡就不說了。一.libevent的交叉編譯1.配置.
  • uboot在2440上的移植
    因此不可能有通用的Bootloard,開發時應根據具體的配置進行移植。 為什麼我們要用U-BOOT?顯然可以將作業系統直接燒入flash中執行,但從軟體的升級和程序修補來說則是不可少的。>的開發、使用文檔5. drivers:uboot支持的設備驅動程序,比如串口,nandflash,網卡6. fs: 支持的文件系統,Uboot現在支持cramfs、fat、fdos、jffs2和registerfs。
  • 嵌入式Linux移植實時設備驅動程序
    在嵌入式程序的密集I/O空間中,同樣重要的是,將RTOS的應用硬體接口代碼向具有更加規範化模式的Linux設備啟動程序的移植。本文將縱覽幾種常用的內存映射I/O方法,它們經常出現於舊的嵌入式應用中。它們涵蓋的範圍,包括從對中斷服務例程的特殊使用和用戶線程對硬體訪問,到出現於有些ROTS中的半規範化驅動程序模型。
  • ZYNQ Linux作業系統移植四個部分說明文檔
    > ZYNQ上面移植Linux作業系統包括四個部分,uboot,devicetree,kernel,ramdisk.(這個根據硬體在sdk中創建),然後執行uboot,uboot會將kernel、devicetree和ramdisk載入ddr,跳轉到內核入口處執行,這樣linux就啟動了。
  • net-snmp移植到arm
    關於net-snmp的移植,是基於靜態編譯的,動態的沒有做成功,在arm上的移植過程大致如下:如果沒有涉及到擴展agent,則藍色字體不需要理會。tar -xzvf net-snmp-5.4.1.tar.gz,若想擴展agent,則可以將此模塊的.c和.h文件先放到net-snmp-5.4.4/agent/mibgroup下一起配置編譯;例如我這裡想用代理讀寫encoder模塊,那麼先將寫好的encoder源文件複製到net-snmp-5.4.4/agent/mibgroup路徑下;2.CC=arm-linux-gcc
  • 調試lcd時候給linux單板移植tslib
    Tslib是一個開源的程序,能夠為觸控螢幕驅動獲得的採樣提供諸如濾波、去抖、校準等功能,通常作為觸控螢幕驅動的適配層,為上層的應用提供了一個統一的接口。下面介紹就是執行的大致過程1.克隆編譯原始碼2.將編譯好的文件添加到linux根文件系統3.執行裝載LCD相關驅動到單板,再給tslib設置好環境變量,執行tslib
  • 飛凌乾貨丨OK-xx18 Android實時時鐘框架介紹
    RTC(Real-TimeClock)實時時鐘為作業系統提供了一個可靠的時間,並且在斷電的情況下,RTC實時時鐘也可以通過電池供電,一直運行下去。本文以OK-4418-C為例,介紹在Android實時時鐘框架。
  • python移植到arm平臺
    交叉編譯Python  見Cross Compiling Python for Embedded Linux本文引用地址:http://www.eepw.com.cn/article/201611/317666.htmCC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar RANLIB=
  • LOG4C移植到ARM平臺流程
    Log4c基本上都是一些純c的東西,在平臺移植方面,比前二者有優勢。二、開發環境作業系統:Ubuntu 10.4(linux kernel-v2.6.31)移植Linux內核版本:2.6.30交叉編譯工具:arm-linux-gcc 4.3.2三、下載LOG4C及EXPAT工具原始碼LOG4C原始碼的下載地址:http://nchc.dl.sourceforge.net
  • 「正點原子FPGA連載」第十八章Linux內核移植
    需要說明的是當我們使用Petalinux工具的時候是不需要移植內核的,因為Petalinux工具可以根據硬體描述文件hdf使能相應配置。本章講解內核移植(更準確的說是內核適配)是為了了解一般情況下(不使用Petalinux)的內核移植過程。通過本章的學習,我們將掌握如何將半導體廠商提供的Linux BSP包移植到我們自己的平臺上。
  • 移植strace調試工具到arm平臺
    要移植到arm平臺,就需要使用交叉編譯工具編譯生成靜態連結的可執行文件。具體步驟如下:1.下載 strace-4.5.16移植strace調試工具到arm平臺 由Linux系統中文網(Linux521.com)編輯收集整理,除Linux521註明原創文章外,其版權歸原作者所有。如果您在學習中遇到問題歡迎在下面的評論中留言,我們會盡全力解答您的問題。
  • sqlite的移植
    /2.95.3/arm-linux/bin:$PATH/configure --disable-tcl --prefix=/home/sqlite-arm-linux/ --host=arm-linux 生成了Makefile文件,這些將在make時用到.
  • OpenCV ffmpeg移植到ARM平臺
    前一篇寫了如何在移植OpenCV庫到ARM平臺上,本來我只是用到OpenCV的打開USB攝像頭獲取圖像到IplImage結構中,這用到了V4L2的底層函數。然後進行視頻圖像的幀處理。那麼如何用OpenCV讀寫ARM板上的視頻文件,並進行視頻處理呢?這該又將如何移植呢?
  • uboot移植初步成功啦
    先說說移植吧,代碼上的移植:只是基於代碼的改動,而不包括知道代碼改動的背後~~ 移植的uboot版本為1.4版,用的編譯工具鏈為arm-elf-。不能用arm-linux編譯,原因是用的c庫不同。簡單的說就是arm-linux是為有MMU硬體單元的處理器配置的,如ARM9器件,而arm-elf-則是用於無MMU的cpu的,如ARM7。(也試了一下,用arm-linux-編譯得到的uboot.bin加載到SDRAM中運行後無顯示)。arm-elf-gcc版本為2.93版本的(有點低,還需要修改cpus3c44b0config.mk,後面提到)。