U-Boot 1.3.4 (Jul 11 2018 - 10:53:57) for FS210
CPU: S5PV210@1000MHz(OK)
APLL = 1000MHz, HclkMsys = 200MHz, PclkMsys = 100MHz
MPLL = 667MHz, EPLL = 96MHz
HclkDsys = 166MHz, PclkDsys = 83MHz
HclkPsys = 133MHz, PclkPsys = 66MHz
SCLKA2M = 200MHz
Serial = CLKUART
Board: FS210
DRAM: 1 GB
Flash: 8 MB
SD/MMC: 3781MB
NAND: 1024 MB
In: serial
Out: serial
Err: serial
Enter into Normal mode
Hit any key to stop autoboot: 0 <==随便输入一个按键
FS210 # help ping
ping pingAddress
FS210 # help nand
nand info - show available NAND devices
nand device [dev] - show or set current device
nand read[.jffs2] - addr off|partition size
nand write[.jffs2] - addr off|partiton size - read/write `size' bytes starting
at offset `off' to/from memory address `addr'
nand write[.yaffs[1]] - addr off|partition size - write `size' byte yaffs image
starting at offset `off' from memory address `addr' (.yaffs1 for 512+16 NAND)
nand erase [clean] [off size] - erase `size' bytes from
offset `off' (entire device if not specified)
nand bad - show bad blocks
==============================================
可以通过sd启动(操作一次就可以)
通过uboot的网络tftp功能去烧录任何文件到nand: 包括uboot.bin , zImage , rootfs, 程序
D:\Arm编程-fs210_1804\实验及代码\2_th实验\FS210实验工具\Image\s5pv210_u-boot.bin ==> 放入到/tftpboot
设置参数:
FS210 # set serverip 192.168.7.3 // tftp服务器的ip--一般都是自己的Ubuntu ip
FS210 # set ipaddr 192.168.7.5 // 开发板子ip: ubuntu + 60
FS210 # set ethaddr 00:23:45:ee:ea:ef // 设置成唯一
FS210 # save
下载uboot:
FS210 # tftp 0x40008000 u-boot.bin //加载到DDR中
FS210 # nand erase 0x0 0x100000 //将nandflush的0x00到0x100000全部搽除
FS210 # nand write 0x40008000 0x0 0x100000 //将u-boot.bin拷贝到nandflush
可以用一条指令完成:
tftp 0x40008000 u-boot.bin ; nand erase 0x0 0x100000 ; nand write 0x40008000 0x0 0x100000
====================================================================
切换到nand启动: 启动我自己写代码:
设置参数:
FS210 # set serverip 192.168.7.3 // tftp服务器的ip--一般都是自己的Ubuntu ip
FS210 # set ipaddr 192.168.7.5 // 开发板子ip: ubuntu + 60
FS210 # set ethaddr 00:23:45:ee:ea:ef // 设置成唯一
FS210 # save
D:\Arm编程-fs210_1804\实验及代码\2_th实验\FS210实验工具\ledc.bin==> 放入到/tftpboot
FS210 # tftp 0x40008000 ledc.bin
FS210 # go 0x40008000
可以用一条指令完成:
tftp 0x40008000 ledc.bin; go 0x40008000
=========================================================================
先看原理图-->芯片手册 -->(gcc + Makefile + vim) 编写代码(asm代码)-->编译成二进制文件.bin-->运行
D:\Arm编程-fs210_1804\S5PV210数据手册及原理图\原理图
led1----GPC0_3----soc
s5pv210 gpio:
1, 237个多功能引脚, 142个存储引脚,分成34个组管多功能引脚,2个组管存储引脚
2, GPA0表示一个组,管理8个引脚
GPA0_0 ---> GPA0_7
GPA1 表示一个组,管理4个引脚
GPA1_0 ---> GPA1_3
3, 寄存器控制都是以组为单位
4,正常模式下有:
GPA0CON, 配置寄存器:输入,输出,特殊功能
GPA0DAT, 数据寄存器:设定高低电平
GPA0PUD, 内部上拉或下拉寄存器
GPA0DRV,驱动增加
led的控制寄存器:
GPC0CON, R/W, Address = 0xE0200060
GPC0_3配置成输出:
GPC0CON[15:12] = 0001;
点/灭灯:
GPC0DAT, R/W, Address = 0xE0200064
GPC0DAT[3] |= 1<<3; //输出高电平---亮
GPC0DAT[3] &= ~1<<3; //输出低电平---灭
===================================================================
写代码:start.S
.text
.global _start
_start:
/* config gpc0 as output */
ldr r0, =0xE0200060
ldr r1, [r0]
bic r1, r1, #(0xf<<12)
orr r1, r1, #(0x1<<12)
str r1, [r0]
/*output 1*/
ldr r0, =0xE0200064
ldr r1, [r0]
orr r1, r1, #(1<<3)
str r1, [r0]
loop:
b loop
===================================================================================
编译的时候需要arm编译器(交叉工具链)--如果你们的Ubuntu中已经交叉工具链,那么可以不做:
如何测试是否有交叉工具链:
arm-none-linux-gnueabi-gcc -v
如果没有,就按照如下步骤去操作:
D:\Arm编程-fs210_1804\实验及代码\2_th实验\开发环境搭建\交叉工具链\toolchain-4.5.1-farsight.tar.bz2
sudo mkdir /usr/local/arm
sudo chmod 777 /usr/local/arm/ -R
将交叉工具链的路径放入到path:
vim ~/.bashrc //最后一行添加
export PATH=$PATH:/usr/local/arm/toolchain-4.5.1-farsight/bin
保存退出后,更新脚本:
source ~/.bashrc
===================================================================================
编译:
arm-none-linux-gnueabi-gcc -c start.S -o start.o
arm-none-linux-gnueabi-ld -Ttext 0x40008000 start.o -o led_asm.elf //连接成目标文件
arm-none-linux-gnueabi-objcopy -O binary led_asm.elf ledasm.bin //将elf头去掉,得到可以通过pc直接运行二进制文件
arm-none-linux-gnueabi-objdump -D led_asm.elf > led.dis //得到反汇编文件
编写Makefile
ledasm.bin : start.S
arm-none-linux-gnueabi-gcc -c start.S -o start.o
arm-none-linux-gnueabi-ld -Ttext 0x40008000 start.o -o led_asm.elf
arm-none-linux-gnueabi-objcopy -O binary led_asm.elf ledasm.bin
arm-none-linux-gnueabi-objdump -D led_asm.elf > led.dis
clean:
rm -rf *.o *.elf *.dis *.bin
install:
cp -raf *.bin /tftpboot
uboot操作:
tftp 0x40008000 ledasm.bin; go 0x40008000 //在程序运行时地址需要与-Ttext 0x40008000中的地址一致不然可能会出现寻址错误 详细:http://blog.csdn.net/happinux/article/details/5800996
.text
.global _start
_start:
/* config gpc0 as output */
ldr r0, =0xE0200060
ldr r1, [r0]
bic r1, r1, #(0xf<<12)
orr r1, r1, #(0x1<<12)
str r1, [r0]
lightloop:
/*output 1*/
ldr r0, =0xE0200064
ldr r1, [r0]
orr r1, r1, #(1<<3)
str r1, [r0]
bl delay
ldr r0, =0xE0200064
ldr r1, [r0]
bic r1, r1, #(1<<3)
str r1, [r0]
bl delay
b lightloop
loop:
b loop
delay:
ldr r6, =0x100000
delayloop:
subs r6, r6,#1
bne delayloop
mov pc, lr