1 | .. SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
2 | |
---|
3 | .. Copyright (C) 2019 Vijay Kumar Banerjee |
---|
4 | |
---|
5 | beagle |
---|
6 | ====== |
---|
7 | |
---|
8 | This BSP supports four variants, `beagleboardorig`, `beagleboardxm`, |
---|
9 | `beaglebonewhite` and `beagleboneblack`. The basic hardware initialization is |
---|
10 | not performed by the BSP. A boot loader with device tree support must be used |
---|
11 | to start the BSP, e.g., U-Boot. |
---|
12 | |
---|
13 | TODO(These drivers are present but not documented yet): |
---|
14 | |
---|
15 | * Clock driver. |
---|
16 | * Network Interface Driver. |
---|
17 | * SDcard driver. |
---|
18 | * GPIO Driver. |
---|
19 | * Console driver. |
---|
20 | * PWM Driver. |
---|
21 | * RTC driver. |
---|
22 | |
---|
23 | Boot via U-Boot |
---|
24 | --------------- |
---|
25 | To boot via uboot, the ELF must be converted to a U-Boot image like below: |
---|
26 | |
---|
27 | .. code-block:: none |
---|
28 | |
---|
29 | arm-rtems5-objcopy hello.exe -O binary app.bin |
---|
30 | gzip -9 app.bin |
---|
31 | mkimage -A arm -O linux -T kernel -a 0x80000000 -e 0x80000000 -n RTEMS -d app.bin.gz rtems-app.img |
---|
32 | |
---|
33 | Getting the Device Tree Blob |
---|
34 | ---------------------------- |
---|
35 | |
---|
36 | The Device Tree Blob (DTB) is needed to load the device tree while starting up |
---|
37 | the kernel. We build the dtb from the FreeBSD source matching the commit hash |
---|
38 | from the libbsd HEAD of freebsd-org. For example if the HEAD is at |
---|
39 | "19a6ceb89dbacf74697d493e48c388767126d418" |
---|
40 | Then the right Device Tree Source (DTS) file is: |
---|
41 | https://github.com/freebsd/freebsd/blob/19a6ceb89dbacf74697d493e48c388767126d418/sys/gnu/dts/arm/am335x-boneblack.dts |
---|
42 | |
---|
43 | Please refer to the :ref:`DeviceTree` to know more about building and applying |
---|
44 | the Device Trees. |
---|
45 | |
---|
46 | Writing the uEnv.txt file |
---|
47 | ------------------------- |
---|
48 | |
---|
49 | The uEnv.txt file is needed to set any environment variable before the kernel is |
---|
50 | loaded. Each line is a u-boot command that the uboot will execute during start |
---|
51 | up. |
---|
52 | |
---|
53 | Add the following to a file named uEnv.txt: |
---|
54 | |
---|
55 | .. code-block:: none |
---|
56 | |
---|
57 | setenv bootdelay 5 |
---|
58 | uenvcmd=run boot |
---|
59 | boot=fatload mmc 0 0x80800000 rtems-app.img ; fatload mmc 0 0x88000000 am335x-boneblack.dtb ; bootm 0x80800000 - 0x88000000 |
---|
60 | |
---|
61 | I2C Driver |
---|
62 | ---------- |
---|
63 | |
---|
64 | The Beagle has the `i2c-0` device registered at initialization. For registering |
---|
65 | `i2c-1` and `i2c-2` ``bbb_register_i2c_1()`` and |
---|
66 | ``bbb_register_i2c_2()`` wrapper functions are respectively used. |
---|
67 | |
---|
68 | For registering an I2C device with a custom path (say `/dev/i2c-3`) the |
---|
69 | function ``am335x_i2c_bus_register()`` has to be used. |
---|
70 | |
---|
71 | The function prototype is given below: |
---|
72 | |
---|
73 | .. code-block:: C |
---|
74 | |
---|
75 | int am335x_i2c_bus_register( |
---|
76 | const char *bus_path, |
---|
77 | uintptr_t register_base, |
---|
78 | uint32_t input_clock, |
---|
79 | rtems_vector_number irq |
---|
80 | ); |
---|
81 | |
---|
82 | SPI Driver |
---|
83 | ---------- |
---|
84 | |
---|
85 | The SPI device `/dev/spi-0` can be registered with ``bbb_register_spi_0()`` |
---|
86 | |
---|
87 | For registering with a custom path, the ``bsp_register_spi()`` can be used. |
---|
88 | |
---|
89 | The function prototype is given below: |
---|
90 | |
---|
91 | .. code-block:: C |
---|
92 | |
---|
93 | rtems_status_code bsp_register_spi( |
---|
94 | const char *bus_path, |
---|
95 | uintptr_t register_base, |
---|
96 | rtems_vector_number irq |
---|
97 | ); |
---|