1*71e68402STom RiniOverview of SPL on OMAP3 devices 2*71e68402STom Rini================================ 3*71e68402STom Rini 4*71e68402STom RiniIntroduction 5*71e68402STom Rini------------ 6*71e68402STom Rini 7*71e68402STom RiniThis document provides an overview of how SPL functions on OMAP3 (and related 8*71e68402STom Rinisuch as am35x and am37x) processors. 9*71e68402STom Rini 10*71e68402STom RiniMethodology 11*71e68402STom Rini----------- 12*71e68402STom Rini 13*71e68402STom RiniOn these platforms the ROM supports trying a sequence of boot devices. Once 14*71e68402STom Rinione has been used successfully to load SPL this information is stored in memory 15*71e68402STom Riniand the location stored in a register. We will read this to determine where to 16*71e68402STom Riniread U-Boot from in turn. 17*71e68402STom Rini 18*71e68402STom RiniMemory Map 19*71e68402STom Rini---------- 20*71e68402STom Rini 21*71e68402STom RiniThis is an example of a typical setup. See top-level README for documentation 22*71e68402STom Riniof which CONFIG variables control these values. For a given board and the 23*71e68402STom Riniamount of DRAM available to it different values may need to be used. 24*71e68402STom RiniNote that the size of the SPL text rodata and data is enforced with a CONFIG 25*71e68402STom Rinioption and growing over that size results in a link error. The SPL stack 26*71e68402STom Rinistarts at the top of SRAM (which is configurable) and grows downward. The 27*71e68402STom Rinispace between the top of SRAM and the enforced upper bound on the size of the 28*71e68402STom RiniSPL text, data and rodata is considered the safe stack area. Details on 29*71e68402STom Riniconfirming this behavior are shown below. 30*71e68402STom Rini 31*71e68402STom RiniA portion of the system memory map looks as follows: 32*71e68402STom RiniSRAM: 0x40200000 - 0x4020FFFF 33*71e68402STom RiniDDR1: 0x80000000 - 0xBFFFFFFF 34*71e68402STom Rini 35*71e68402STom RiniOption 1 (SPL only): 36*71e68402STom Rini0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata 37*71e68402STom Rini0x4020BC00 - 0x4020FFFC: Area for the SPL stack. 38*71e68402STom Rini0x80000000 - 0x8007FFFF: Area for the SPL BSS. 39*71e68402STom Rini0x80100000: CONFIG_SYS_TEXT_BASE of U-Boot 40*71e68402STom Rini0x80208000 - 0x80307FFF: malloc() pool available to SPL. 41*71e68402STom Rini 42*71e68402STom RiniOption 2 (SPL or X-Loader): 43*71e68402STom Rini0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata 44*71e68402STom Rini0x4020BC00 - 0x4020FFFC: Area for the SPL stack. 45*71e68402STom Rini0x80008000: CONFIG_SYS_TEXT_BASE of U-Boot 46*71e68402STom Rini0x87000000 - 0x8707FFFF: Area for the SPL BSS. 47*71e68402STom Rini0x87080000 - 0x870FFFFF: malloc() pool available to SPL. 48*71e68402STom Rini 49*71e68402STom RiniFor the areas that reside within DDR1 they must not be used prior to s_init() 50*71e68402STom Rinicompleting. Note that CONFIG_SYS_TEXT_BASE must be clear of the areas that SPL 51*71e68402STom Riniuses while running. This is why we have two versions of the memory map that 52*71e68402STom Rinionly vary in where the BSS and malloc pool reside. 53*71e68402STom Rini 54*71e68402STom RiniEstimating stack usage 55*71e68402STom Rini---------------------- 56*71e68402STom Rini 57*71e68402STom RiniWith gcc 4.6 (and later) and the use of GNU cflow it is possible to estimate 58*71e68402STom Rinistack usage at various points in run sequence of SPL. The -fstack-usage option 59*71e68402STom Rinito gcc will produce '.su' files (such as arch/arm/cpu/armv7/syslib.su) that 60*71e68402STom Riniwill give stack usage information and cflow can construct program flow. 61*71e68402STom Rini 62*71e68402STom RiniMust have gcc 4.6 or later, which supports -fstack-usage 63*71e68402STom Rini 64*71e68402STom Rini1) Build normally 65*71e68402STom Rini2) Perform the following shell command to generate a list of C files used in 66*71e68402STom RiniSPL: 67*71e68402STom Rini$ find spl -name '*.su' | sed -e 's:^spl/::' -e 's:[.]su$:.c:' > used-spl.list 68*71e68402STom Rini3) Execute cflow: 69*71e68402STom Rini$ cflow --main=board_init_r `cat used-spl.list` 2>&1 | $PAGER 70*71e68402STom Rini 71*71e68402STom Rinicflow will spit out a number of warnings as it does not parse 72*71e68402STom Rinithe config files and picks functions based on #ifdef. Parsing the '.i' 73*71e68402STom Rinifiles instead introduces another set of headaches. These warnings are 74*71e68402STom Rininot usually important to understanding the flow, however. 75