STM32
直播中

ronga245

12年用户 590经验值
私信 关注
[问答]

怎么使用stm32f429核心板去移植u-boot呢

怎么使用STM32f429核心板去移植u-boot呢?有哪些操作步骤?

回帖(1)

李博

2021-10-18 15:10:50
  秉火stm32f429移植u-boot的
  硬件平台个人文库:使用秉火stm32f429的核心板,搭配挑战者野火STM32的底板。
  MCU: stm329igt6,1MB的内部闪存,256KB RAM的。
  核心板: 8MB的外部SDRAM,IS42S16400J.16MB的外部SPI闪存,华邦25Q128FV。
  终端:使用USART1做为终端,波特率115200。
  移植参考模板:意法开发半导体公司的stm32板STM32F429-descovery。该开发板和秉火的STM32F429开发板资源非常类似,只需要修改和SDRAM的部分配置就可以了可以了。
  U-Boot的版本: u_boot-2016.09,该版本的u-boot已经支持stm32f429-descovery下载地址
  交叉compile-环境
  配置编译
  我使用的 CentOS 虚拟环境,使用 root 权限(非必要)
  在根目录下创建一个:mkdir stm32f429ig
  将上面下载的交叉编译器和U-Boot的源码放到这个目录下。
  解压交叉编译器GCC-臂无- EABI - 5_4-2016q3-20160926-linux.tar.bz2到的/ opt /目录下。
  焦油xjvf GCC -arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 -C /opt/
  [root@localhost stm32f429ig]# ls
  gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 u-boot-2016.09.tar.bz2
  [root@localhost stm32f429ig]# tar xjvf gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 -C /opt/
  在环境变量中加入该路径以方便调用。在.bashrc的最后一句加入export PATH=$PATH:/opt/gcc-arm-none-eabi-5_4-2016q3/bin
  vim ~/.bashrc
  # .bashrc
  # User specific aliases and functions
  alias rm=‘rm -i’
  alias cp=‘cp -i’
  alias mv=‘mv -i’
  # Source global definitions
  if [ -f /etc/bashrc ]; then
  。 /etc/bashrc
  fi
  export PATH=$PATH:/opt/gcc-arm-none-eabi-5_4-2016q3/bin
  source ~/.bashrc 使修改的环境变量立即生效。
  使用echo $PATH命令查看环境变量是否设置成功,使用 which arm-none-eabi-gcc 和 arm-none-eabi-gcc -v 命令查看交叉环境是否安装成功。
  [root@localhost stm32f429ig]# vim ~/.bashrc
  [root@localhost stm32f429ig]# source ~/.bashrc
  [root@localhost stm32f429ig]# echo $PATH
  /usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/***in:/usr/***in:/***in:/home/cj/bin:/opt/gcc-arm-none-eabi-5_4-2016q3/bin:/opt/gcc-arm-none-eabi-5_4-2016q3/bin
  [root@localhost stm32f429ig]# which arm-none-eabi-gcc
  /opt/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-gcc
  [root@localhost stm32f429ig]# arm-none-eabi-gcc -v
  Using built-in specs.
  COLLECT_GCC=arm-none-eabi-gcc
  COLLECT_LTO_WRAPPER=/opt/gcc-arm-none-eabi-5_4-2016q3/bin/。./lib/gcc/arm-none-eabi/5.4.1/lto-wrapper
  Target: arm-none-eabi
  Configured with: /home/build/work/GCC-5-build/src/gcc/configure --target=arm-none-eabi --prefix=/home/build/work/GCC-5-build/install-native --libexecdir=/home/build/work/GCC-5-build/install-native/lib --infodir=/home/build/work/GCC-5-build/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/home/build/work/GCC-5-build/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/home/build/work/GCC-5-build/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/build/work/GCC-5-build/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/build/work/GCC-5-build/install-native/arm-none-eabi --build=i686-linux-gnu --host=i686-linux-gnu --with-gmp=/home/build/work/GCC-5-build/build-native/host-libs/usr --with-mpfr=/home/build/work/GCC-5-build/build-native/host-libs/usr --with-mpc=/home/build/work/GCC-5-build/build-native/host-libs/usr --with-isl=/home/build/work/GCC-5-build/build-native/host-libs/usr --with-cloog=/home/build/work/GCC-5-build/build-native/host-libs/usr --with-libelf=/home/build/work/GCC-5-build/build-native/host-libs/usr --with-host-libstdcxx=‘-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm’ --with-pkgversion=‘GNU Tools for ARM Embedded Processors’ --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r,armv8-m.base,armv8-m.main
  Thread model: single
  gcc version 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496] (GNU Tools for ARM Embedded Processors)
  [root@localhost stm32f429ig]#
  yum install ncurses //不知道安装不是必须的,计算了保险
  yum install ncurses-devel //不安装的话make menuconfig出错
  yum install swig
  第二步:解压u-boot,测试环境
  解压u-boot:tar xjvf的u-boot-2016.09.tar.bz2
  进入的u-boot-2016.09目录下:CD的u-boot-2016.09.tar.bz2
  执行编译命令:
  化妆mrproper
  化妆stm32f429-discovery_defconfig
  make menuconfig后\不需要做任何修改
  使ARCH =arm CROSS_COMPILE=arm-none-eabi-
  [root@localhost stm32f429ig]# ls
  gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 u-boot-2016.09.tar.bz2
  u-boot-2016.09
  [root@localhost stm32f429ig]# cd u-boot-2016.09
  [root@localhost u-boot-2016.09]# make mrproper
  [root@localhost u-boot-2016.09]# make stm32f429-discovery_defconfig
  HOSTCC scripts/basic/fixdep
  HOSTCC scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC scripts/kconfig/zconf.tab.o
  HOSTLD scripts/kconfig/conf
  #
  # configuration written to .config
  #
  [root@localhost u-boot-2016.09]# make menuconfig
  HOSTCC scripts/kconfig/mconf.o
  HOSTCC scripts/kconfig/lxdialog/checklist.o
  HOSTCC scripts/kconfig/lxdialog/util.o
  HOSTCC scripts/kconfig/lxdialog/inputbox.o
  HOSTCC scripts/kconfig/lxdialog/textbox.o
  HOSTCC scripts/kconfig/lxdialog/yesno.o
  HOSTCC scripts/kconfig/lxdialog/menubox.o
  HOSTLD scripts/kconfig/mconf
  scripts/kconfig/mconf Kconfig
  *** End of the configuration.
  *** Execute ‘make’ to start the build or try ‘make help’。
  [root@localhost u-boot-2016.09]# make ARCH=arm CROSS_COMPILE=arm-none-eabi-
  scripts/kconfig/conf --silentoldconfig Kconfig
  CHK include/config.h
  UPD include/config.h
  。..
  CFG u-boot.cfg
  [root@localhost u-boot-2016.09]# ls
  api configs fs MAINTAINERS snapshot.commit u-boot.cfg
  arch disk include Makefile System.map u-boot.lds
  board doc Kbuild net test u-boot.map
  cmd drivers Kconfig post tools u-boot-nodtb.bin
  common dts lib README u-boot u-boot.srec
  config.mk examples Licenses scripts u-boot.bin u-boot.sym
  [root@localhost u-boot-2016.09]#
  如果你不幸没有顺利完成以上命令,请自行百度解决办法。
  第三步:修改的U-Boot以适应秉火stm32f429板开发
  展示进入的u-boot-2016.09目录
  修改。/include/configs/stm32f429-discovery.h,这个头文件定义了外部晶振的频率,stm32f429-discovery使用的是8MHZ的晶振,而坚持火stm32f429开发板使用的是25MHZ的晶振。
  [root@localhost u-boot-2016.09]# vim include/configs/stm32f429-discovery.h
  《stm32f429-discovery.h》
  #define CONFIG_STM32_SERIAL
  /* #define CONFIG_STM32_HSE_HZ 8000000 */
  #define CONFIG_STM32_HSE_HZ 25000000
  #define CONFIG_SYS_CLK_FREQ 180000000 /* 180 MHz */
  #define CONFIG_SYS_HZ_CLOCK 1000000 /* Timer is clocked at 1MHz */
  修改。/arch/arm/mach-stm32/stm32f4/clock.c,这个文件里定义了锁相环的参数。这些锁相环的参数可以使用ST公司提供的STM32CubeMX软件获得。
  
  将生成的u-boot.bin下载到秉火stm32f429开发板中就可以输出了。
  第四步:下载u-boot.bin到秉火stm32f429开发板,欣赏成果。
  下载工具: J-Link v9
  下载地址: 0x08000000
  启动配置: boot0,boot1接地,从内部flash启动。
  
  
  加载Linux未知,网络未功能配置,待续。。。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分