S3C2440开发板烧录笔记

S3C2440开发板烧录笔记

本篇博客来自凌云实验室开发板介绍及其烧录学习笔记

1. 开发板基础和介绍

  • 三星公司的 16/32 位精简指令集(RISC)微处理器 S3C2440A
  • 基于 ARM920T 核心,0.13µm 的 CMOS 标准宏单元和存储器单元
  • 它采用了新的总线架构如先进微控制总线构架(AMBA)1

S3C2440开发板烧录笔记_第1张图片
主要注意:256M的nandflash,64M的内存带DM9000网卡,网卡需要改设置。

2. 启动原理+流程

2.1 内存介绍

SRAM:Static Random-Access Memory,是随机存取存储器的一种。所谓的“静态”,是指这种存储器只要保持通电,里面储存的数据就可以恒常保持。
SDRAM:Synchronous Dynamic Random Access Memory,掉电易丢失,需要初始化。
FLASH :长寿命的非易失性(在断电情况下仍能保持所存储的数据信息)的存储器,可分为两种,一种是NOR型闪存,以编码应用为主,其功能多与运算相关;另一种为NAND型闪存,主要功能是存储资料。
S3C2440开发板烧录笔记_第2张图片

2.2 系统运行过程

cpu执行程序,首先将程序烧录进开发板,程序在SDRAM中运行,开机程序不能直接运行,但SRAM可以运行,所以在SRAM中运行一个小程序来初始化cpu、初始化内存、初始化nandflash,就可以引导程序运行起来。

2.2.1.j-link加载bootstrap程序到SRAM 0地址上运行,该程序用来初始化外部SDRAM

在安装好的j-link Commander加载起点文件

****** Error: Unable to halt ARM core
Found 1 JTAG device, Total IRLen = 4:
 #0 Id: 0x0032409D, IRLen: 04, Unknown device
JTAG speed: 1000 kHz
J-Link>h
Info: J-Link: ARM9 CP15 Settings changed: 0xC000107E from 0x00000078, MMU Off, ICache On, DCache On
PC: (R15) = 33F847A4, CPSR = 800000D3 (SVC mode, ARM FIQ dis. IRQ dis.)
R0 = 33FA6BA0, R1 = 30019800, R2 = 00000800, R3 = 000003D3
R4 = 33FA6BA0, R5 = 33FA6AF0, R6 = 00000008, R7 = 30019800
USR: R8 =33F3FFE0, R9 =33F40008, R10=30019800, R11 =30019800, R12 =000000EF
     R13=FFFFEFFF, R14=FFFDFFFF
FIQ: R8 =F67FFFFF, R9 =DBFFFFFF, R10=FEBEFEFB, R11 =FFFBFFFF, R12 =FFEFFFFF
     R13=DFFFFFBF, R14=F7FFFF2E, SPSR=00000011
SVC: R13=33F3FD08, R14=33F849E0, SPSR=00000014
ABT: R13=FFFEFFFD, R14=FFFFFDB7, SPSR=0000001D
IRQ: R13=BFDF7BFE, R14=BFFFFDFF, SPSR=00000010
UND: R13=FFFFFF9D, R14=7FFFFFFF, SPSR=00000014
J-Link>speed 12000
JTAG speed: 12000 kHz
J-Link>loadbin D:\Linux\软件安装\fl2440文件\bootstrap-s3c2440.bin 0
Loading binary file... [D:\Linux\软件安装\fl2440文件\bootstrap-s3c2440.bin]
Writing bin data into target memory @ 0x00000000.
J-Link>setpc 0
J-Link>g

2.2.2.j-link加载u-boo程序到外部SDRAM0x3f80000地址上运行,该程序相当于PC上的BIOS

J-Link>h
...
J-Link>loadbin D:\Linux\软件安装\fl2440文件\u-boot-s3c2440.bin 0x33f80000
Loading binary file... [D:\Linux\软件安装\fl2440文件\u-boot-s3c2440.bin]
Writing bin data into target memory @ 0x33F80000.
J-Link>setpc 0x33f80000
J-Link>g
J-Link>

安装securecrt通过串口的形式将文件下载进去

2.2.3.u-boot在SDPRAM中运行起来后,下载u-boot,Linux内核(包括根文件系统)烧录到Nandflash上去

(1) 前期环境准备

开发板通过网线直连,与pc机保持通信,建立开发板与pc机连接基础,即保证在同一网段区别无线网卡

[fl2440@lingyun]# pri                                
[fl2440@lingyun]# set ipaddr  192.168.10.1           
[fl2440@lingyun]# set serverip 192.168.10.8          
[fl2440@lingyun]# pri
...
ethaddr=00:11:22:33:44:55
ipaddr=192.168.10.1
serverip=192.168.10.8
...
[fl2440@lingyun]# ping 192.168.10.8
dm9000 i/o: 0x20000300, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 00:11:22:33:44:55
could not establish link
Using dm9000 device
host 192.168.10.8 is alive
(2) u-boot烧录
[fl2440@lingyun]# tftp 30008000 u-boot-s3c2440.bin   
dm9000 i/o: 0x20000300, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 00:11:22:33:44:55
could not establish link
Using dm9000 device
TFTP from server 192.168.10.8; our IP address is 192.168.10.1
Filename 'u-boot-s3c2440.bin'.
Load address: 0x30008000
Loading: ##########
done
Bytes transferred = 146324 (23b94 hex)
[fl2440@lingyun]# nand erase 0 100000

NAND erase: device 0 offset 0x0, size 0x100000
Erasing at 0xe0000 -- 100% complete.
OK
[fl2440@lingyun]# nand write 30008000 0 60000

NAND write: device 0 offset 0x0, size 0x60000
 393216 bytes written: OK
(3) linux系统烧录
[fl2440@lingyun]# tftp 30008000 linuxrom-s3c2440.bin
dm9000 i/o: 0x20000300, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 00:11:22:33:44:55
could not establish link
Using dm9000 device
TFTP from server 192.168.10.8; our IP address is 192.168.10.1
Filename 'linuxrom-s3c2440.bin'.
Load address: 0x30008000
Loading: #################################################################
         #################################################################
         ##########################################################
done
Bytes transferred = 2752308 (29ff34 hex)
[fl2440@lingyun]# nand erase 100000

NAND erase: device 0 offset 0x100000, size 0xff00000
Skipping bad block at  0x004c0000                                          
Skipping bad block at  0x0aa80000                                          
Skipping bad block at  0x0fae0000                                          
Erasing at 0xffe0000 -- 100% complete.
OK
[fl2440@lingyun]# nand write 30008000 100000 ${filesize}

NAND write: device 0 offset 0x100000, size 0x2a0000
 2752512 bytes written: OK
(4) 根文件系统烧录
[fl2440@lingyun]# tftp 30800000 rootfs-ubifs.bin
dm9000 i/o: 0x20000300, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 00:11:22:33:44:55
could not establish link
Using dm9000 device
TFTP from server 192.168.10.8; our IP address is 192.168.10.1
Filename 'rootfs-ubifs.bin'.
Load address: 0x30800000
Loading: T #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #########################################
done
Bytes transferred = 9175040 (8c0000 hex)
[fl2440@lingyun]# nand erase 1000000 4000000

NAND erase: device 0 offset 0x1000000, size 0x4000000
Erasing at 0x4fe0000 -- 100% complete.
OK
[fl2440@lingyun]# nand write 30800000 1000000 $filesize

NAND write: device 0 offset 0x1000000, size 0x8c0000
 9175040 bytes written: OK

4. 实验结果

重启开发板

[fl2440@lingyun]# reset
resetting ...


U-Boot 2010.09 (May 05 2017 - 19:48:28)

DRAM:  64 MiB
NAND:  256 MiB
*** Warning - bad CRC or NAND, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   dm9000
Hit any key to stop autoboot:  0 

NAND read: device 0 offset 0x100000, size 0x900000
Skipping bad block 0x004c0000
 9437184 bytes read: OK
## Booting kernel from Legacy Image at 30008000 ...
   Image Name:   Linux Kernel
   Created:      2017-06-19  22:03:17 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2752244 Bytes = 2.6 MiB
   Load Address: 30008000
   Entry Point:  30008040

...

g_serial gadget: g_serial ready
dm9000 dm9000.0: eth0: link down
dm9000 dm9000.0: eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1

Default Username: root   Password: 12345

WirelessRouter login: root
Password: 
~ >: ping 4.2.2.2
PING 4.2.2.2 (4.2.2.2): 56 data bytes
ping: sendto: Network is unreachable
~ >: ls
apps     dev      info     linuxrc  mnt      root     sys      var
bin      etc      init     logs     opt      sbin     tmp
data     home     lib      media    proc     stat     usr
~ >: 

开发板现象

S3C2440开发板烧录笔记_第3张图片
####理清注意点:

  • 开发板与PC之间的通信要满足计算机网络相关知识,能在统一网络之间相互通信
  • 弄清楚笔记本无线网卡、无线网卡、开发板的网卡之间的通信关系。
  • 下载文件途径,通过tftp下载方式的实现,和tftp文件上传下载目录的关系

  1. AMBA 总线和哈佛结构高速缓冲体系结构。这一结构具有独立的 16KB 指令高速缓存和 16KB 数据高速缓存。每个都是由具有 8 字长的行(line)组成。 ↩︎

你可能感兴趣的:(liunx开发学习笔记)