标签:samsung s3c2440 arm linux 开发板 上手初体验 --开发环境搭建
1,linux开发环境搭建
2,程序测试
easyOpentag驱动安装,打开连接,选择ARM-linux
链接:http://pan.baidu.com/s/1pJKK4w7 密码:a0re
1,环境搭建
我的系统版本 root@ubuntu:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS Release: 14.04 Codename: trusty root@ubuntu:~# 我使用的mirros root@ubuntu:~# cat /etc/apt/sources.list deb http://mirrors.zju.edu.cn/ubuntu trusty main universe restricted multiverse deb http://mirrors.zju.edu.cn/ubuntu trusty-security main universe restricted multiverse deb http://mirrors.zju.edu.cn/ubuntu trusty-updates main universe restricted multiverse deb http://mirrors.zju.edu.cn/ubuntu trusty-backports main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu trusty main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu trusty-security main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu trusty-updates main universe restricted multiverse deb-src http://mirrors.zju.edu.cn/ubuntu trusty-backports main universe restricted multiverse 安装基本开发包 root@ubuntu:~# apt-get update && apt-get install -y build-essential bison flex manpages-dev root@ubuntu:~# echo $? 0 安装 arm-linux-gcc 解压 arm-linux-gcc-3.4.5-glibc-2.3.6.tar.bz2 来自韦东山教学光盘 tar xf arm-linux-gcc-3.4.5-glibc-2.3.6.tar.bz2 安装 sudo apt-get install lsb-core 否则可能出现No such file or directory root@ubuntu:~/leds# arm-linux-objcopy bash: /home/chunli/gcc-3.4.5-glibc-2.3.6/bin/arm-linux-objcopy: No such file or directory 更改系统PATH chunli@ubuntu:~$ sudo vim /home/chunli/.bashrc export PATH=$PATH::/home/chunli/gcc-3.4.5-glibc-2.3.6/bin/ 看看我的系统 编译环境搭建好了 chunli@ubuntu:~$ arm-linux-gcc -v Reading specs from /home/chunli/gcc-3.4.5-glibc-2.3.6/bin/../lib/gcc/arm-linux/3.4.5/specs Configured with: /work/tools/create_crosstools/crosstool-0.43/build/arm-linux/gcc-3.4.5-glibc-2.3.6/gcc-3.4.5/configure --target=arm-linux --host=i686-host_pc-linux-gnu --prefix=/work/tools/gcc-3.4.5-glibc-2.3.6 --with-float=soft --with-headers=/work/tools/gcc-3.4.5-glibc-2.3.6/arm-linux/include --with-local-prefix=/work/tools/gcc-3.4.5-glibc-2.3.6/arm-linux --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long Thread model: posix gcc version 3.4.5 chunli@ubuntu:~$
编写一个点亮LED的程序:
写一个点亮JZ2440开发板的一个汇编小程序
JZ2440开发板:
从JZ2440v2_sch.pdf中可以看出
nLED_2 上拉到3.3V
nLED_2 另一脚是接在GPF5 这个IO功能引脚上
查S3C2440官方手册
GPFCON 的地址是 0x56000050 ,此寄存器的值设为 0x00000400 配置GPF5这个引脚为输出
GPFDAT 的地址是 0x56000054 控制GPF5输出低电平
chunli@ubuntu:~/hardware$ mkdir my chunli@ubuntu:~/hardware$ cd my/ chunli@ubuntu:~/hardware/my$ vim led_on.S @****************************************************************************** @ File:led_on.S @ 功能:LED点灯程序,点亮LED1 @****************************************************************************** .text .global _start _start: LDR R0,=0x56000050 @ R0设为GPBCON寄存器。此寄存器用于选择各引脚的功能:是输出、是输入、还是其他 MOV R1,#0x00000400 @ 设置为输出引脚 STR R1,[R0] @ 设置GPF5为输出口, 位[10:9]=0b01 LDR R0,=0x56000054 @ R0设为GPBDAT寄存器。此寄存器用于读/写端口B各引脚的数据 MOV R1,#0x00000000 @ 此值改为0xFFFFFFFF, 可让LED2熄灭 STR R1,[R0] @ GPB5输出0,LED1点亮 MAIN_LOOP: B MAIN_LOOP 编写Makefile文件 chunli@ubuntu:~/hardware/my$ vim Makefile led_on.bin : led_on.S arm-linux-gcc -g -c -o led_on.o led_on.S arm-linux-ld -Ttext 0x0000000 -g led_on.o -o led_on_elf arm-linux-objcopy -O binary -S led_on_elf led_on.bin clean: rm -f led_on.bin led_on_elf *.o 编译 chunli@ubuntu:~/hardware/my$ make arm-linux-gcc -g -c -o led_on.o led_on.S arm-linux-ld -Ttext 0x0000000 -g led_on.o -o led_on_elf arm-linux-objcopy -O binary -S led_on_elf led_on.bin 没有报错 chunli@ubuntu:~/hardware/my$ echo $? 0 chunli@ubuntu:~/hardware/my$ ll -rwxrwxr-x 1 chunli chunli 36 Apr 12 22:20 led_on.bin* -rwxrwxr-x 1 chunli chunli 34144 Apr 12 22:20 led_on_elf* -rw-rw-r-- 1 chunli chunli 1412 Apr 12 22:20 led_on.o -rw-rw-r-- 1 chunli chunli 1035 Apr 12 22:19 led_on.S -rw-rw-r-- 1 chunli chunli 218 Apr 12 22:20 Makefile
把led_on.bin程序传到Windows平台,
FTD2XX.dll
oflash.exe
led_on.bin
放在一起就可以
运行oflash.exe小程序, D:\ARM 嵌入式Linux\my>oflash.exe +---------------------------------------------------------+ | Flash Programmer v1.3 for OpenJTAG of www.100ask.net | | OpenJTAG is a USB to JTAG & RS232 tool based FT2232 | | This programmer supports both of S3C24X0 & S3C6410 | | Author: Email/MSN(thisway.diy@163.com), QQ(17653039) | +---------------------------------------------------------+ Usage: 1. oflash, run with cfg.txt or prompt 2. oflash [file], write [file] to flash with prompt 3. oflash [-f config_file] 4. oflash [jtag_type] [cpu_type] [flash_type] [read_or_write] [offset] [file] Can‘t open cfg.txt, you should follow the prompt Select the JTAG type: 0. OpenJTAG 1. Dongle JTAG(parallel port) 2. Wiggler JTAG(parallel port) Enter the number: 0 Select the CPU: 0. S3C2410 1. S3C2440 2. S3C6410 Enter the number: 1 device: 4 "2232C" deviceID: 0x14575118 SerialNumber: FTSht3gzA Description: USB<=>JTAG&RS232 AS3C2440 detected, cpuID = 0x0032409d [Main Menu] 0:Nand Flash prog 1:Nor Flash prog 2:Memory Rd/Wr 3:Exit Select the function to test:0 Enter the file name: led_on.bin [NAND Flash JTAG Programmer] Scan nand flash: Device 0: NAND 256MiB 3,3V 8-bit, sector size 128 KiB Total size: 256 MiB 0:Nand Flash Program 1:Nand Flash Print BlkPage 2:Exit Select the function to test :0 [NAND Flash Writing Program] Source size: 0x24 Available target block number: 0~2047 Input target block number:0 target start block number =0 target size (0x20000*1) =0x20000 STATUS: Ep D:\ARM 嵌入式Linux\my> 等5秒,开发板的小灯亮起
本文出自 “魂斗罗” 博客,请务必保留此出处http://990487026.blog.51cto.com/10133282/1763228
SAMSUNG S3C2440 ARM LINUX 开发板 上手初体验 --开发环境搭建
标签:samsung s3c2440 arm linux 开发板 上手初体验 --开发环境搭建
原文地址:http://990487026.blog.51cto.com/10133282/1763228