Skip to content

Added Details for using Raspberry PI 2b with this Tutorial.#22

Open
ghost wants to merge 1 commit into
Chadderz121:masterfrom
florianabel:master
Open

Added Details for using Raspberry PI 2b with this Tutorial.#22
ghost wants to merge 1 commit into
Chadderz121:masterfrom
florianabel:master

Conversation

@ghost

@ghost ghost commented Jul 30, 2016

Copy link
Copy Markdown

Hey there,

I added some Details about the peripheral Address for the Raspberry PI 2b for the ok01 tutorial.
It took me quite a while to find out these things in the beginning and nearly put me off.
This will make it easier for beginner to get into it, if they have a 2b Model instead.

I hope it is helpful.

Cheers,

Florian

@petemoore

Copy link
Copy Markdown

@floanwelt Many thanks for updating the docs! I'm using a raspberry pi 3b, but having some trouble.

I believe the GPIO base address is the same between BCM2836 (raspberry pi 2) and BCM2837 (raspberry pi 3), but it didn't seem to work for me. When I boot up, I get the power LED displayed, but not the ACT LED.

This is the disassembly of my compiled binary:

$ cat kernel.list 

build/output.elf:     file format elf32-littlearm


Disassembly of section .init:

00008000 <_start>:
    8000:	e59f0018 	ldr	r0, [pc, #24]	; 8020 <loop$+0x4>
    8004:	e3a01001 	mov	r1, #1
    8008:	e1a01a81 	lsl	r1, r1, #21
    800c:	e5801010 	str	r1, [r0, #16]
    8010:	e3a01001 	mov	r1, #1
    8014:	e1a01781 	lsl	r1, r1, #15
    8018:	e5801020 	str	r1, [r0, #32]

0000801c <loop$>:
    801c:	eafffffe 	b	801c <loop$>
    8020:	3f200000 	.word	0x3f200000

and this is the hexdump of the kernel.img file:

$ hexdump kernel.img 
0000000 18 00 9f e5 01 10 a0 e3 81 1a a0 e1 10 10 80 e5
0000010 01 10 a0 e3 81 17 a0 e1 20 10 80 e5 fe ff ff ea
0000020 00 00 20 3f                                    
0000024

and just for full measure:

$ md5 kernel.img 
MD5 (kernel.img) = c88510e49ee75a348db4a9af4ac7e371
$ shasum kernel.img 
963c99f94548b32620351028ed7895a9cc0f697e  kernel.img
$ shasum -a256 kernel.img 
4b95fca549ee75646252690d553447ccc67f050004e374ed12104ded75a68580  kernel.img

Can you confirm if you generated the same binary, and if you know if it works on a raspberry pi 3?

I'm using standard firmware, and tried even with no config.txt file.

Thanks!

@petemoore

Copy link
Copy Markdown

I found someone else has already managed this, so for raspberry pi 3b, see here:

And for other exercises, see here:

@iwwy

iwwy commented Jun 29, 2020

Copy link
Copy Markdown

Here is the code for Pi 0 if anyone's interested. References to BCM2835 Peripherals included in the comments.

.section .init
.globl _start
_start:
    ldr r0,=0x20200000

    mov r1,#1
    lsl r1,#18          ; 0x7E20 0010 GPFSEL4
    str r1,[r0,#21]     ; Table 6-6 – GPIO Alternate function select register 4

    mov r1,#1
    lsl r1,#15          ; Table 6-11 – GPIO Output Clear Register 1
    str r1,[r0,#44]     ; 0x7E20 002C GPCLR1
loop$:
    b loop$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants