Created
May 17, 2019 12:06
-
-
Save nilhoel1/1cbaf8a2e583317c2bfa669a1970d4b7 to your computer and use it in GitHub Desktop.
PRU assembler example taken from https://jumpnowtek.com/beaglebone/Working-with-the-BeagleBone-PRUs.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Run a simple delay loop on the PRU | |
; Original source https://jumpnowtek.com/beaglebone/Working-with-the-BeagleBone-PRUs.html | |
.setcallreg r29.w0 | |
.origin 0 | |
.entrypoint start | |
#define PRU0_ARM_INTERRUPT 19 | |
#define DELAY_COUNT 50000000 | |
#define LOOP_ITERATIONS 20 | |
start: | |
mov r1, LOOP_ITERATIONS | |
main: | |
call delay | |
sub r1, r1, 1 | |
qbne main, r1, 0 | |
mov r31.b0, PRU0_ARM_INTERRUPT + 16 ; notify ARM we are done | |
halt | |
delay: | |
mov r0, DELAY_COUNT | |
delay_loop: | |
sub r0, r0, 1 | |
qbne delay_loop, r0, 0 | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment