



全文預(yù)覽已結(jié)束
下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
重定向linux輸出信息(linux2.6)在運行l(wèi)inux的時候有所有的調(diào)試信息可以分為三個部分1、 bootloader輸出信息U-Boot (Nov 19 2016 - 22:02:08)DRAM: 64 MBFlash: 512 kBNAND: 64 MiBIn: serialOut: serialErr: serialHit any key to stop autoboot: 0 yqliu2410 # tftpFound DM9000 ID:46 at address 10000000 !DM9000 work in 16 bus widthbd-bi_entaddr: 08:00:3e:26:5beth_initMAC:8:0:3e:26:a:5b:TFTP from server 52; our IP address is 55Filename uImage.Load address: 0x30008000Loading: T T T T # #doneBytes transferred = 1617316 (18ada4 hex)up-tech2410 # bootm# Booting image at 30008000 . Image Name: Linux-.4 Created: 2016-11-19 14:05:29 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1617252 Bytes = 1.5 MB Load Address: 30008000 Entry Point: 30008040 Verifying Checksum . OKStarting kernel .2、 linux低級調(diào)試信息輸出Uncompressing Linux. done, booting the kernel.3、 linux調(diào)試信息輸出Linux version .4 (rootvm-dev) (gcc version 3.4.6) #100 Sat Nov 19 07:47:35 CST 2016CPU: ARM920T 41129200 revision 0 (ARMv4T), cr=00007177Machine: SMDK2410Memory policy: ECC disabled, Data cache writebackCPU S (id 0x32410002)S2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHzS24XX Clocks, (c) 2004 Simtec ElectronicsCLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL onCPU0: D VIVT write-back cacheCPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 setsCPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 setsBuilt 1 zonelists in Zone order, mobility grouping on. Total pages: 16256Kernel command line: root=/dev/mtdblock2 noinitrd console=ttySAC1,115200irq: clearing subpending status 00000010PID hash table entries: 256 (order: 8, 1024 bytes)timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001eConsole: colour dummy device 80x30console ttySAC1 enabledDentry cache hash table entries: 8192 (order: 3, 32768 bytes)Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)Memory: 64MB = 64MB totalMemory: 61488KB available (2936K code, 305K data, 132K init)Mount-cache hash table entries: 512CPU: Testing write buffer coherency: ok.現(xiàn)在要將所有的調(diào)試信息輸出到別的串口。以com1為例(從com0開始計算)!一、將bootloader的輸出信息輸出到com1這里以u-boot為例:很簡單只需要修改一個宏定義就okVi inlcude/configs/xxxconfig.h(xxx為你定義的開發(fā)板的名字)更改原有的宏/* select serial console configuration*/#define CONFIG_SERIAL1 1 /* we use SERIAL 1 on SMDK2410 */modify for xxx2410/by lyj_uptech#define CONFIG_SERIAL2 1 /* we use SERIAL 2 on SMDK2410 */更改完之后就可以看到u-boot的調(diào)試信息輸出到com1,這一步很簡單。二、將low_level 的調(diào)試信息輸出到com1在改之前我們先分析一下在linux啟動之前它是如何使用串口的。1、 在arch/arm/boot/compressed/misc.c文件中有定義static void putstr(const char *ptr) char c; while (c = *ptr+) != 0) if (c = n) putc(r); putc(c); flush();2、 arch/arm/boot/compressed/misc.中的函數(shù)decompress_kernel就是使用的putstr來打印的如下輸出信息:Uncompressing Linux. done, booting the kernel.3、 追根溯源,putstr函數(shù)最終調(diào)用的是putc(請注意這里的putc不是在misc.c函數(shù)中定義的icedcc_putc,因為沒有CONFIG_CPU_V6宏定義),真正的底層操作在文件include/asm-arm/plat-s3c/uncompress.h4、 解析該文件/* we can deal with the case the UARTs are being run* in FIFO mode, so that we dont hold up our execution* waiting for tx to happen.*/static void putc(int ch) if (uart_rd(S2410_UFCON) & S2410_UFCON_FIFOMODE) int level; while (1) level = uart_rd(S2410_UFSTAT); level &= fifo_mask; if (level fifo_max) break; else /* not using fifos */ while (uart_rd(S2410_UTRSTAT) & S2410_UTRSTAT_TXE) != S2410_UTRSTAT_TXE) barrier(); /* write byte to transmission register */ uart_wr(S2410_UTXH, ch);該函數(shù)中調(diào)用的兩個函數(shù),uart_rd uart_wr在同一個文件中定義#define uart_base S24XX_PA_UART + (0x4000*CONFIG_S_LOWLEVEL_UART_PORT)static _inline_ voiduart_wr(unsigned int reg, unsigned int val) volatile unsigned int *ptr; ptr = (volatile unsigned int *)(reg + uart_base); *ptr = val;static _inline_ unsigned intuart_rd(unsigned int reg) volatile unsigned int *ptr; ptr = (volatile unsigned int *)(reg + uart_base); return *ptr;從宏定義uart_base中就可以清楚的看到,當CONFIG_S3C_LOWLEVEL_UART_PORT為0時,uart_base的值為0x50000000,也就是uart0的控制寄存器基地址。如果要使用uart1的話就把CONFIG_S3C_LOWLEVEL_UART_PORT賦值為1就可以了。5、 正真更改的地方只有一個下級目錄修改為1就ok!6、 需要注意的地方(你使用的串口初始化了么)我在整個內(nèi)核中找遍了解壓內(nèi)核之前運行的代碼,都找不到關(guān)于串口初始化的代碼。所以說,linux在啟動之前的串口初始化是依賴bootloader的,要想正常的輸出,就必須使用你的bootloader使用的串口,因為在bootloader中進行了對要使用的串口進行了初始化。要保證你的bootloader兼容性很好,那就在bootloader中把所有的串口都初始化一遍。如果你沒有初始化串口,一旦調(diào)用putstr,程序就死掉了!三、將linux的信息輸出到com1將linux運行的信息輸出到com1就太簡單了,直接到bootloader里面改linux的傳遞參數(shù)就可以了。setenv bootargs root=/dev/mtdblock2 noinitrd console=ttySAC1,115200saveenv現(xiàn)在啟動一切ok!感謝yqliu的支持,沒有他的調(diào)試程序,我始終的無法知道linux的內(nèi)核是否正確調(diào)用
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 廁所打掃勞務(wù)合同范本
- 合同范本 固定期限
- 個人拒簽合同范本
- 平面車位租賃合同范本
- 合伙店合作合同范本
- 單位出讓房屋合同范本
- 合伙門窗店合同范本
- 單位欠款合同范本
- 企業(yè)eap合同范本
- 印刷耗材采購合同范本
- EMS能源管理系統(tǒng)V1.4.0用戶需求說明書V1.0-20160916
- 《工業(yè)機器人現(xiàn)場編程》課件-任務(wù)3.1 涂膠機器人工作站工程現(xiàn)場
- 金屬非金屬礦山安全生產(chǎn)法規(guī)
- 音樂節(jié)組織與執(zhí)行流程指南
- 身心活化健康評估老年康體指導初級
- 2024-2030年中國琥珀酸二辛酯磺酸鈉產(chǎn)業(yè)未來發(fā)展趨勢及投資策略分析報告
- 2024年駕照新規(guī)理論考試C1理論考試試題題庫及答案(共500題)
- 硬筆書法紙(打直接打印)
- 陳銀子礦山基建施工組織方案方案
- 襄陽房地產(chǎn)市場月報2024年08月
- 工業(yè)互聯(lián)網(wǎng)平臺的架構(gòu)與功能
評論
0/150
提交評論