From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Fri, 5 Jul 2013 23:14:25 +0200 Subject: [U-Boot] [U-boot] monitor length question In-Reply-To: References: Message-ID: <20130705231425.1c87f29a@lilith> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi TigerLiu at viatech.com.cn, On Wed, 3 Jul 2013 11:19:13 +0800, wrote: > Hi, experts: > I am studying u-boot latest code now. > I have a question about monitor length. > 1. in board_init_f() function in arch\arm\lib\board.c > Gd->mon_len = _bss_end_ofs; > 2. in board_init_r() function in arch\arm\lib\board.c > ??Monitor_flash_len = _end_ofs; > > Because _end_ofs < _bss_end_ofs, so it confused me! > Why need to discard some data when re-calculating monitor_in board_init_r() function. Both functions don't compute the same thing. GD->mon_len computes the monitor length including BSS, because it is the length in RAM at run time, which matters e.g. for relocating the monitor -- relocation copies the text and data but not the BSS. Monitor_flash_len, as the name implies, computes the monitor length excluding BSS, because this is the length in FLASH, and BSS does not exist in the flashed image; even if we know its size at build time, BSS will only exist after relocation, just before entering board_init_r. > Best wishes, Amicalement, -- Albert.