zoukankan      html  css  js  c++  java
  • zynq生成boot.bin的批处理...方便啊!

    在xilinx的SDK下生成boot.bin的过程,有时非常让人恼火...

    得手动选几个文件xx.fsbl, xx.bit, xx.elf.....选来选去的非常麻烦,

    而且SDK还常常Browse时...还不指定在当前工程目录下...

    所以,我一怒之下,想写个批处理...没有写出来...拖延症严重.. *_*

    最后还是高老师出马,我基本照抄...写了个简单注释...

    总之是非常方便,手动把要转的bit,fsbl.elf,xx.elf一起拖到这个批处理中....

    如xxxx.bit,  xxx_fsbl.elf(fsble一定要包含,否则无法和app.elf区别), xxx.elf(IDE下的应用程序);

    就在当前目录下生成BOOT.bin

    内容如下,

     1 @echo off
     2 @echo    ********************************************
     3 @echo            Generate Boot.bin
     4 @echo    ********************************************
     5 :: bootgen地址,根据安装的ISE修改
     6 set cmdpath=J:/ISE14_4/14.4/ISE_DS/ISE/bin/nt/
     7 
     8 :: 输入文件
     9 set filename1=%1
    10 set filename2=%2
    11 set filename3=%3
    12 
    13 :: 文件名是带有绝对路径的,所以将转换为/
    14 set filename1=%filename1:=/%
    15 set filename2=%filename2:=/%
    16 set filename3=%filename3:=/%
    17 
    18 :: 生成bif文件
    19 echo the_ROM_image: >bootimage.bif
    20 echo { >>bootimage.bif
    21 
    22 :: 分析文件,bif中顺序写入fsbl.elf,XXX.bit,app.elf
    23 
    24 if [%filename1:~-8%]==[fsbl.elf] (        ::此处括号必须在这个位置...
    25     echo [bootloader]%filename1:~2,200% >>bootimage.bif    ::不能含盘符
    26     if [%filename2:~-3%] == [bit]    (
    27         echo %filename2:~2,200% >>bootimage.bif
    28         echo %filename3:~2:200% >>bootimage.bif
    29     )    else (
    30          echo %filename3:~2,200% >>bootimage.bif
    31         echo %filename2:~2,200% >>bootimage.bif
    32     )
    33     echo } >>bootimage.bif
    34 )
    35 
    36 if [%filename2:~-8%] == [fsbl.elf] (
    37     echo [bootloader]%filename2:~2,200% >>bootimage.bif
    38     if [%filename1:~-3%] == [bit]    (
    39         echo %filename1:~2,200% >>bootimage.bif
    40         echo %filename3:~2,200% >>bootimage.bif
    41     )    else    (
    42          echo %filename3:~2,200% >>bootimage.bif
    43         echo %filename1:~2,200% >>bootimage.bif
    44     )
    45     echo } >>bootimage.bif
    46 )
    47 if [%filename3:~-8%] == [fsbl.elf] (
    48     echo [bootloader]%filename3:~2,200% >>bootimage.bif
    49     if [%filename1:~-3%] == [bit]    (
    50         echo %filename1:~2,200% >>bootimage.bif
    51         echo %filename2:~2,200% >>bootimage.bif
    52     )    else    (
    53          echo %filename2:~2,200% >>bootimage.bif
    54         echo %filename1:~2,200% >>bootimage.bif
    55     )
    56     echo } >>bootimage.bif
    57 )    
    58 ::生成BOOT.bin
    59 %cmdpath%bootgen -image bootimage.bif -o i BOOT.bin -w on
    60 @echo BOOT.bin generated!
    61 pause            

    涉及批处理的字符串处理的知识,不懂可以查阅相关知识;

  • 相关阅读:
    [LeetCode] Range Sum Query
    [LeetCode] Additive Number
    [LeetCode] Number of Islands II
    [LeetCode] Range Sum Query 2D
    [LeetCode] Range Sum Query
    [LeetCode] Smallest Rectangle Enclosing Black Pixels
    [LeetCode] Longest Increasing Subsequence
    [LeetCode] Bulls and Cows
    [LeetCode] Binary Tree Longest Consecutive Sequence
    [LeetCode] Serialize and Deserialize Binary Tree
  • 原文地址:https://www.cnblogs.com/jamesnt/p/3800079.html
Copyright © 2011-2022 走看看