搜索
bottom↓
回复: 44

移植uClinux到百为STM32开发板

  [复制链接]

出0入0汤圆

发表于 2013-10-25 11:27:07 | 显示全部楼层 |阅读模式
硬件:百为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来反美的!

出0入0汤圆

发表于 2013-10-25 11:44:48 | 显示全部楼层
好厉害,大牛。

出0入0汤圆

发表于 2013-10-25 14:48:03 | 显示全部楼层
顶起      

出0入0汤圆

发表于 2013-10-25 14:58:18 | 显示全部楼层
顶起 楼主。

出0入0汤圆

 楼主| 发表于 2013-10-25 15:38:27 | 显示全部楼层
lans0625 发表于 2013-10-25 14:58
顶起 楼主。

出0入0汤圆

发表于 2013-10-25 16:45:18 | 显示全部楼层
帮顶。
厉害。

出0入0汤圆

发表于 2013-10-25 16:54:09 | 显示全部楼层
顶  厉害  膜拜

出0入0汤圆

发表于 2013-10-25 20:30:10 来自手机 | 显示全部楼层
五体投地,大神

出0入0汤圆

发表于 2013-10-27 20:41:08 | 显示全部楼层
顶起。
uCLinux应该是429的肉了,在其他STM32上运行都有最大的问题:内存不够,现在429带SDRAM控制器,这是uCLinux发挥的时候了。

出0入0汤圆

发表于 2013-10-27 22:20:52 | 显示全部楼层
好历害!

出0入0汤圆

发表于 2013-10-27 22:29:52 | 显示全部楼层
好牛的楼主,顶你

出0入0汤圆

发表于 2013-10-27 22:36:01 | 显示全部楼层
楼主真NB

出100入101汤圆

发表于 2013-10-27 23:23:11 | 显示全部楼层
本帖最后由 fengyunyu 于 2013-10-27 23:24 编辑

请教lz,可以跑uclinux,那是否可以基于此硬件平台,学习linux的驱动程序设计?

出0入0汤圆

 楼主| 发表于 2013-10-30 10:00:11 | 显示全部楼层
fengyunyu 发表于 2013-10-27 23:23
请教lz,可以跑uclinux,那是否可以基于此硬件平台,学习linux的驱动程序设计? ...

这个拿来玩玩,调试uclinux内核,驱动,是可以的。不过实用性不大,实际应用可以考虑LPC1788+uclinux

出100入101汤圆

发表于 2013-10-30 10:04:39 | 显示全部楼层
xi_liang 发表于 2013-10-30 10:00
这个拿来玩玩,调试uclinux内核,驱动,是可以的。不过实用性不大,实际应用可以考虑LPC1788+uclinux ...

请问uclinux能用jlink仿真么?

出0入0汤圆

 楼主| 发表于 2013-10-30 10:58:28 | 显示全部楼层
fengyunyu 发表于 2013-10-30 10:04
请问uclinux能用jlink仿真么?

调试内核用printf

出100入101汤圆

发表于 2013-11-6 10:11:16 | 显示全部楼层
xi_liang 发表于 2013-10-30 10:58
调试内核用printf

能用gdb调试么?

出0入0汤圆

发表于 2013-11-6 19:06:59 | 显示全部楼层
强大,学习了!

出0入0汤圆

发表于 2013-12-20 11:19:07 | 显示全部楼层
配置内核时提示如下:请问如何解决
root@desktop:/home/note/Share/uClinux-dist# make menuconfig
config/mkconfig > Kconfig
CC=cc CXX=c++ make -C /home/note/Share/uClinux-dist/config/kconfig conf
make[1]: Entering directory `/home/note/Share/uClinux-dist/config/kconfig'
cc -DCURSES_LOC="<curses.h>"   -c -o conf.o conf.c
cc -DCURSES_LOC="<curses.h>"   -c -o zconf.tab.o zconf.tab.c
cc   conf.o zconf.tab.o   -o conf
make[1]: Leaving directory `/home/note/Share/uClinux-dist/config/kconfig'
CC=cc CXX=c++ make -C /home/note/Share/uClinux-dist/config/kconfig mconf
make[1]: Entering directory `/home/note/Share/uClinux-dist/config/kconfig'
cc -DCURSES_LOC="<curses.h>"   -c -o mconf.o mconf.c
In file included from mconf.c:27:
lxdialog/dialog.h:32:20: error: curses.h: No such file or directory
In file included from mconf.c:27:
lxdialog/dialog.h:97: error: expected specifier-qualifier-list before ‘chtype’
lxdialog/dialog.h:187: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:193: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:195: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:196: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:197: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:198: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:200: error: expected ‘)’ before ‘*’ token
mconf.c: In function ‘conf’:
mconf.c:610: error: ‘KEY_MAX’ undeclared (first use in this function)
mconf.c:610: error: (Each undeclared identifier is reported only once
mconf.c:610: error: for each function it appears in.)
mconf.c: In function ‘conf_choice’:
mconf.c:761: error: ‘KEY_MAX’ undeclared (first use in this function)
make[1]: *** [mconf.o] Error 1
make[1]: Leaving directory `/home/note/Share/uClinux-dist/config/kconfig'
make: *** [/home/note/Share/uClinux-dist/config/kconfig/mconf] Error 2
root@desktop:/home/note/Share/uClinux-dist#

出0入0汤圆

 楼主| 发表于 2013-12-20 12:11:11 | 显示全部楼层
这个是ubuntu上缺少了些软件包,安装一下就可以了
#apt-get install libncurses5-dev

出0入0汤圆

发表于 2013-12-20 23:32:56 | 显示全部楼层
好强大啊。。。。。

出0入0汤圆

 楼主| 发表于 2013-12-21 13:15:58 | 显示全部楼层
wazhiyi 发表于 2013-12-20 23:32
好强大啊。。。。。

出0入0汤圆

发表于 2013-12-22 09:46:13 | 显示全部楼层
Mark!1!!!好厉害,有时间再来研究uclinux

出0入0汤圆

发表于 2013-12-22 09:46:31 | 显示全部楼层
Mark!1!!!好厉害,有时间再来研究uclinux

出0入0汤圆

发表于 2013-12-23 14:48:54 | 显示全部楼层
顶了,在dsp和2440上都移植过,有空玩玩stm32的

出0入0汤圆

 楼主| 发表于 2014-1-20 23:39:18 | 显示全部楼层
明日有明月 发表于 2013-12-23 14:48
顶了,在dsp和2440上都移植过,有空玩玩stm32的

2440上linux更加好玩一点

出0入0汤圆

发表于 2014-3-17 00:41:26 | 显示全部楼层
arm-2009q1-163-arm-uclinuxeabi.bin

这个 哪里下载的 楼主 把你的资源共享一下 新手不知道怎么找资料
1. GUN编译工具
2. uClinux 内核文件
3. 支持STM32开发的一些文件

需要这个三个文件的吧 楼主有的话 希望共享一下
谢谢了

出0入0汤圆

发表于 2014-3-17 00:42:42 | 显示全部楼层
bruce_helen 发表于 2013-10-27 20:41
顶起。
uCLinux应该是429的肉了,在其他STM32上运行都有最大的问题:内存不够,现在429带SDRAM控制器,这是 ...

什么 429 请指点

出0入0汤圆

发表于 2014-3-17 02:31:50 | 显示全部楼层
http://www.kanebebe.com/download/ARM7uClinux/index.html   

出0入0汤圆

发表于 2014-3-17 02:50:09 | 显示全部楼层
我的是 unbuntu 13.10 的 版本最新的 可能存在不兼容的问题不

出0入0汤圆

发表于 2014-3-17 03:31:01 | 显示全部楼层
root@xiliang-desktop:/home/stm32# ./arm-2009q1-163-arm-uclinuxeabi.bin   提示没有这个文件或者目录

出0入0汤圆

发表于 2014-3-17 03:44:22 | 显示全部楼层
https://sourcery.mentor.com/down ... none-linux-gnueabi/

出0入0汤圆

发表于 2014-3-17 06:03:43 | 显示全部楼层
本帖最后由 闷鱼 于 2014-3-17 06:32 编辑

楼主 你好

我的系统是 unbuntu 13.10 的

安装了 arm-2013.05-24-arm-none-linux-gnueabi.bin  和 uClinux-dist-20121024.tar.bz2

我在选择厂商和芯片型号的时候 看不到 STMircroelectronics  这是怎么回事  

我没有链接开发板

必须连接了开发板才可以看到这个选项么  谢谢


出0入17汤圆

发表于 2014-3-17 20:35:24 | 显示全部楼层
顶  厉害  膜拜

出0入0汤圆

 楼主| 发表于 2014-3-17 22:28:24 | 显示全部楼层
闷鱼 发表于 2014-3-17 06:03
楼主 你好

我的系统是 unbuntu 13.10 的

源码问题,uClinux-dist-20121024.tar.bz2这个源码可能没有支持STM32吧。我们用的是打上STM32 patch的

出0入0汤圆

发表于 2014-3-18 14:22:20 | 显示全部楼层
xi_liang 发表于 2014-3-17 22:28
源码问题,uClinux-dist-20121024.tar.bz2这个源码可能没有支持STM32吧。我们用的是打上STM32 patch的 ...

我也感觉是这里的问题

出于这个考虑  而且你又有成功的例子  

能否方便把你的tar 和 path 文件传我下  麻烦了  

非常感谢

出0入0汤圆

发表于 2014-3-18 14:58:42 | 显示全部楼层
xi_liang 发表于 2014-3-17 22:28
源码问题,uClinux-dist-20121024.tar.bz2这个源码可能没有支持STM32吧。我们用的是打上STM32 patch的 ...

执行 #zcat uClinux-dist-20080808-20090112.path.gz | patch p1 之后

patching file p1
The next patch would create the file p1
which already exists! Assume -R?[n] __

我选择了 n

接下来 提示
Apply anyway? [n]__

选择 y  回车

又重复提示

The next patch would create the file p1
which already exists! Assume -R?[n] __


这怎么处理

出0入0汤圆

发表于 2014-3-18 20:09:33 | 显示全部楼层
内核版本 最新的 uclinux 是不是不支持   

出0入0汤圆

发表于 2014-3-18 22:47:10 | 显示全部楼层
本帖最后由 闷鱼 于 2014-3-18 22:48 编辑
xi_liang 发表于 2014-3-17 22:28
源码问题,uClinux-dist-20121024.tar.bz2这个源码可能没有支持STM32吧。我们用的是打上STM32 patch的 ...


打补丁的时候  一直这样 是怎么回事啊


patching file p1
The next patch would create the file p1
which already exists! Assume -R?[n] __

我选择了 y

接下来 提示
Apply anyway? [n]__

选择 y  回车

又重复提示

The next patch would create the file p1
which already exists! Assume -R?[n] __

http://www.amobbs.com/forum.php? ... p;page=1#pid7393892

这个是我 新开的 求助帖 麻烦您给看看

出0入0汤圆

发表于 2014-5-4 16:08:16 | 显示全部楼层
不错,可惜我没移植上去,板子的flash是外置spi接口,不知怎么配置了

出0入0汤圆

发表于 2014-5-8 20:30:58 | 显示全部楼层
这个不需要打补丁吗? 什么我下载的Uclinux  在make menuconfig的hi后没有 Vendor/Production Select 这个选项呢?

出0入0汤圆

 楼主| 发表于 2014-5-8 20:58:22 | 显示全部楼层
浮华一生 发表于 2014-5-8 20:30
这个不需要打补丁吗? 什么我下载的Uclinux  在make menuconfig的hi后没有 Vendor/Production Select 这个 ...

我们弄的打完那个补丁有这个选项的,需要的话可以购买我们开发板

出0入0汤圆

 楼主| 发表于 2014-6-26 17:43:25 | 显示全部楼层
顶起来。。。。。。

出0入0汤圆

发表于 2015-3-21 11:06:38 | 显示全部楼层
玩具级的,没有任何商用价值的平台,建议直接上ARM9+linux

出0入0汤圆

发表于 2015-8-27 23:28:12 | 显示全部楼层
ucLinux的API基本上与Linux相同,这样是否意味着Linux下开发的C应用程序可以用在ucLinux上?
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-4-26 08:13

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表