Hello,
I am currently working with the AM335x Evaluation board, and would like to know where does U-Boot get all the necessary parameters for initializing the system. I did read through few documents which indicate that there is a 2 stage loading. The X-loader which is based on a strip down version of U-Boot gets loaded first (also called the SPL) and then the U-boot is loaded by this X-loader into RAM and it executes from RAM.
1. Are there documents that clearly indicate which peripherals are initialized by the X-loader and which are initialized by the U-boot?
2. What are the specific functions of U-boot and X-loader, how to build drivers for only those peripherals that are needed?
When I go through the forum everyone seems to have already passed the first two stages, which tells me that I may be missing something trivial. Are there documents that clearly mention how to do these and I haven't read them??
Thanks in advance for your replies.
Regards
Santhosh
the most important job of x-load is to initialize external SDRAM because uboot is too big to fit in On Chip Memory. Other than that xload also initializes pin mux and some clock domains.
------------------------------------------------------------------------------------------------------------------
Please click the Verify Answer button on this post if it answers your question. ------------------------------------------------------------------------------------------------------------------
Hi Santosh,
In general the job of Secondary stage loader (SPL/X-loader), is to setup the minimum level, like setting up the pll controllers, setting up the DDR, etc and load the U-boot Image to RAM and final jump to U-boot. Even before SPL the RBL comes up when you turn on the switch first and tries to load the second stage loader.
And the job U-boot in general is to setup the flashes, EMAC , load the linux image to RAM and jump to this address finally. For AM335XX I can see the SPL code for it is present in the U-boot source refer this link http://processors.wiki.ti.com/index.php/AMSDK_u-boot_User%27s_Guide#Compiling_MLO_and_u-boot
Thx,
--Prabhakar Lad
http://in.linkedin.com/pub/prabhakar-lad/19/92b/955
Hello Prabhakar, Mayank,
Thank you for the quick response, I see that I should have given more information about the situation. I have read through the document links you have posted. I am mainly interested in finding out which files I need to edit and/or read through to understand how the initialization is done (in the SPL and U-Boot). I would like to make minor tweaks to the EVM code for testing and then later on make major modifications when we develop our custom board.
Although there are documents that clearly indicate how to compile them, which I have read through and have compiled these, there are none specifying how and/or what to modify. On previous occasions of using TI's software package (namely Stellarisware) the code was well documented and the Application notes made it easier to understand and make changes as required.
The Linux variant seems all cryptic to a relatively new user - I am not completely new to Linux - just haven't worked with TI's SDK. Is there a getting started guide - I have read through most documents on the wiki page; I am looking for something more in depth and detailed - not just how to compile and download code.
Thank you for your patience.
I have been ploughing through the U-Boot code and have found most definitions for the EVM board in am335x_evm.h. I have few questions regarding some of the definitions in this file:
1. CONFIG_SYS_NAND_U_BOOT_START - Is defined as 'CONFIG_SYS_TEXT_BASE' which in turn is defined to be 8MB from the start of the DRAM. What does this definition mean and where and how is it used??
2. Similar question regarding CONFIG_SYS_NAND_U_BOOT_OFFS.
There are many definitions in this file which are difficult to understand - since they are specific to the EVM and there are no specific hits in google. Is there a document that explains how and why these definitions are used as such?
Thank you
Hi,
The file am335x_evm.h which is found in include/configs/ is like a configuration file for your board.
'CONFIG_SYS_NAND_U_BOOT_START' This config tells that U-boot image
is present at this address in RAM, so when SPL has done its job it
finally jumps to this address in RAM where U-boot image is present.
As I have told the task performed SPL, this config
'CONFIG_SYS_NAND_U_BOOT_OFFS' tells the SPL to Load U-Boot image from
NAND into RAM at this addreess.
If you notice this address is same as ''CONFIG_SYS_NAND_U_BOOT_START'
this is just the naming convention.
Hope that clears your doubt..
Hello Prabhakar,
Thank you for your response, I clearly understood the first part but have some difficulty understanding the second one. From the file it seems the value of the U-Boot offset is wrong. This is what I found in the file
#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000/* * 8MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM. * 64 bytes before this address should be set aside for u-boot.img's * header. That is 0x807FFFC0--0x80800000 should not be used for any * other needs. */#define CONFIG_SYS_TEXT_BASE 0x80800000
Could you please clarify - the U-Boot offset seems to be 512KB where as the Text Base is at 8MB. Also the comments indicate that it is the start address for the SPL's bss - this is what is confusing.
"CONFIG_SYS_NAND_U_BOOT_OFFS" -->> This offset indicates that your U-boot image is present in this location in NAND flash. So in your case the u-boot image is present at 512KB in NAND flash. This u-boot image is flashed ti NAND using to some tool , you can check out it writes at 0x80000 in your case.
"CONFIG_SYS_TEXT_BASE "-->> This offset indicates, finally when SPL has read the u-boot image from some flash in you case from nand. So at this address in RAM your u-boot image is copied and finally after copying the SPL jumps to this address so now your U-boot starts executing.
Thank you again, yes that makes sense now; just got a little confused due to the naming convention. I read through U-Boot User's Guide and found that there are 4 copies of SPL totaling upto 512KB and then U-Boot is placed after that section. Could you please answer few more questions for me? Thank you so much for your patience.
I was reading through the document u-boot-spl.lds and I am trying to co-relate the bss definition in the am335x_evm.h.
U-BOOT-SPL.LDS
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \ LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
AM335X_EVM.H
#define CONFIG_SPL_BSS_START_ADDR 0x80000000 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */
How are these 2 related - because if there is only 512KB of bss data for the SPL - then couldn't the U-Boot image start before the 8MB boundary. Does the U-Boot copy the Linux kernel to the start of SDRAM (0x80000000) and hence is located 8MB below the starting location. I am justing trying to understand the logic and layout of the individual parts. I understand that some of the questions may be dumb - but I am not able to find any sources where I can get such basic information.
Once again thanks for your patience.
Agreed the size of the BSS is only 512KB, but the size of the SPL is
CONFIG_SPL_MAX_SIZE (46 * 1024) in your case. The U-Boot copies linux at
CONFIG_SYS_LOAD_ADDR (0x81000000 in your case). Not sure why 8Mb is left
never worked on this board :( May be you can find it out in AM335x boot docs.
Thanks again for your reply. Do you know what is the use of the BSS segment for SPL. Also have you worked with booting from SD Card on other boards, if so, can you please explain how the following definitions work:
#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 /* address 0x60000 */ #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x200 /* 256 KB */
I didn't understand the Boot_Sector definition, how is it used?
Thanks again for your replies :)
Its used for the same purpose as in general. It contains all global
variables and static variables that are initialized to zero or do not have
explicit initialization in source code.
you please explain how the following definitions work:
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is the address in MMC/SD card
CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS is the size.
If you notice you can also find CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION this tells
in which partition to look for.
These configs are used to load U-Boot from when the MMC is being used in raw mode.
-------------------------------------------------------------------------------
Please click the Verify Answer button on this post if it answers your question. --------------------------------------------------------------------------------
Thanks again for your reply. I understand the definitions for sector size and partition, but if the starting address of U-Boot is provided does it mean that the script which is used to generate the SD Card images (U-boot.bin, MLO, Kernel image etc.) places each of these files in a specific location? I was under the impression that the U-Boot file is picked up by file name, u-boot.img. Am I missing something?
Also, if the starting address is defined, then where in the file generation script does it specific which sector to place it in? I tried looking at the SD Card image but I couldn't see any indications. May be I am looking at the wrong place?
Thank you for all your replies and patience :)
I am not so sure on AM335x, but usually the case is the the flasher tool flashes to some specific address in the
MMC/SD card and this address is given to SPL to load the U-boot image.
Since you can any day change the address to be flashed of the U-boot image, because of which
this is the config in your am335x configuration file.
Can you please point me to any document that will help me find out more about this; I tried looking for the way the address is used but couldn't find any reference. If you have used this with a different device then can you point me to information about that, may be I will be able to co-relate.
thanks
If you can point to me your script which configures the MMC card I'll help you with the same.