20190115_jeffrey - silenceuncrio/diary GitHub Wiki

0900

昨天因 bitbake u-boot-imx -c devshell 目前無法使用的關係

改由 bitbake u-boot-imx -c compile -f 得知 u-boot-imx 的 source code 在 M300/build_small/tmp\work/m300-poky-linux-gnueabi/u-boot-imx/2015.04-r0/git

<u-boot-imx-src> = M300/build_small/tmp\work/m300-poky-linux-gnueabi/u-boot-imx/2015.04-r0

<u-boot-imx-src>/temp/log.do_compile 利用 arm-poky-linux-gnueabi-gcc 字眼

找出那些 file 被 compile 方便利用 source insight

繼續整理昨天的成果 簡單按照英文字母順序來整理

arch/arm/

arch/arm/cpu/armv7/cache_v7.c
arch/arm/cpu/armv7/cp15.c
arch/arm/cpu/armv7/cpu.c
arch/arm/cpu/armv7/mx6/clock.c
arch/arm/cpu/armv7/mx6/soc.c
arch/arm/cpu/armv7/lowlevel_init.S
arch/arm/cpu/armv7/start.S
arch/arm/cpu/armv7/syslib.c
arch/arm/cpu/u-boot.lds

arch/arm/imx-common/cmd_bmode.c
arch/arm/imx-common/cpu.c
arch/arm/imx-common/i2c-mxv7.c
arch/arm/imx-common/iomux-v3.c
arch/arm/imx-common/misc.c
arch/arm/imx-common/speed.c
arch/arm/imx-common/syscounter.c

arch/arm/lib/asm-offsets.c
arch/arm/lib/bootm-fdt.c
arch/arm/lib/bootm.c
arch/arm/lib/cache-cp15.c
arch/arm/lib/cache.c
arch/arm/lib/crt0.S
arch/arm/lib/eabi_compat.c
arch/arm/lib/interrupts.c
arch/arm/lib/relocate.S
arch/arm/lib/reset.c
arch/arm/lib/sections.c
arch/arm/lib/stack.c
arch/arm/lib/vectors.S

board/freescale/mx6ul_14x14_evk/

board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
board/freescale/mx6ul_14x14_evk/imximage.cfg

common/

common/autoboot.c
common/board_f.c
common/board_info.c
common/board_r.c
common/bootm.c
common/bootm_os.c
common/cli.c
common/cli_readline.c
common/cli_simple.c
common/cmd_bdinfo.c
common/cmd_boot.c
common/cmd_bootm.c
common/cmd_cache.c
common/cmd_console.c
common/cmd_echo.c
common/cmd_exit.c
common/cmd_disk.c
common/cmd_fdt.c
common/cmd_flash.c
common/cmd_fuse.c
common/cmd_help.c
common/cmd_i2c.c
common/cmd_itest.c
common/cmd_load.c
common/cmd_mdio.c
common/cmd_mem.c
common/cmd_mii.c
common/cmd_misc.c
common/cmd_nand.c
common/cmd_net.c
common/cmd_nvedit.c
common/cmd_pcmcia.c
common/cmd_source.c
common/cmd_test.c
common/cmd_usb.c
common/cmd_version.c
common/cmd_ximg.c
common/command.c
common/console.c
common/dlmalloc.c
common/env_attr.c
common/env_callback.c
common/env_common.c
common/env_flags.c
common/env_nand.c
common/exports.c
common/fdt_support.c
common/flash.c
common/hash.c
common/image-fdt.c
common/image.c
common/main.c
common/miiphyutil.c
common/malloc_simple.c
common/memsize.c
common/s_record.c
common/splash.c
common/stdio.c
common/usb.c
common/usb_hub.c
common/usb_storage.c
common/xyzModem.c

disk/

disk/part.c

drivers/

drivers/core/device.c
drivers/core/device-remove.c
drivers/core/lists.c
drivers/core/root.c
drivers/core/uclass.c
drivers/core/util.c

drivers/crypto/fsl/sec.c

drivers/dma/apbh_dma.c

drivers/gpio/mxc_gpio.c

drivers/i2c/i2c_core.c
drivers/i2c/mxc_i2c.c

drivers/input/input.c


drivers/misc/mxc_ocotp.c
drivers/mtd/mtdcore.c
drivers/mtd/nand/nand.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nand_bbt.c
drivers/mtd/nand/nand_ids.c
drivers/mtd/nand/nand_ecc.c
drivers/mtd/nand/nand_util.c
drivers/mtd/nand/mxs_nand.c

drivers/net/fec_mxc.c
drivers/net/phy/micrel.c
drivers/net/phy/phy.c

drivers/pcmcia/tqm8xx_pcmcia.c

drivers/rtc/date.c

drivers/serial/serial.c
drivers/serial/serial_mxc.c
drivers/spi/spi.c

drivers/thermal/imx_thermal.c
drivers/thermal/thermal-uclass.c

drivers/usb/eth/asix.c
drivers/usb/eth/usb_ether.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-mx6.c

drivers/watchdog/imx_watchdog.c

examples/standalone/

examples/standalone/stubs.c
examples/standalone/hello_world.c

fs/

fs/fs.c

lib/

lib/libfdt/fdt.c
lib/libfdt/fdt_addresses.c
lib/libfdt/fdt_empty_tree.c
lib/libfdt/fdt_ro.c
lib/libfdt/fdt_rw.c
lib/libfdt/fdt_strerror.c
lib/libfdt/fdt_sw.c
lib/libfdt/fdt_wip.c

lib/zlib/zlib.c

lib/asm-offsets.c

lib/crc7.c
lib/crc8.c
lib/crc16.c
lib/crc32.c
lib/ctype.c

lib/display_options.c
lib/div64.c

lib/errno.c

lib/gunzip.c

lib/hang.c
lib/hashtable.c

lib/ldiv.c
lib/list_sort.c
lib/linux_compat.c
lib/linux_string.c
lib/lmb.c
lib/initcall.c
lib/net_utils.c
lib/qsort.c
lib/strmhz.c
lib/string.c
lib/time.c
lib/vsprintf.c

net/

net/arp.c
net/bootp.c
net/checksum.c
net/eth.c
net/nfs.c
net/ping.c
net/tftp.c

test/dm/

test/dm/cmd_dm.c

0935

可以開一個 source insight 來 trace 了

1015

直接從 uboot output 的訊息來 trace

U-Boot 2015.04imx_v2015.04_4.1.15_1.2.0_ga+gede7538 (Jun 05 2018 - 08:41:48)

CPU:   Freescale i.MX6UL rev1.2 at 396 MHz
CPU:   Temperature 34 C
Reset cause: POR
Board: MX6UL 14x14 EVK
I2C:   ready
DRAM:  512 MiB
force_idle_bus: sda=0 scl=0 sda.gp=0x1d scl.gp=0x1c
NAND:  256 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   Phy 1 not found
PHY reset timed out
FEC1
Error: FEC1 address not set.

Normal Boot
Hit any key to stop autoboot:  0
run primary app
run bootargs_a
bootargs for room a

NAND read: device 0 offset 0x400000, size 0x800000
 8388608 bytes read: OK

NAND read: device 0 offset 0xe00000, size 0x100000
 1048576 bytes read: OK
Saving Environment to NAND...
Erasing NAND...
Erasing at 0x3e0000 -- 100% complete.
Writing to NAND... OK
Kernel image @ 0x80800000 [ 0x000000 - 0x4ea270 ]
## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000
   Using Device Tree in place at 83000000, end 8300a23c

Starting kernel ...

1110

試著作以下修改

diff --git a/mx6ul_14x14_evk.c b/mx6ul_14x14_evk.c
index e38653e..d86d1a7 100644
--- a/mx6ul_14x14_evk.c
+++ b/mx6ul_14x14_evk.c
@@ -907,6 +907,8 @@ void ldo_mode_set(int ldo_bypass)

 int board_init(void)
 {
+    printf("jeffrey: board_init\n");
+
        /* Address of boot parameters */
        gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;

diff --git a/ucl2.xml b/ucl2.xml
index 520ff3d..9a8bff6 100644
--- a/ucl2.xml
+++ b/ucl2.xml
@@ -37,6 +37,13 @@
   <CMD state="Updater" type="push"
     body="$ kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 $FILE">Flashing Bootloader</CMD>

+
+
+  <CMD state="Updater" type="push"
+    body="$ echo Update Complete!">Done</CMD>
+
+
+
   <!-- burn the kernel_a -->
   <CMD state="Updater" type="push"
     body="$ flash_erase /dev/mtd2 0 0">Erasing Kernel partition A</CMD>
(END)

ucl2.xml 的修改效果是讓 mfgtool 只燒 uboot

使用 bitbake u-boot-imx -c compile -vf 來對 u-boot-imx 做 compile

使用 bitbake u-boot-imx -c deploy

會在 M300\build_small\images 發現 u-boot-m300.imx-nand

u-boot-m300.imx-nand 複製到

M300\build_small\images\mfgtools\nandflash\mfgtools\Profiles\Linux\OS Firmware\files

啟動 mfgtool M300\build_small\images\mfgtools\nandflash\mfgtools\nandflash.vbs

這會套用到我們修改的

M300\build_small\images\mfgtools\nandflash\mfgtools\Profiles\Linux\OS Firmware\ucl2.xml

效果是只會燒 uboot

開機

U-Boot 2015.04imx_v2015.04_4.1.15_1.2.0_ga+gede7538 (Jan 15 2019 - 03:09:02)

CPU:   Freescale i.MX6UL rev1.1 at 396 MHz
CPU:   Temperature 34 C
Reset cause: POR
Board: MX6UL 14x14 EVK
I2C:   ready
DRAM:  512 MiB
jeffrey: board_init
force_idle_bus: sda=0 scl=0 sda.gp=0x1d scl.gp=0x1c
NAND:  256 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   Phy 1 not found
PHY reset timed out
FEC1
Error: FEC1 address not set.

Normal Boot
Hit any key to stop autoboot:  0

成功出現 jeffrey: board_init 可以放心 trace 了

1430

目前 uboot 作了以下的修改

Index: git/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
===================================================================
--- git.orig/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
+++ git/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
@@ -912,6 +912,106 @@ int board_init(void)
 
 	imx_iomux_v3_setup_multiple_pads(iox_pads, ARRAY_SIZE(iox_pads));
 
+
+
+    /*
+    ** IO control power - GPIO4-IO21
+    ** +----------+--------+------------+------+
+    ** | Instance | Signal | Pad        | Mode |
+    ** | GPIO4    | IO21   | CSI_DATA00 | ALT5 |
+    ** +----------+--------+------------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** off the IO control power then on
+    */
+    printf("off the IO control power then on\n");
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 0);
+    mdelay(100);
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 1);
+
+    /*
+    ** sys led - GPIO2-IO20
+    ** +----------+--------+-----------+------+
+    ** | Instance | Signal | Pad       | Mode |
+    ** | GPIO2    | IO20   | SD1_DATA2 | ALT5 |
+    ** +----------+--------+-----------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    */
+    printf("turn on sys led\n");
+    gpio_direction_output(IMX_GPIO_NR(2, 20) , 0);
+
+    /*
+    ** LTE SIM Select - GPIO2-IO17
+    ** +----------+--------+-----------+------+
+    ** | Instance | Signal | Pad       | Mode |
+    ** | GPIO2    | IO17   | SD1_CLK   | ALT5 |
+    ** +----------+--------+-----------+------+
+    **
+    ** 0 - SIM1
+    ** 1 - SIM2
+    **
+    ** select SIM1
+    */
+    printf("select SIM1\n");
+    gpio_direction_output(IMX_GPIO_NR(2, 17) , 0);
+
+    /*
+    ** Ethernet 1 Reset PIN - GPIO1-IO30
+    ** +----------+--------+---------------+------+
+    ** | Instance | Signal | Pad           | Mode |
+    ** | GPIO1    | IO30   | UART5_TX_DATA | ALT5 |
+    ** +----------+--------+---------------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** reset Ethernet 1
+    */
+    printf("reset Ethernet 1\n");
+    gpio_direction_output(IMX_GPIO_NR(1, 30) , 0);
+    udelay(500);
+    gpio_direction_output(IMX_GPIO_NR(1, 30) , 1);
+
+    /*
+    ** Ethernet 2 Reset PIN - GPIO1-IO30
+    ** +----------+--------+---------------+------+
+    ** | Instance | Signal | Pad           | Mode |
+    ** | GPIO1    | IO31   | UART5_RX_DATA | ALT5 |
+    ** +----------+--------+---------------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** reset Ethernet 2
+    */
+    printf("reset Ethernet 2\n");
+    gpio_direction_output(IMX_GPIO_NR(1, 31) , 0);
+    udelay(500);
+    gpio_direction_output(IMX_GPIO_NR(1, 31) , 1);
+
+    /*
+    ** Mobile Reset PIN - GPIO5-IO7
+    ** +----------+--------+--------------+-----------------+
+    ** | Instance | Signal | Pad          | Mode            |
+    ** | GPIO5    | IO7    | SNVS_TAMPER7 | No Muxing(ALT5) |
+    ** +----------+--------+--------------+-----------------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** reset Mobile
+    */
+    printf("reset Mobile\n");
+    gpio_direction_output(IMX_GPIO_NR(5, 7) , 0);
+    udelay(500);
+    gpio_direction_output(IMX_GPIO_NR(5, 7) , 1);
+
+
+
 	iox74lv_init();
 
 #ifdef CONFIG_SYS_I2C_MXC
Index: git/include/configs/mx6ul_14x14_evk.h
===================================================================
--- git.orig/include/configs/mx6ul_14x14_evk.h
+++ git/include/configs/mx6ul_14x14_evk.h
@@ -205,13 +205,12 @@
         "else echo b to a; setenv app_primary a; setenv app_secondary b;" \
         "fi\0" \
     "no_good=.\0" \
-    "uboot_env_ver=1.0\0" \
+    "uboot_env_ver=1.4\0" \
 	\
 	/* do not allow user stop autoboot - no chance to change the uboot env */ \
 	"bootdelay=0\0" \
 	\
-    "bootcmd=mw 0x020A0004 00100000 1; mw 0x020E01CC 0x00000005 1;" \
-        "run app_choose;" \
+    "bootcmd=run app_choose;" \
         "echo run bootargs_${app_primary}; run bootargs_${app_primary};" \
         "run nandread_${app_primary};" \
         "setenv no_good ${no_good}x; saveenv;" \

會發現我也順手改了 WiFi 的問題

+    /*
+    ** IO control power - GPIO4-IO21
+    ** +----------+--------+------------+------+
+    ** | Instance | Signal | Pad        | Mode |
+    ** | GPIO4    | IO21   | CSI_DATA00 | ALT5 |
+    ** +----------+--------+------------+------+
+    **
+    ** 0 - off
+    ** 1 - on
+    **
+    ** off the IO control power then on
+    */
+    printf("off the IO control power then on\n");
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 0);
+    mdelay(100);
+    gpio_direction_output(IMX_GPIO_NR(4, 21) , 1);

linux 部分 rc.local 已經不需要去呼叫 uboot_env.sh

diff --git a/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local b/proscend
/memory_fs/nandflash/default/rootfs/etc/rc.local
index d5211ca..d3b8d25 100644
--- a/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
+++ b/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
@@ -39,12 +39,6 @@ function core_uboot_env_loose_indicate {
 # recover the corrupt /etc/passwd file
 /usr/sbin/icos/passwd_recover.sh

-# apply the uboot env variables related to current application
-/usr/sbin/icos/uboot_env.sh
-
-# run bootcmd_v1.3 define in uboot_env.sh
-fw_setenv bootcmd 'run bootcmd_v1.3'
-


 app_a_mtdn=5

另外就是要修改 proscend/tools/firmware_patch.sh

diff --git a/proscend/tools/firmware_patch.sh b/proscend/tools/firmware_patch.sh
old mode 100755
new mode 100644
index 3996ce4..0f507b7
--- a/proscend/tools/firmware_patch.sh
+++ b/proscend/tools/firmware_patch.sh
@@ -6,7 +6,12 @@
 function patch_nandflash {
   echo "patch for NAND Flash storage memory ..."

-  echo "Nothing to do"
+  echo "Burn the uboot to NAND..."
+  echo "Erasing Boot partition"
+  flash_erase /dev/mtd0 0 0
+  echo "Flashing Bootloader"
+  kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 /tmp/firmware/u-boot-m300.imx-nand
+#  echo "Nothing to do"

   echo "patch for NAND Flash storage memory succeeded"
 }

這樣一來 firmware upgrade 時就會順便 upgrade uboot

build image

mfgtoo 燒錄 - 已還原成原本的 ucl2.xml

1640

先拿給 morris 量一下訊號

1710

morris 表示訊號是正確的

我看我先上 code 吧

commit 7f27819db4f987f6cff66cfe75b6e78e2ac54fd3
Refs: [v1.75-mfg], {origin/v1.75-mfg}
Author: jeffrey <[email protected]>
Date:   Tue Jan 15 17:13:44 2019 +0800

    do some actions at board_init() in u-boot:
    - off the IO control power then on
    - turn on sys led
    - select SIM1
    - reset Ethernet 1
    - reset Ethernet 2
    - reset Mobile

    note 1: no more '/usr/sbin/icos/uboot_env.sh' at rc.local
    note 2: Burn the uboot to NAND while firmware upgrade

 .../recipes-bsp/u-boot/files/uboot_env_v1.4.patch  | 131 +++++++++++++++++++++
 .../recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend |   1 +
 .../nandflash/default/rootfs/etc/rc.local          |   6 -
 proscend/tools/firmware_patch.sh                   |   7 +-
 4 files changed, 138 insertions(+), 7 deletions(-)

1720

M300 - WiFi: warm reboot cause hang 的工作可以跟 M300 - Set to SIM 1 slot in uboot 的解法一模一樣

M300 - WiFi: warm reboot cause hang 是要解在 branch hotfix/v1.76-wifi-eva

切到 branch hotfix/v1.76-wifi-eva

build image

  • Products/Vendor = M300/16_MTK_WIFI

compile error - jessy 已幫忙處理

1750

build image... ok

⚠️ **GitHub.com Fallback** ⚠️