Raspberry Pi Bare Bones: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
Line 246:
</source>
The GPU bootloader passes arguments to the kernel via r0-r2 and the boot.S makes sure to preserve those 3 registers. They are the first 3 arguments in a C function call. The argument r0 contains a code for the device the
Notice how we wish to use the common C function strlen, but this function is part of the C standard library that we don't have available. Instead, we rely on the freestanding header <stddef.h> to provide size_t and we simply declare our own implementation of strlen. You will have to do this for every function you wish to use (as the freestanding headers only provide macros and data types).
The addresses for the GPIO and UART are offsets from the peripheral base address, which is 0x20000000 for
Compile using:
|