xref: /openbmc/u-boot/doc/README.TPL (revision 1cad23c5f471d695bed1e3907e30caee3c2a3056)
13aa29de0SYing ZhangGeneric TPL framework
23aa29de0SYing Zhang=====================
33aa29de0SYing Zhang
43aa29de0SYing ZhangOverview
53aa29de0SYing Zhang--------
63aa29de0SYing Zhang
73aa29de0SYing ZhangTPL---Third Program Loader.
83aa29de0SYing Zhang
93aa29de0SYing ZhangDue to the SPL on some boards(powerpc mpc85xx) has a size limit and cannot
103aa29de0SYing Zhangbe compatible with all the external device(e.g. DDR). So add a tertiary
113aa29de0SYing Zhangprogram loader (TPL) to enable a loader stub loaded by the code from the
123aa29de0SYing ZhangSPL. It loads the final uboot image into DDR, then jump to it to begin
133aa29de0SYing Zhangexecution. Now, only the powerpc mpc85xx has this requirement and will
143aa29de0SYing Zhangimplemente it.
153aa29de0SYing Zhang
163aa29de0SYing ZhangKeep consistent with SPL, with this framework almost all source files for a
173aa29de0SYing Zhangboard can be reused. No code duplication or symlinking is necessary anymore.
183aa29de0SYing Zhang
193aa29de0SYing ZhangHow it works
203aa29de0SYing Zhang------------
213aa29de0SYing Zhang
22*4379ac61SMasahiro YamadaThere has been a directory $(srctree)/spl which contains only a Makefile. The
233aa29de0SYing ZhangMakefile is shared by SPL and TPL.
243aa29de0SYing Zhang
253aa29de0SYing ZhangThe object files are built separately for SPL/TPL and placed in the
263aa29de0SYing Zhangdirectory spl/tpl. The final binaries which are generated are
273aa29de0SYing Zhangu-boot-{spl|tpl}, u-boot-{spl|tpl}.bin and u-boot-{spl|tpl}.map.
283aa29de0SYing Zhang
293aa29de0SYing ZhangDuring the TPL build a variable named CONFIG_TPL_BUILD is exported in the
303aa29de0SYing Zhangmake environment and also appended to CPPFLAGS with -DCONFIG_TPL_BUILD.
313aa29de0SYing Zhang
323aa29de0SYing ZhangThe SPL options are shared by SPL and TPL, the board config file should
333aa29de0SYing Zhangdetermine which SPL options to choose based on whether CONFIG_TPL_BUILD
343aa29de0SYing Zhangis set. Source files can be compiled for TPL with options choosed in the
353aa29de0SYing Zhangboard config file.
363aa29de0SYing Zhang
373aa29de0SYing ZhangFor example:
383aa29de0SYing Zhang
393aa29de0SYing Zhangspl/Makefile:
403aa29de0SYing ZhangLIBS-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/libcommon.o
413aa29de0SYing Zhang
423aa29de0SYing ZhangCONFIG_SPL_LIBCOMMON_SUPPORT is defined in board config file:
433aa29de0SYing Zhang#ifdef CONFIG_TPL_BUILD
443aa29de0SYing Zhang#define CONFIG_SPL_LIBCOMMON_SUPPORT
453aa29de0SYing Zhang#endif
46