[U-Boot] [U-boot] monitor length question

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. Best wishes,

Hi TigerLiu@viatech.com.cn,
On Wed, 3 Jul 2013 11:19:13 +0800, TigerLiu@viatech.com.cn wrote:
Hi, experts: I am studying u-boot latest code now. I have a question about monitor length.
- in board_init_f() function in arch\arm\lib\board.c Gd->mon_len = _bss_end_ofs;
- 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,
participants (2)
-
Albert ARIBAUD
-
TigerLiu@viatech.com.cn