![]() ![]() #define CONFIG_BOARDDIR board/xilinx/zynq as follows: /* Automatically generated - do not edit */ Among others, this “make zynq_zed_config” command generates include/config.h. ![]() This is in fact just the tip of the iceberg. Many have also spotted that there’s a /include/configs/ directory, in which corresponding files are found, for example zynq_zed.h, which reads something like this (GPLv2 header at the top not shown here): #ifndef _CONFIG_ZYNQ_ZED_H Behind the scenes of make XXX_configĪnyone who has built U-Boot has typed something like $ make zynq_zed_configīefore compiling the project. Any other piece of software can access the GPIO API as well (hopefully not the same pins). These pins are accessed using the GPIO’s API functions. ![]() For example, the SOFT_I2C driver depends on two GPIO pins that are connected to an I2C device. One driver may, of course, depend on the other. It kinda makes sense for a utility that needs to be compact: There’s no point compiling in anything that isn’t used, and most of the time there’s a fixed set of hardware involved, with one instance of each kind, at most. So a “hardware driver” in U-Boot is just a piece of code that implements a set of functions that are linked into the global name space. And of course, if gpio_get_value() is used somewhere, this one source file must be compiled. There is no place for more than one GPIO driver to be compiled into the system: Only one source file, which defines this function, may be enabled for compilation, or the linking will fail. There’s no intermediate layer between the drivers and the user front-end.įor example, to get the value of a GPIO pin, just call gpio_get_value(gpio) with the GPIO’s pin number from anywhere in the code. The structure is however simpler at the cost of less flexibility. Linux kernel hackers will feel relatively comfortable with U-Boot, as much of the coding style and organization is inspired by the Linux kernel. This tutorial is divided into three parts: A general view on U-Boot (this part), a hands-on explanation on how to add functionality (part II) and some background on U-Boot’s bring-up process, for those who need to initialize something very early (part III). Writing a small custom driver and command support is by far more elegant and reusable, if the hardware’s setup can be deferred to the command execution stage. This will most likely work, but as just mentioned, hardcoding has its disadvantages. It may be tempting to add a few lines of hack code in the board’s initialization routine to perform a specific operation. Expanding the command interface to support a needed functionality, possibly as a front-end for new hardware.Adding support to specific hardware, by virtue of adding or modifying low-level drivers.Modifications in U-Boot’s initialization process, so that a custom board’s specific hardware is set up early enough.One can divide possible modifications into three sorts: Not only will this probably lead to daunting re-hacking and recompilations in the future, but it’s unnecessary: U-Boot is actually laid out to make it easy to add custom functionality. The immediate instinct when encountering a large chunk of software sources is to look for the first place to inject a small hack, and hardcode the necessary functionality. This tutorial was written with respect to U-Boot version v2013.07, but the principles apply for a wide range of versions. The “Hello world” example and how to use itīoards.cfg contains a list of supported boards.It’s most recommended to read the README file in the project’s root directory first. It’s assumed that the reader is familiar with U-Boot usage at the command level as well as compilation and deployment. The short tutorial focuses on U-Boot for ARM, but the techniques used on other architectures are similar and often exactly the same. For example, supporting board-specific features or adding a few routines that give the end-user signs that the device has indeed powered on, and that something is happening while the boot process takes place. It’s often desirable to make slight changes to U-Boot in order to adapt it to custom hardware. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |