Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> msm8909+android5.1.1--打開調試(debug)串口

msm8909+android5.1.1--打開調試(debug)串口

編輯:關於Android編程

msm8909+android5.1.1--打開調試(debug)串口

1.共同修改的地方

(1)kernel\arch\arm\configs\msm8909-1gb-CB03_defconfig

使以下項有效

CONFIG_SERIAL_MSM_HSL=y

CONFIG_SERIAL_MSM_HSL_CONSOLE=y

 

增加以下項

CONFIG_DEBUG_LL=y

CONFIG_EARLY_PRINTK=y

 

(2)Root/bootable/bootloader/lk/project/msms8909.mk

確保DEFINES += WITH_DEBUG_UART=1

 

2.V1.0主板

\

圖1

UART1_TX-------GPIO_4

UART1_RX-------GPIO_5

 

(3)device\qcom\sepolicy\common\file_contexts----需要make –j4才生效

使以下項有效

/dev/ttyHSL0u:object_r:console_device:s0

 

(4)kernel\arch\arm\boot\dts\qcom\msm8909-cb03.dtsi

使以下項不生效

spi0 = &spi_0; /* SPI0 controller device*/

使以下項有效

 

      blsp1_uart1:serial@78af000 {
              compatible= "qcom,msm-lsuart-v14";
              reg= <0x78af000 0x200>;
              interrupts= <0 107 0>;
              status= "disabled";
              clocks= <&clock_gcc clk_gcc_blsp1_uart1_apps_clk>,
                      <&clock_gcc clk_gcc_blsp1_ahb_clk>;
              clock-names= "core_clk", "iface_clk";
       };

 

(5)kernel\arch\arm\boot\dts\qcom\msm8909-qrd-cb03.dtsi

使以下項有效

 

&blsp1_uart1 {
       status= "ok";
       pinctrl-names= "default";
       pinctrl-0= <&uart_console_sleep>;
};

 

3.V1.1主板

\

 

圖2

UART2_TX-------GPIO_20

UART2_RX-------GPIO_21

\

 

圖3

 

UART_VDD_EN------I2C擴展IC XRA1201的P6引腳。

 

所做的修改如下

(1)\bootable\bootloader\lk\platform\msm8909\ msm8909-clock.c

msm_clocks_msm8909[]增加:

 

CLK_LOOKUP("uart2_iface_clk",gcc_blsp1_ahb_clk.c),
CLK_LOOKUP("uart2_core_clk",  gcc_blsp1_uart2_apps_clk.c),

 

(2)bootable\bootloader\lk\target\msm8909\init.c

target_early_init()函數下

 

uart_dm_init(1, 0, BLSP1_UART0_BASE);
改為
uart_dm_init(2,0, BLSP_UART1_BASE);

 

(3)\bootable\bootloader\lk\platform\msm8909\gpio.c

target_early_init()--->uart_dm_init(id)--->gpio_config_uart_dm()

 

/* configure rx gpio */
       gpio_tlmm_config(5,2, GPIO_INPUT, GPIO_NO_PULL,
                            GPIO_8MA,GPIO_DISABLE);
 
       /*configure tx gpio */
       gpio_tlmm_config(4,2, GPIO_OUTPUT, GPIO_NO_PULL,
                            GPIO_8MA,GPIO_DISABLE);
       #endif

 

改為

 

/* configure rx gpio */
       gpio_tlmm_config(21, 3, GPIO_INPUT, GPIO_NO_PULL,
                            GPIO_8MA,GPIO_DISABLE);
 
       /*configure tx gpio */
       gpio_tlmm_config(20, 3, GPIO_OUTPUT, GPIO_NO_PULL,
                            GPIO_8MA,GPIO_DISABLE);

 

(4)\kernel\arch\arm\mach-msm\include\mach\msm_iomap-8909.h

#define MSM_DEBUG_UART_PHYS 0x78AF000改為0x78B0000

 

(5)device\qcom\sepolicy\common\file_contexts

增加:

/dev/ttyHSL1 u:object_r:console_device:s0

如果有/dev/ttyHSL0 u:object_r:console_device:s0也不影響。

 

(6)kernel\arch\arm\boot\dts\qcom\msm8909-cb03.dtsi

確保下面有效

 

blsp1_uart2: serial@78b0000 {
              compatible= "qcom,msm-lsuart-v14";
              reg= <0x78b0000 0x200>;
              interrupts= <0 108 0>;
              status= "disabled";
              clocks= <&clock_gcc clk_gcc_blsp1_uart2_apps_clk>,
                      <&clock_gcc clk_gcc_blsp1_ahb_clk>;
              clock-names= "core_clk", "iface_clk";
       };

 

同時注釋掉blsp1_uart1,因為BLSP1是作為SPI。

 

(7)\kernel\drivers\misc\msmgpio_ctrl.c

msmgpio_ctrl_probe()增加

gpio_direction_output(pdata->uart1_vcc,1);//確保3.3V供電

 

這裡就算是改為gpio_direction_output(pdata->uart1_vcc,0);也可輸出調試信息,這裡可能是其他地方有電過來。

 

(8)msm8909-qrd-skue-cb03.dtsi,比較重要

 

/ {
       aliases{
              serial1= &blsp1_uart2;// should be no serial1, 0 for console
       };
};

 

這裡確保為采用的串口,下面給出相關介紹

\kernel\Documentation\devicetree\bindings\tty\serial\msm_serial.txt

 

Aliases:
An alias may optionally be used to bind theserial device to a tty device
(ttyHSLx) with a given line number. Aliasesare of the form serial where 
is an integer representing the line numberto use. On systems with multiple
serial devices present it is recommendedthat an alias be defined for each such
device.

 

(9)msm8909-pinctrl-cb03.dtsi和msm8909-pinctrl.dtsi

 

pmx-uartconsole {
                     qcom,pins= <&gp 4>, <&gp 5>;
                     qcom,num-grp-pins= <2>;
                     qcom,pin-func= <2>;
                     label= "uart-console";
                     uart_console_sleep:uart-console {
                            drive-strength= <2>;
                            bias-pull-down;
                     };
              };

 

把這兩個文件下的qcom,pins =<&gp 4>, <&gp 5>;改為qcom,pins = <&gp 20>, <&gp 21>;

 

(10) \device\qcom\msm8909\ BoardConfig.mk

BOARD_KERNEL_CMDLINE :=console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcomuser_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 earlyprintk

上面的ttyHSL0統一改為ttyHSL1,同時去掉最後面的earlyprintk,否則啟動失敗信息如下:

 

Android Bootloader - UART_DM Initialized!!!
[70] Not able to search the panel:
[80] Logo config doesn't match with fbconfig. Fall back default logo
[520] Channel alloc freed
Uncompressing Linux... done, booting thekernel.

 

一開機可能就卡在這裡,或是多次自動反復重啟後停止這裡,輸出的都是這些信息。只要加上earlyprintk,就有這問題。

 

(11) kernel\arch\arm\boot\dts\qcom\msm8909-cb03.dtsi

 

4.V1.0主板和V1.1主板可顯示調試信息的差異

 

V1.0主板可以輸出更早啟動階段的調試信息,應該是由UART1改為UART2後,還有一些地方沒有改好,如下:

 

Format: Log Type - Time(microsec) - Message- Optional Info
Log Type: B - Since Boot(Power OnReset),  D - Delta,  S - Statistic
S -QC_IMAGE_VERSION_STRING=BOOT.BF.3.1.2.C2-00014
S - IMAGE_VARIANT_STRING=DAASANAZA
S - OEM_IMAGE_VERSION_STRING=BU3-gongyong5
S - Boot Config, 0x000000e1
B -     1566 - PBL, Start
B -     4542 - bootable_media_detect_entry, Start
B -    74039 - bootable_media_detect_success, Start
B -    74043 - elf_loader_entry, Start
B -    75610 - auth_hash_seg_entry, Start
B -    75871 - auth_hash_seg_exit, Start
B -    90062 - elf_segs_hash_verify_entry, Start
B -   148922 - PBL, End
B -   170342 - SBL1, Start
B -   231739 - boot_flash_init, Start
D -       30 - boot_flash_init, Delta
B -   238662 - boot_config_data_table_init, Start
D -     5642 - boot_config_data_table_init, Delta - (0 Bytes)
B -   249276 - CDT version:3,Platform ID:11,Major ID:1,Minor ID:0,Subtype:12
B -   257054 - pm_device_init, Start
B -   260378 - pm_device_init, TEST - MSM8909 detected
B -   266051 - pm_device_init, INFO - PM8909 is selected
B -   280783 - PM_SET_VAL:Skip
D -    22112 - pm_device_init, Delta
B -   282186 - sbl1_ddr_set_params, Start
B -   284565 - cpr_init, Start
D -        0 - cpr_init, Delta
B -   290207 - Pre_DDR_clock_init, Start
D -      183 - Pre_DDR_clock_init, Delta
D -        0 - sbl1_ddr_set_params, Delta
B -   303139 - pm_driver_init, Start
B -   309941 - --> Charge init
B -     3939 - battery voltage
B -   313448 - boot up
B -       10 - Current status
D -    10614 - pm_driver_init, Delta
B -   325557 - clock_init, Start
D -      152 - clock_init, Delta
B -   325923 - Image Load, Start
D -    22814 - QSEE Image Loaded, Delta - (460120 Bytes)
B -   348767 - Image Load, Start
D -      549 - SEC Image Loaded, Delta - (2048 Bytes)
B -   357063 - sbl1_efs_handle_cookies, Start
D -      762 - sbl1_efs_handle_cookies, Delta
B -   363773 - Image Load, Start
D -    14731 - RPM Image Loaded, Delta - (154076 Bytes)
B -   378535 - Image Load, Start
D -    19551 - APPSBL Image Loaded, Delta - (466512 Bytes)
B -   398147 - QSEE Execution, Start
D -      335 - QSEE Execution, Delta
B -   403881 - SBL1, End
D -   235826 - SBL1, Delta
S - Throughput, 33000 KB/s  (1082756 Bytes,  32538 us)
S - DDR Frequency, 400 MHz
  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved