STM32F429-Discovery 编译 uclinux

STM32F429 Discovery 编译 uclinux

文章目录

  • 1. 环境要求
    • 1.1 硬件环境
    • 1.2 软件环境
  • 2. 安装交叉工具链
  • 3. 安装romfs工具
  • 4. stm32f429 linux download, build and install
    • 4.1 下载源码
    • 4.2 编译
  • 5. 烧写
    • 5.1 用STM32 ST-LINK Utility烧写工具烧写:
    • 5.2 serial connections.
    • 5.3 Terminal settings:
    • 5.4 Booting console output.
    • 5.5 lcd 显示如下:
  • 6.参考链接

1. 环境要求

1.1 硬件环境

  • STM32F429-Disc1 官方开发板
  • usb mini线
  • usb转串口线(TTL电平)

1.2 软件环境

  • Ubuntu 14.04 64位
  • STM32 ST-LINK Utility烧写工具

2. 安装交叉工具链

  • Download arm-2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu.tar.bz2 from Mentor Graphics
  • only arm-2010q1 is known to work; don’t use SourceryG++ arm-2011.03
tar jxvf arm-2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu.tar.bz2
export PATH=$PATH:`pwd`/arm-2010q1/bin

$ arm-uclinuxeabi-gcc -v 会遇到以下问题
arm-uclinuxeabi-gcc: No such file or directory
The toolchain commands are made by 32bit program, and need 32bit running environment.
(My host OS is ubuntu 64bit)

$ sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0

安装交叉工具链测试正常如下:

lisongze@lisongze-ubuntu14:~/stm32f429_uclinux/stm32f429-linux-builder$ arm-uclinuxeabi-gcc -v
Using built-in specs.
Target: arm-uclinuxeabi
Configured with: /scratch/julian/2010q1-release-uclinux-lite/src/gcc-4.4-2010q1/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-uclinuxeabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-gnu-as --with-gnu-ld --with-specs='%{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --disable-shared --disable-lto --with-pkgversion='Sourcery G++ Lite 2010q1-189' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-uclinuxeabi/libc --with-build-sysroot=/scratch/julian/2010q1-release-uclinux-lite/install/arm-uclinuxeabi/libc --with-gmp=/scratch/julian/2010q1-release-uclinux-lite/obj/host-libs-2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/julian/2010q1-release-uclinux-lite/obj/host-libs-2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu/usr --with-ppl=/scratch/julian/2010q1-release-uclinux-lite/obj/host-libs-2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-cloog=/scratch/julian/2010q1-release-uclinux-lite/obj/host-libs-2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/julian/2010q1-release-uclinux-lite/install/arm-uclinuxeabi/bin --with-build-time-tools=/scratch/julian/2010q1-release-uclinux-lite/install/arm-uclinuxeabi/bin
Thread model: single
gcc version 4.4.1 (Sourcery G++ Lite 2010q1-189) 

3. 安装romfs工具

$ sudo apt-get install genromfs

4. stm32f429 linux download, build and install

4.1 下载源码

$ git clone http://github.com/jserv/stm32f429-linux-builder

或者

$ git clone http://github.com/lisongze2016/stm32f429-linux-builder

4.2 编译

$ cd stm32f429-linux-builder
$ make
$ make install

5. 烧写

5.1 用STM32 ST-LINK Utility烧写工具烧写:

addr bin 编译生成路径
0x08000000 u-boot.bin out/uboot/u-boot.bin
0x08020000 xipuImage.bin out/kernel/arch/arm/boot/xipuImage.bin
0x08120000 romfs.bin out/romfs.bin

5.2 serial connections.

  • STM32 PC11 --> Cable connector Orange Txd(PC)
  • STM32 PC10 --> Cable connector Yellow Rxd(PC)

5.3 Terminal settings:

  • Baud rate: 115200
  • Data: 8 bit
  • Parity: none
  • Stop: 1 bit
  • Flow control: none

5.4 Booting console output.

U-Boot 2010.03-00003-g934021a (Feb 26 2020 - 22:18:29)

CPU  : STM32F4 (Cortex-M4)
Freqs: SYSCLK=180MHz,HCLK=180MHz,PCLK1=45MHz,PCLK2=90MHz
Board: STM32F429I-DISCOVERY board,Rev 1.0
DRAM:   8 MB
Using default environment

Hit any key to stop autoboot:  0 
## Booting kernel from Legacy Image at 08020000 ...
   Image Name:   Linux-2.6.33-arm1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    738336 Bytes = 721 kB
   Load Address: 08020040
   Entry Point:  08020041
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Linux version 2.6.33-arm1 (lisongze@lisongze-ubuntu14) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-189) ) #1 Wed Feb 26 23:16:15 CST 2020
CPU: ARMv7-M Processor [410fc241] revision 1 (ARMv7M)
CPU: NO data cache, NO instruction cache
Machine: STMicro STM32
Ignoring unrecognised tag 0x54410008
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 1778
Kernel command line: stm32_platform=stm32429-disco mem=7M console=ttyS2,115200n8 consoleblank=0 root=/dev/mtdblock0 rdinit=/sbin/init video=vfb:enable,fbmem:0x90700000,fbsize:0x100000
PID hash table entries: 32 (order: -5, 128 bytes)
Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 7MB = 7MB total
Memory: 6976k/6976k available, 192k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0x00000000 - 0x00001000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
    lowmem  : 0x90000000 - 0x90700000   (   7 MB)
    modules : 0x90000000 - 0x90800000   (   8 MB)
      .init : 0x9000a000 - 0x9000e000   (  16 kB)
      .text : 0x08028000 - 0x080c4000   ( 624 kB)
      .data : 0x90008000 - 0x90018460   (  66 kB)
Hierarchical RCU implementation.
NR_IRQS:90
Console: colour dummy device 80x30
Calibrating delay loop... 168.34 BogoMIPS (lpj=841728)
Mount-cache hash table entries: 512
bio: create slab <bio-0> at 0
Switching to clocksource cm3-systick
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered (default)
Console: switching to colour frame buffer device 60x53
fb0: Virtual frame buffer device, using 1024K of video memory
Serial: STM32 USART driver
stm32serial.2: ttyS2 at MMIO 0x40004800 (irq = 39) is a STM32 USART Port
console [ttyS2] enabled
brd: module loaded
uclinux[mtd]: ROM probe address=0x8120000 size=0x59000
Creating 1 MTD partitions on "ROM":
0x000000000000-0x000000059000 : "ROMfs"
ARMv7-M VFP Extension supported
VFS: Mounted root (romfs filesystem) readonly on device 31:0.
Freeing init memory: 16K
starting pid 27, tty '/dev/ttyS2': '/bin/login -f root'
Welcome to
          ____ _  _
         /  __| ||_|                 
    _   _| |  | | _ ____  _   _  _  _ 
   | | | | |  | || |  _ \| | | |\ \/ /
   | |_| | |__| || | | | | |_| |/    \
   |  ___\____|_||_|_| |_|\____|\_/\_/
   | |
   |_|

For further information check:
http://www.uclinux.org/

Jan  1 00:00:01 login[27]: root login on 'ttyS2'
~ # ls
bin        etc        proc       root       sys        usr
dev        lib        ramfs.img  sbin       tmp        var
~ #  date
Thu Jan  1 00:00:52 UTC 1970
~ # 

5.5 lcd 显示如下:

STM32F429-Discovery 编译 uclinux_第1张图片

6.参考链接

https://pantherpardus.blogspot.com/2016/04/stm32f429-discovery-on-uclinux.html

你可能感兴趣的:(Linux设备驱动)