|
硬件:百为STM3210E-EVAL开发板
软件:vmware6.5.2 + ubuntu8.04
一、安装codesourcery交叉编译器
root@xiliang-desktop:~# cp /mnt/hgfs/share/arm-2009q1-163-arm-uclinuxeabi.bin /home/stm32/
root@xiliang-desktop:~# cd /home/stm32/
root@xiliang-desktop:/home/stm32# ./arm-2009q1-163-arm-uclinuxeabi.bin
The installer has detected that your system uses the dash shell
as /bin/sh. This shell is not supported by the installer.
You can work around this problem by changing /bin/sh to be a
symbolic link to a supported shell such as bash. Please refer
to the Getting Started guide, or contact CodeSourcery Support
for assistance.
这里出现错误,提示说默认的shell是dash shell,而安装.bin要在bash shell下面执行。所以执行下面命令把dash shell取消默认。在弹出的对话框里选择NO。
root@xiliang-desktop:/home/stm32# sudo dpkg-reconfigure dash
然后再重新执行安装
root@xiliang-desktop:/home/stm32# ./arm-2009q1-163-arm-uclinuxeabi.bin
在弹出的对话框里按默认设置一直点next安装就可以了,当然license要agree了。
默认是安装到/root/CodeSourcery/Sourcery_G++_Lite路径,并配置好环境变量。
二、编译uclinux内核
1、复制并解压内核到工作目录下
root@xiliang-desktop:/home/stm32# cp /mnt/hgfs/share/uClinux-dist.tar.gz /home/stm32
root@xiliang-desktop:/home/stm32# tar xvzf uClinux-dist.tar.gz
2、配置uclinux内核
root@xiliang-desktop:/home/stm32/uClinux-dist# make menuconfig
在弹出的对话框里选择厂商和型号
选择stmicroelectronics
选择STM3210E-EVAL
选择后点exit退出,保存.config配置文件
出现下面信息表示配置完成
config/mkconfig > Kconfig
/home/stm32/uClinux-dist/config/kconfig/mconf Kconfig
#
# configuration written to .config
#
*** End of Linux kernel configuration.
*** Execute 'make' to build the kernel or try 'make help'.
3、编译内核
root@xiliang-desktop:/home/stm32/uClinux-dist# make
编译完成后,生成xipImage.bin,rootfs.img.bin ,logo.bin这三个文件,并被自动复制到/home/stm32/uClinux-dist/images目录下:
4、制作DFU文件
首先在WIN上安装DFU软件,然后打开软件DFUse->DFU File Manager
选择I want to GENERATE,设置vendor ID,product ID,version,Target如图:
选择Multi BIN在弹出的对话框里把刚编译生成的image文件逐一添加进来,制作DFU文件
address填64000000,打开xipImage.bin,并add to list
address填64100000,打开rootfs.img.bin,并add to list
address填64160000,打开logo.bin,并add to list
点OK确定
然后点generate生成.dfu文件,保存就可以了
三、下载程序到STM32开发板上
烧写bootloader到STM32内部FLASH,按照我们提供的DFU烧写文档把DFU文件烧写进STM32外部NOR FLASH。然后上电运行程序。
运行信息(注意串口波特率为19200)
platform Initialisation finished jumping to kernel.
Linux version 2.6.26-uc0 (root@xiliang-desktop) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-163) ) #1 Thu May 19 07:11:13 PDT 2011
CPU: ARMv7-M Processor [411fc231] revision 1 (ARMv?(11)M)
Machine: STM3210E-EVAL
SRAM Config: bank[0] @ 0x68000000 (size: 1024KB) - bank[1] @ 0x20000000 (size: 64KB).
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 254
Kernel command line: noinitrd root=mtd1 ro rootfstype=jffs2 init=/linuxrc console=ttyS0
PID hash table entries: 16 (order: 4, 64 bytes)
console [ttyS0] enabled
Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 1MB 0MB = 1MB total
Memory: 980KB available (436K code, 55K data, 8K init)
Mount-cache hash table entries: 512
JFFS2 version 2.2. 漏 2001-2006 Red Hat, Inc.
simple-gpio: now handling 16 GPIOs: 0 - 15
ttyS0 at MMIO 0x40013800 (irq = 37) is a STM32 USART1 Port
Probed and found the STM3210E-EVAL NOR flash chip
Creating 4 MTD partitions on "M29W128F NOR FLASH":
0x00000000-0x00100000 : "Kernel raw data"
0x00100000-0x00160000 : "rootfs"
0x00160000-0x00190000 : "rawdata"
0x00190000-0x001c0000 : "cramfs_partition"
rtc-stm3210e_eval rtc-stm3210e_eval.0: rtc core: registered rtc-stm3210e_eval as rtc0
rtc-stm3210e_eval rtc-stm3210e_eval.0: setting system clock to 1970-01-01 00:00:00 UTC (0)
VFS: Mounted root (jffs2 filesystem) readonly.
Freeing init memory: 8K
Mounting proc fs
Mounting sysfs
Welcome to
____ _ _
/ __| ||_|
_ _| | | | _ ___ _ _ _ _
| | | | | | || | _ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/ \
| ___ \____|_||_|_| |_|\____|\_/\_/
| |
|_|
For further information check:
http://www.uclinux.org/
http://www.st.com/stm32
/ # ls
bin etc lib mnt root sys
dev home linuxrc proc sbin usr
/ # cd /bin
/bin # ls
Led_Show busybox df hush mknod rmdir
ShowLogo cat dmesg hwclock mount sh
Splash chmod echo kill mv test
Toggle_gpio clear false ln ps true
[ cp free ls pwd umount
[[ date hello_world mkdir rm uname
/bin # ./hello_world
hello world.
/bin # ./Led_Show
uclinux启动后LCD上会显示uclinux LOGO
另外cramfs也出弄了个uclinux,u-boot应该也可以在这板上跑了,等有空试试
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
阿莫论坛20周年了!感谢大家的支持与爱护!!
月入3000的是反美的。收入3万是亲美的。收入30万是移民美国的。收入300万是取得绿卡后回国,教唆那些3000来反美的!
|