Skip to content

Commit 01edefd

Browse files
authored
Update peripheral_addresses.md (raspberrypi#961)
* Update peripheral_addresses.md * Update peripheral_addresses.md * copy edits
1 parent 96f02c6 commit 01edefd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

hardware/raspberrypi/peripheral_addresses.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,20 @@ This returns the size of the peripheral's space, which is 0x01000000 for all mod
1313
`unsigned bcm_host_get_sdram_address()`
1414

1515
This returns the bus address of the SDRAM. This is 0x40000000 on the Pi Zero, Pi Zero W, and the first generation of the Raspberry Pi and Compute Module (GPU L2 cached), and 0xC0000000 on the Pi 2, Pi 3 and Compute Module 3 (uncached).
16+
17+
## Building a C program using these functions
18+
19+
The `include` file and library are installed by default on a Raspbian system.
20+
21+
Add the following line to your C program:
22+
```
23+
#include <bcm_host.h>
24+
```
25+
Link with:
26+
```
27+
-lbcm_host.c
28+
```
29+
So a simple command line compile might be:
30+
```
31+
cc myfile.c -I/opt/vc/include -L/opt/vc/lib -lbcm_host -o myfile
32+
```

0 commit comments

Comments
 (0)