📄 customizing_u-boot_for_your_own_board.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <title></title> <link rel="stylesheet" media="screen" type="text/css" href="./style.css" /> <link rel="stylesheet" media="screen" type="text/css" href="./design.css" /> <link rel="stylesheet" media="print" type="text/css" href="./print.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><a href=start.html>start</a></br><div class="toc"><div class="tocheader toctoggle" id="toc__header">Table of Contents</div><div id="toc__inside"><ul class="toc"><li class="level1"><div class="li"><span class="li"><a href="#making_your_own_board_work_with_u-boot" class="toc">Making your own board work with U-Boot</a></span></div><ul class="toc"><li class="level2"><div class="li"><span class="li"><a href="#config_files" class="toc">Config Files</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#main_makefile" class="toc">Main Makefile</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#other_configuration" class="toc">Other Configuration</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#cresting_your_own_board" class="toc">Cresting your own board</a></span></div><ul class="toc"><li class="level3"><div class="li"><span class="li"><a href="#sample_list_of_files_affected_by_config_stamp" class="toc">Sample list of files affected by CONFIG_STAMP</a></span></div></li></ul></li><li class="level2"><div class="li"><span class="li"><a href="#u_boot_startup_sequence" class="toc">U Boot Startup Sequence</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#adding_u-boot_commands" class="toc">Adding U-boot commands</a></span></div></li></ul></li></ul></div></div><h1><a name="making_your_own_board_work_with_u-boot" id="making_your_own_board_work_with_u-boot">Making your own board work with U-Boot</a></h1><div class="level1"></div><!-- SECTION [1-54] --><h2><a name="config_files" id="config_files">Config Files</a></h2><div class="level2"><p> Lets call your new board “mybf533”. This board will be very much like a BF533_STAMP board but with a few changes. In order to do this, we can copy the <code>board/stamp</code> to <code>board/mybf533</code>.</p><p><strong>cp ./stamp ./mybf533</strong></p><p>The basic board will need a new <code>config.mk</code> file. The orginal file looks like:</p><p>By adjusting the following lines, tells U-Boot that the board has less SDRAM on it. <code>TEXT_BASE</code> defines where U-Boot locates itself in SDRAM. :</p><pre class="code c"><span class="co2"># TEXT_BASE should be defined as the MAX_SDRAM Address - 256k bytes</span><span class="co2"># 256k is defined as CFG_MONITOR_LEN in ./include/configs/<board>.h</span><span class="co2"># move the start address of uboot to suit a 64M memory layout.</span><span class="co2">#TEXT_BASE = 0x07FC0000 old value</span>TEXT_BASE = 0x03FC0000PLATFORM_CPPFLAGS += -I$<span class="br0">(</span>TOPDIR<span class="br0">)</span></pre><p>Note that this code assumes that the length of u-boot is less than 256K </p><p> The main make file needs to have a target added to specify the new config file</p><p>The file <code><strong>include/config.mk</strong></code> is automatically generated by the <strong>mkconfig</strong> script</p><p>It will define $ARCH $CPU $BOARD (and possibly $SoC and $VENDOR)</p><pre class="code text">ARCH = blackfinCPU = bf533BOARD = mybf533 </pre><p>These set up all the specific configurations for a new board.</p><p><strong>blackfin_config.mk</strong> contains some special compiler options.</p><pre class="code text">PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN -D__blackfin__ </pre><p>So does <strong>cpu/$bf533/config.mk</strong> </p><pre class="code text">PLATFORM_RELFLAGS += -ffixed-P5 </pre></div><!-- SECTION [55-1747] --><h2><a name="main_makefile" id="main_makefile">Main Makefile</a></h2><div class="level2"><p> To allow the system configuration to take place a new command is added to the main u-boot makefile</p><pre class="code text">########################################################################### Blackfin#########################################################################ezkit533_config : unconfig @./mkconfig $(@:_config=) blackfin bf533 ezkit533 ezkit561_config : unconfig @./mkconfig $(@:_config=) blackfin bf533 ezkit561 stamp_config : unconfig @./mkconfig $(@:_config=) blackfin bf533 stamp ## New mybf533 targetmybf533_config : unconfig @./mkconfig $(@:_config=) blackfin bf533 mybf533 </pre><p> Once this is in place the new board can be configured using the following command:</p><pre class="code text">$ make mybf533_config </pre></div><!-- SECTION [1748-2569] --><h2><a name="other_configuration" id="other_configuration">Other Configuration</a></h2><div class="level2"><p> Before the new make command can be used , however, some more configuration is needed. Since the new board is very much like the stamp board you can use the stamp as a template for most of the new board’s files.</p><p>copy <strong>include/configs/stamp.h</strong> to <strong>include/configs/mybf533.h</strong></p><pre class="code text">#define CONFIG_MEM_SIZE 64 #define CONFIG_CLKIN_HZ 24000000#define CONFIG_CLKIN_HALF 0#define CONFIG_PLL_BYPASS 0 ... </pre></div><!-- SECTION [2570-3038] --><h2><a name="cresting_your_own_board" id="cresting_your_own_board">Cresting your own board</a></h2><div class="level2"><p>The steps to create your own board are now summarised</p></div><h4><a name="basic_steps" id="basic_steps">Basic Steps</a></h4><div class="level4"><p> Call the new board “mybf533”</p><ul><li class="level1"><div class="li"> create <strong>include/configs/mybf53.h</strong> using <strong>include/configs/stamp.h</strong> as a template</div></li></ul><ul><li class="level1"><div class="li"> create a define for CONFIG_MYBF533 this can then be used in common files to modify the system for your board. Look for all instances of CONFIG_STAMP and make sure you add changes to suit your board.</div></li></ul></div><!-- SECTION [3039-3472] --><h3><a name="sample_list_of_files_affected_by_config_stamp" id="sample_list_of_files_affected_by_config_stamp">Sample list of files affected by CONFIG_STAMP</a></h3><div class="level3"><pre class="code text">./cpu/bf533/cpu.c: setup dcplb and icplb tables i and d cache enable / disable./cpu/bf533/bf533_serial.h: define extern pll_div_fact./lib_blackfin/board.c: first c code to be called after cpu init./board/mybf533/mybf533.c: board specific init functions./tools/environment.c: generates default environment./drivers/cfi_flash.c: controls flash access./common/environment.c: generates default environment./include/configs/mybf533.h: main configuration file./include/asm-blackfin/hw_irq.h: include specific irw definitions./include/asm-blackfin/cplbtab.h: cplb table default definitions </pre><ul><li class="level1"><div class="li"> create or modify other important defines such as</div><ul><li class="level2"><div class="li"> ETHERNET DRIVER</div></li><li class="level2"><div class="li"> CLOCK Settings </div></li><li class="level2"><div class="li"> Flash Base Address</div></li><li class="level2"><div class="li"> Uboot Environment base Address and Size</div></li><li class="level2"><div class="li"> Network Settings</div></li><li class="level2"><div class="li"> Default Environment Settings ( in #define CONFIG_EXTRA_ENV_SETTINGS )</div></li><li class="level2"><div class="li"> Console Baudrate</div></li><li class="level2"><div class="li"> Command Config Definitions</div></li></ul></li></ul><ul><li class="level1"><div class="li"> Modify main Makefile to add config for your board. Add the following lines so you can run <code>make mybf533_config</code>:</div></li></ul><pre class="code text">mybf533_config : unconfig @./mkconfig $(@:_config=) blackfin bf533 mybf533 </pre><ul><li class="level1"><div class="li"> Create your own board directory</div></li></ul><pre class="code text">$ mkdir board/mybf533 </pre><ul><li class="level1"><div class="li"> copy the default files to it</div></li></ul><pre class="code text">$ cp -a board/stamp/* board/mybf533/ </pre><ul><li class="level1"><div class="li"> change references of stamp.c / stamp.h to mybf533.c / mybf533.h</div></li><li class="level2"><div class="li"> put all special board specific features in this file</div></li><li class="level2"><div class="li"> modify the <strong>board/mybf533/Makefile</strong> </div></li><li class="level2"><div class="li"> to specify the new library for your board</div></li></ul><pre class="code text">include $(TOPDIR)/config.mk LIB = lib$(BOARD).a OBJS = $(BOARD).o flash.o mybf533.o spi.o
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -