一、失败原因:
这块开发板从同事手里接过来时,外部32.768KHz晶体Y2被焊掉了。而原厂的故件程序是需要依赖这颗32.768KHz晶体才能正常启动。
这颗 32.768KHz晶体,主要用于低功耗模式,以及为RTC提供时钟。
二、解决方法
1)将这颗外部32.768KHz晶体焊上后,使用原来的步骤就正常
2)如果保持其不焊接的状态,需要修改bootstrap代码,具体修改方式如下:
step1: 获取代码
git clone git://github.com/linux4sam/at91bootstrap.git
step2:切换分支
$ git branch -r
$ git checkout origin/at91bootstrap-3.x -b at91bootstrap-3.x
step3:生成sama5d3 xplained 的配置文件
$ find board/ -type d | sort | cut -d '/' -f2
$ find board/sama5d3_xplained -name "*_defconfig" | cut -d '/' -f3
$ make mrproper
$ make sama5d3_xplainednf_uboot_defconfig
step4:修改配置文件
$ make menuconfig
将对应的32.768KHz oscillator取消,如下图示:
保存,并退出。
step5:编译bootstrap
$ make CROSS_COMPILE=arm-none-eabi-
生成的bootstrap 文件在 binaries/ 下
这样,其它固件不变,只把原厂的sama5d3_xplained-nandflashboot-uboot-3.6.1.bin替换成我们新编译的bootstrap就好了。
成功登录进文件系统,如下示:
三、回顾失败现象如下
1. 从linux4sam下载demo固件
http://www.at91.com/linux4sam/bin/view/Linux4SAM/GettingStarted
下载如下的 linux4sam-poky-sama5d3_xplained-4.3.zip
解压后,使用demo_linux_nandflash.bat,烧写完成后无法进入文件系统
加载到
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-atmel: EHCI Atmel driver
就停住了。
2. 使用 sam-ba 单步烧写也不成功
具体如下:
1)使用sam-ba 先 “Enable NandFlash” 再"Erase All"、再“Enable OS PMECC parameters”
2)使用 “Send Boot File”将 sama5d3_xplained-bootstrap-nandflashboot-uboot-3.6.1.bin
烧写到0地址处
3)使用“Send File” 将u-boot-sama5d3_xplained-v2013.07-at91-r1.bin
烧写到 0x40000地址处
4)使用 “Send File” 将at91-sama5d3_xplained.dtb
烧写到 0x180000地址处
5)使用 “Send File” 将 zImage-sama5d3_xplained.bin
烧写到 0x200000地址处
6)先 “Enable OS PMECC parameters”,后使用“Send File”将buildroot_2012.11.1- at91_sama5d3_linux4sam_4.2.ubi
烧写到 0x800000地址处
烧写后退出 sam-ba 复位,还是不成功。具体启动日志如下:
RomBOOT
AT91Bootstrap 3.6.1-00078-g5415d4e (Tue Feb 4 15:36:46 CET 2014)
NAND: ONFI flash detected
NAND: Manufacturer ID: 0x2c Chip ID: 0x32
NAND: Disable On-Die ECC
NAND: Initialize PMECC params, cap: 0x4, sector: 0x200
NAND: Image: Copy 0x80000 bytes from 0x40000 to 0x26f00000
NAND: Done to load image
U-Boot 2013.07 (Feb 04 2014 - 15:36:32)
CPU: SAMA5D36
Crystal frequency: 12 MHz
CPU clock : 528 MHz
Master clock : 132 MHz
DRAM: 256 MiB
NAND: 256 MiB
MMC: mci: 0, mci: 1
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: gmac0
Warning: failed to set MAC address
, macb0
Warning: failed to set MAC address
Hit any key to stop autoboot: 3 2 0
NAND read: device 0 offset 0x180000, size 0x80000
524288 bytes read: OK
NAND read: device 0 offset 0x200000, size 0x600000
6291456 bytes read: OK
Kernel image @ 0x22000000 [ 0x000000 - 0x33be28 ]
## Flattened Device Tree blob at 21000000
Booting using the fdt blob at 0x21000000
Loading Device Tree to 2bb12000, end 2bb1a046 ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 3.10.0-yocto-standard (nferre@tenerife) (gcc version 4.8.1 (GCC) ) #1 Wed Feb 5 10:03:20 CET 2014
CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=50c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: Atmel SAMA5 (Device Tree), model: SAMA5D3 Xplained
bootconsole [earlycon0] enabled
Memory policy: ECC disabled, Data cache writeback
AT91: Detected soc type: sama5d3
AT91: Detected soc subtype: sama5d36
AT91: sram at 0x300000 of 0x20000 mapped at 0xfef58000
CPU: All CPU(s) started in SVC mode.
Clocks: CPU 528 MHz, master 132 MHz, main 12.000 MHz
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
Kernel command line: console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,256K(env),256k(evn_redundent),256k(spare),512k(dtb),6M(kernel)ro,-(rootfs) rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
allocated 524288 bytes of page_cgroup
please try 'cgroup_disable=memory' option if you don't want memory cgroups
Memory: 256MB = 256MB total
Memory: 252736k/252736k available, 9408k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
modules : 0xbf800000 - 0xc0000000 ( 8 MB)
.text : 0xc0008000 - 0xc05b4fc8 (5812 kB)
.init : 0xc05b5000 - 0xc05d2d60 ( 120 kB)
.data : 0xc05d4000 - 0xc063a9f8 ( 411 kB)
.bss : 0xc063a9f8 - 0xc0663820 ( 164 kB)
NR_IRQS:16 nr_irqs:16 16
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
Console: colour dummy device 80x30
Calibrating delay loop... 351.43 BogoMIPS (lpj=1757184)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys memory
Initializing cgroup subsys devices
Initializing cgroup subsys freezer
Initializing cgroup subsys blkio
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0xc0350648 - 0xc0350694
devtmpfs: initialized
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
AT91: Power Management
gpio-at91 fffff200.gpio: at address fefff200
gpio-at91 fffff400.gpio: at address fefff400
gpio-at91 fffff600.gpio: at address fefff600
gpio-at91 fffff800.gpio: at address fefff800
gpio-at91 fffffa00.gpio: at address fefffa00
pinctrl-at91 pinctrl.2: initialized AT91 pinctrl driver
bio: create slab <bio-0> at 0
at_hdmac ffffe600.dma-controller: Atmel AHB DMA Controller ( cpy slave ), 8 channels
at_hdmac ffffe800.dma-controller: Atmel AHB DMA Controller ( cpy slave ), 8 channels
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
of_dma_request_slave_channel: dma-names property missing or empty
at91_i2c f0014000.i2c: can't get a DMA channel for tx
at91_i2c f0014000.i2c: can't use DMA
at91_i2c f0014000.i2c: AT91 i2c bus driver.
at91_i2c f0018000.i2c: using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers
at91_i2c f0018000.i2c: AT91 i2c bus driver.
at91_i2c f801c000.i2c: can't get a DMA channel for tx
at91_i2c f801c000.i2c: can't use DMA
at91_i2c f801c000.i2c: AT91 i2c bus driver.
media: Linux media interface: v0.10
Linux video capture interface: v2.00
Advanced Linux Sound Architecture Driver Initialized.
Bluetooth: Core ver 2.16
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized
cfg80211: Calling CRDA to update world regulatory domain
Switching to clocksource tcb_clksrc
NET: Registered protocol family 2
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
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
jffs2: version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
msgmni has been set to 493
io scheduler noop registered (default)
f001c000.serial: ttyS1 at MMIO 0xf001c000 (irq = 23) is a ATMEL_SERIAL
f0020000.serial: ttyS2 at MMIO 0xf0020000 (irq = 24) is a ATMEL_SERIAL
f0024000.serial: ttyS5 at MMIO 0xf0024000 (irq = 25) is a ATMEL_SERIAL
ffffee00.serial: ttyS0 at MMIO 0xffffee00 (irq = 39) is a ATMEL_SERIAL
console [ttyS0] enabled, bootconsole disabled
console [ttyS0] enabled, bootconsole disabled
brd: module loaded
loop: module loaded
atmel_nand_nfc 70000000.nfc: NFC is probed.
atmel_nand: Use On Flash BBT
atmel_nand 60000000.nand: Using dma0chan2 for DMA transfers.
ONFI param page 0 valid
ONFI flash detected
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08ABAEAWP), 256MiB, page size: 2048, OOB size: 64
atmel_nand 60000000.nand: ONFI params, minimum required ECC: 4 bits in 512 bytes
atmel_nand 60000000.nand: Initialize PMECC params, cap: 4, sector: 512
atmel_nand 60000000.nand: Using NFC Sram read and write
Bad block table not found for chip 0
Bad block table not found for chip 0
Scanning device for bad blocks
Bad eraseblock 100 at 0x000000c80000
Bad eraseblock 101 at 0x000000ca0000
Bad block table written to 0x00000ffe0000, version 0x01
Bad block table written to 0x00000ffc0000, version 0x01
8 cmdlinepart partitions found on MTD device atmel_nand
Creating 8 MTD partitions on "atmel_nand":
0x000000000000-0x000000040000 : "bootstrap"
0x000000040000-0x0000000c0000 : "uboot"
0x0000000c0000-0x000000100000 : "env"
0x000000100000-0x000000140000 : "evn_redundent"
0x000000140000-0x000000180000 : "spare"
0x000000180000-0x000000200000 : "dtb"
0x000000200000-0x000000800000 : "kernel"
0x000000800000-0x000010000000 : "rootfs"
atmel_spi f0004000.spi: version: 0x213
atmel_spi f0004000.spi: Using dma0chan3 (tx) and dma0chan4 (rx) for DMA transfers
atmel_spi f0004000.spi: Atmel SPI Controller at 0xf0004000 (irq 18)
atmel_spi f0004000.spi: master is unqueued, this is deprecated
atmel_spi f8008000.spi: version: 0x213
atmel_spi f8008000.spi: Using dma1chan0 (tx) and dma1chan1 (rx) for DMA transfers
atmel_spi f8008000.spi: Atmel SPI Controller at 0xf8008000 (irq 28)
atmel_spi f8008000.spi: master is unqueued, this is deprecated
CAN device driver interface
at91_can f000c000.can: device registered (reg_base=d08ea000, irq=19)
at91_can f8010000.can: device registered (reg_base=d08ec000, irq=29)
macb f0028000.ethernet (unregistered net_device): invalid hw address, using random
libphy: MACB_mii_bus: probed
macb f0028000.ethernet eth0: Cadence GEM at 0xf0028000 irq 26 (ee:e8:24:3b:a4:ff)
macb f0028000.ethernet eth0: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=f0028000.etherne:07, irq=-1)
macb f802c000.ethernet (unregistered net_device): invalid hw address, using random
libphy: MACB_mii_bus: probed
macb f802c000.ethernet eth1: Cadence MACB at 0xf802c000 irq 33 (ce:23:81:0a:d8:07)
macb f802c000.ethernet eth1: attached PHY driver [Micrel KSZ8081 or KSZ8091] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-atmel: EHCI Atmel driver