I wrote those instructions in HEX using a hex editor and saved as kernel7l.img and replaced all the kernal files with it on the raspbian sd card (boot drive). I wish to see pin 11 go high after power up and failed without doubt.
Code: Select all
MOV R0 0xXX00 0000 MOV R1 0x0020 0000 ORR R0 R0 R1 //R0 holds the gpio base address 0xXX200000 , for XX I tried 20, 7E MOV R1 0x0020 0000 STR R1 R0 04 //store 00200000 at address 0xXX200004, set GPIO17 (pin11 on the header) to be an output MOV R1 0x0002 0000 STR R1 R0 1C // set gpio17 bit // I used the bcm2835 arm peripherals.pdf for the register relations B -2 // inf loop
Is there anything wrong with the code, algorithm and what should be the GPIO base address? BTW, i can't find any bare metal tutorial specially made for RPi4.
Thanks in advance