===== Uboot를 이용한 Writing - BootStrap을 제외한 나머지 ===== ==== TFTP Server 설치 ==== TFTP 서버는 Windows용이나 Linux 용이나 어떤것을 선택해도 된다. \\ 간단하게 설치 후 사용할 수 있는 Windows 용을 설치해서 운영하였다. \\ {{wiki:atmel_sama5d42:uboot_write:SolarWindsTFTPServer.zip}} 이를 다운받아 풀고 이를 설치한다.\\ {{wiki:atmel_sama5d42:uboot_write:tftp_server_setup.jpg}} \\ 이와 같이 TFTP server에서 공개될 폴더 하나를 설정한다.\\ 아래는 본인의 설정에 따라 IP가 약간씩 변경된다.\\ 이에 나의 설정에 따라 진행 된다. 가가자 본인의 설정에 맞추어 변경 해서 사용하기 바란다.\\ 일단 TFTP server가 설치된 Windows의 IP는 다음과 같다. {{wiki:atmel_sama5d42:uboot_write:server_ip.jpg}} \\ IP = 192.168.28.100 ==== Uboot를 이용한 Write 예제 ==== 우선 SAM-BA로 BootStrap과 U-boot는 Target Board에 설치 되어 있어야 한다.\\ 이의 두개가 Target Board에 설치 되어 있어야 하고 Serial Debug와 Ethernet이 연결 되어 있어야 한다.\\ \\ 나는 다음과 같이 연결 되어 있다.\\ \\ {{wiki:atmel_sama5d42:uboot_write:connection.jpg}} \\ \\ \\ Target Board의 Uboot 가 실행된 후 IP를 다음과 같이 설정한다. Bank Address Offset Bits = 0xB ... Target Board Initialized Enabled 32.768KHz OSC Atmel Boot Strap For VI3.8.7 (2017. 07. 31. (월) 15:10:39 KST) All interrupts redirected to AIC Loading Image Initialized NAND: ONFI flash detected NAND: ONFI para CRC error! NAND: Manufacturer ID: 0x1, Chip ID: 0xda NAND: Enable On-Die ECC NAND : Bits Of ECC = 4 NAND : Bits Of Data = 8 NAND : Byte Size Of ECC Base = 512 NAND : Byte Size Of Spare = 64 NAND : Byte Size Of Page = 2048 NAND : Number Of Pages In Block = 64 NAND : Number Of Blocks In Unit = 1024 NAND : Number Of Units In Device = 2 NAND: Image: Copy 80000 bytes from 40000 to 26f00000 NAND: Done to load image Jump to u-boot U-Boot 2016.03-linux4sam_5.5 (Jul 31 2017 - 12:02:12 +0900) CPU: SAMA5D42 Crystal frequency: 12 MHz CPU clock : 528 MHz Master clock : 176 MHz I2C: ready DRAM: 128 MiB NAND: 256 MiB MMC: mci: 0 In: serial Out: serial Err: serial Net: gmac0, usb_ether Error: usb_ether address not set. Hit any key to stop autoboot: 0 => => => setenv ipaddr 192.168.28.28 => setenv serverip 192.168.28.100 => saveenv Saving Environment to NAND... Erasing redundant NAND... Erasing at 0x100000 -- 100% complete. Writing to redundant NAND... OK 여기서 Target Board의 전원을 껏다가 키면 TFTP를 사용할 수 있게 된다.\\ DDR의 영역은 다음과 같다.\\ {{wiki:atmel_sama5d42:uboot_write:DDR_Address.jpg}} \\ 여기서 u-boot 가 사용하는 영역은 다음과 같다.\\ {{wiki:atmel_sama5d42:uboot_write:u-boot_Address.jpg}} \\ 이 DDR의 비어 있는 곳을 이용하여 DTB 파일을 프로그램 한다. DTB 파일을 다운로드한다. Bank Address Offset Bits = 0xB ... Target Board Initialized Enabled 32.768KHz OSC Atmel Boot Strap For VI3.8.7 (2017. 07. 31. (월) 15:10:39 KST) All interrupts redirected to AIC Loading Image Initialized NAND: ONFI flash detected NAND: ONFI para CRC error! NAND: Manufacturer ID: 0x1, Chip ID: 0xda NAND: Enable On-Die ECC NAND : Bits Of ECC = 4 NAND : Bits Of Data = 8 NAND : Byte Size Of ECC Base = 512 NAND : Byte Size Of Spare = 64 NAND : Byte Size Of Page = 2048 NAND : Number Of Pages In Block = 64 NAND : Number Of Blocks In Unit = 1024 NAND : Number Of Units In Device = 2 NAND: Image: Copy 80000 bytes from 40000 to 26f00000 NAND: Done to load image Jump to u-boot U-Boot 2016.03-linux4sam_5.5 (Jul 31 2017 - 12:02:12 +0900) CPU: SAMA5D42 Crystal frequency: 12 MHz CPU clock : 528 MHz Master clock : 176 MHz I2C: ready DRAM: 128 MiB NAND: 256 MiB MMC: mci: 0 In: serial Out: serial Err: serial Net: gmac0, usb_ether Error: usb_ether address not set. Hit any key to stop autoboot: 0 => => => tftp 0x21000000 dtb.bin gmac0: PHY present at 0 gmac0: link up, 100Mbps full-duplex (lpa: 0xcde1) Using gmac0 device TFTP from server 192.168.28.100; our IP address is 192.168.28.28 Filename 'dtb.bin'. Load address: 0x21000000 Loading: ### 667 KiB/s done Bytes transferred = 33486 (82ce hex) => DTB 파일이 저장될 NAND Flash 영역을 지운다. => nand erase 0x180000 0x80000 NAND erase: device 0 offset 0x180000, size 0x80000 Erasing at 0x1e0000 -- 100% complete. OK => DTB 파일을 NAND Flash 영역에 프로그램 한다. => nand write 0x21000000 0x180000 0x82CE NAND write: device 0 offset 0x180000, size 0x82CE 33486 bytes written: OK Kernel Image 파일을 다운로드한다. => tftp 0x22000000 zImage.bin gmac0: PHY present at 0 gmac0: link up, 100Mbps full-duplex (lpa: 0xcde1) Using gmac0 device TFTP from server 192.168.28.100; our IP address is 192.168.28.28 Filename 'zImage.bin'. Load address: 0x22000000 Loading: ################################################################# ################################################################# ################################################################# ############################################## 1.5 MiB/s done Bytes transferred = 3524376 (35c718 hex) => Kernel Image 파일이 저장될 NAND Flash 영역을 지운다. => nand erase 0x200000 0x400000 NAND erase: device 0 offset 0x200000, size 0x400000 Erasing at 0x6e0000 -- 100% complete. OK => Kernel Image 파일을 NAND Flash 영역에 프로그램 한다. => nand write 0x22000000 0x200000 0x35C718 NAND write: device 0 offset 0x200000, size 0x35C718 3524376 bytes written: OK => File System 파일을 다운로드한다. => tftp 0x21000000 rootfs_ubi.bin gmac0: PHY present at 0 gmac0: link up, 100Mbps full-duplex (lpa: 0xcde1) Using gmac0 device TFTP from server 192.168.28.100; our IP address is 192.168.28.28 Filename 'rootfs_ubi.bin'. Load address: 0x21000000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ############# 1.4 MiB/s done Bytes transferred = 43122688 (2920000 hex) => File System 파일이 저장될 NAND Flash 영역을 지운다. => nand erase 0x800000 0x2920000 NAND erase: device 0 offset 0x800000 , size 0x2920000 Erasing at 0x3110000 -- 100% complete. OK => File System 파일을 NAND Flash 영역에 프로그램 한다. => nand write 0x21000000 0x800000 0x2920000 NAND write: device 0 offset 0x800000, size 0x2920000 43122688 bytes written: OK => 다시 Reset을 하면 커널까지 부팅이 완료된다.