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.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |