野火 STM32MP157 开发板 UBOOT 编译烧写

一、环境

编译环境:Ubuntu 版本:20.4.1
交叉编译工具:arm-none-eabi-gcc 版本:10.3.1
开发板:STM32MP157 pro
烧写软件:STM32CubeProgrammer

二、下载UBoot源码

GitHub仓库:https://github.com/Embedfire/ebf_linux_uboot

注意: STM32MP157 源码对应的是 ebf_v2018.11_star 分支

三、编译UBoot

编译相对比较简单,源码的README.md文件中存项详细的说明,如下所示:

  1. 安装编译需要的工具:

    sudo apt install make gcc-arm-none-eabi gcc bison flex libssl-dev dpkg-dev lzop libncurses5-dev libncursesw5-dev
    
  2. 进入工程路径

    cd ebf_linux_uboot
    
  3. 清除工程

    make clean
    
  4. 配置

    make stm32mp15_trusted_defconfig
    
  5. 开始编译

    make CROSS_COMPILE=arm-none-eabi- DEVICE_TREE=stm32mp157a-star all
    

    注意: 如果GCC版本过高可能出现 error:multiple definition of 'yylloc'错误,解决办法见后面笔记

  6. 编译完成
    编译完成后会生成 u-boot.stm32 文件

四、烧写UBoot

保险操作,将 STM32CubeProgrammer 工程拷贝一份到桌面,在进行操作,不会使用 STM32CubeProgrammer 烧写的见野火教程:https://doc.embedfire.com/linux/stm32mp1/quick_start_guide/zh/latest/quick_start/install_debian/install_debian.html

  1. 将编译生成的 u-boot.stm32 直接把工程文件中的替换,如下图所示:

    注意:也可更改 flashlayout 文件下的 .tsv文件

  2. 烧写文件

五、编译问题

  1. error:multiple definition of `yylloc'

    解决办法:

    vim ./scripts/dtc/dtc-parser.tab.c 
    

    注释 yylloc 定义 ,如下图所示:

    注意: 更改后不能清空项目在执行,否则更改会失效

参考文献

IMX6ULL学习笔记——获取和编译U-Boot:http://it.cha138.com/nginx/show-302415.html
Ubuntu21.10 编译uboot 出错 `yylloc'解决方法:https://zhuanlan.zhihu.com/p/432591735

posted @ 2022-11-01 16:07  浇筑菜鸟  阅读(719)  评论(0)    收藏  举报