forked from dwelch67/raspberrypi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding raspberry pi 2 and A+ and B+ variations on blinker02
- Loading branch information
Showing
11 changed files
with
391 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
ARMGNU ?= arm-none-eabi | ||
|
||
COPS = -Wall -O2 -nostdlib -nostartfiles -ffreestanding | ||
|
||
gcc : blinker02.hex blinker02.bin | ||
|
||
all : gcc clang | ||
|
||
clean : | ||
rm -f *.o | ||
rm -f *.bin | ||
rm -f *.hex | ||
rm -f *.elf | ||
rm -f *.list | ||
rm -f *.img | ||
rm -f *.bc | ||
rm -f *.clang.opt.s | ||
|
||
vectors.o : vectors.s | ||
$(ARMGNU)-as vectors.s -o vectors.o | ||
|
||
blinker02.o : blinker02.c | ||
$(ARMGNU)-gcc $(COPS) -c blinker02.c -o blinker02.o | ||
|
||
blinker02.elf : memmap vectors.o blinker02.o | ||
$(ARMGNU)-ld vectors.o blinker02.o -T memmap -o blinker02.elf | ||
$(ARMGNU)-objdump -D blinker02.elf > blinker02.list | ||
|
||
blinker02.bin : blinker02.elf | ||
$(ARMGNU)-objcopy blinker02.elf -O binary blinker02.bin | ||
|
||
blinker02.hex : blinker02.elf | ||
$(ARMGNU)-objcopy blinker02.elf -O ihex blinker02.hex | ||
|
||
|
||
|
||
|
||
|
||
|
||
LOPS = -Wall -m32 -emit-llvm | ||
LLCOPS = -march=arm -mcpu=arm1176jzf-s | ||
LLCOPS0 = -march=arm | ||
LLCOPS1 = -march=arm -mcpu=arm1176jzf-s | ||
COPS = -Wall -O2 -nostdlib -nostartfiles -ffreestanding | ||
OOPS = -std-compile-opts | ||
|
||
clang : blinker02.clang.hex blinker02.clang.bin | ||
|
||
|
||
blinker02.clang.bc : blinker02.c | ||
clang $(LOPS) -c blinker02.c -o blinker02.clang.bc | ||
|
||
blinker02.clang.opt.elf : memmap vectors.o blinker02.clang.bc | ||
opt $(OOPS) blinker02.clang.bc -o blinker02.clang.opt.bc | ||
llc $(LLCOPS) blinker02.clang.opt.bc -o blinker02.clang.opt.s | ||
$(ARMGNU)-as blinker02.clang.opt.s -o blinker02.clang.opt.o | ||
$(ARMGNU)-ld -o blinker02.clang.opt.elf -T memmap vectors.o blinker02.clang.opt.o | ||
$(ARMGNU)-objdump -D blinker02.clang.opt.elf > blinker02.clang.opt.list | ||
|
||
blinker02.clang.hex : blinker02.clang.opt.elf | ||
$(ARMGNU)-objcopy blinker02.clang.opt.elf blinker02.clang.hex -O ihex | ||
|
||
blinker02.clang.bin : blinker02.clang.opt.elf | ||
$(ARMGNU)-objcopy blinker02.clang.opt.elf blinker02.clang.bin -O binary | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
See the top level README for information on where to find the | ||
schematic and programmers reference manual for the ARM processor | ||
on the raspberry pi. Also find information on how to load and run | ||
these programs. | ||
|
||
Same as blinker02 in the plus directory except the raspberry pi 2 | ||
uses a different base address (0x3F000000) than the raspberry pi 1 | ||
(0x20000000) likely to make room for more ram but who knows. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
//------------------------------------------------------------------------- | ||
//------------------------------------------------------------------------- | ||
|
||
extern void PUT32 ( unsigned int, unsigned int ); | ||
extern unsigned int GET32 ( unsigned int ); | ||
extern void dummy ( unsigned int ); | ||
|
||
#define SYSTIMERCLO 0x3F003004 | ||
#define GPFSEL3 0x3F20000C | ||
#define GPFSEL4 0x3F200010 | ||
#define GPSET1 0x3F200020 | ||
#define GPCLR1 0x3F20002C | ||
|
||
//0x01000000 17 seconds | ||
//0x00400000 4 seconds | ||
#define TIMER_BIT 0x00400000 | ||
|
||
//------------------------------------------------------------------------- | ||
int notmain ( void ) | ||
{ | ||
unsigned int ra; | ||
|
||
ra=GET32(GPFSEL4); | ||
ra&=~(7<<21); | ||
ra|=1<<21; | ||
PUT32(GPFSEL4,ra); | ||
|
||
ra=GET32(GPFSEL3); | ||
ra&=~(7<<15); | ||
ra|=1<<15; | ||
PUT32(GPFSEL3,ra); | ||
|
||
|
||
while(1) | ||
{ | ||
PUT32(GPSET1,1<<(47-32)); | ||
PUT32(GPCLR1,1<<(35-32)); | ||
while(1) | ||
{ | ||
ra=GET32(SYSTIMERCLO); | ||
if((ra&=TIMER_BIT)==TIMER_BIT) break; | ||
} | ||
PUT32(GPCLR1,1<<(47-32)); | ||
PUT32(GPSET1,1<<(35-32)); | ||
while(1) | ||
{ | ||
ra=GET32(SYSTIMERCLO); | ||
if((ra&=TIMER_BIT)==0) break; | ||
} | ||
} | ||
return(0); | ||
} | ||
//------------------------------------------------------------------------- | ||
//------------------------------------------------------------------------- | ||
|
||
|
||
//------------------------------------------------------------------------- | ||
// | ||
// Copyright (c) 2012 David Welch [email protected] | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
//------------------------------------------------------------------------- |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
MEMORY | ||
{ | ||
ram : ORIGIN = 0x8000, LENGTH = 0x1000 | ||
} | ||
|
||
SECTIONS | ||
{ | ||
.text : { *(.text*) } > ram | ||
.bss : { *(.bss*) } > ram | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
;@ ------------------------------------------------------------------ | ||
;@ ------------------------------------------------------------------ | ||
|
||
.globl _start | ||
_start: | ||
mov sp,#0x8000 | ||
bl notmain | ||
hang: b hang | ||
|
||
.globl PUT32 | ||
PUT32: | ||
str r1,[r0] | ||
bx lr | ||
|
||
.globl GET32 | ||
GET32: | ||
ldr r0,[r0] | ||
bx lr | ||
|
||
.globl dummy | ||
dummy: | ||
bx lr | ||
|
||
;@ ------------------------------------------------------------------ | ||
;@ ------------------------------------------------------------------ | ||
|
||
|
||
;@------------------------------------------------------------------------- | ||
;@ | ||
;@ Copyright (c) 2012 David Welch [email protected] | ||
;@ | ||
;@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
;@ | ||
;@ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
;@ | ||
;@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
;@ | ||
;@------------------------------------------------------------------------- |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
ARMGNU ?= arm-none-eabi | ||
|
||
COPS = -Wall -O2 -nostdlib -nostartfiles -ffreestanding | ||
|
||
gcc : blinker02.hex blinker02.bin | ||
|
||
all : gcc clang | ||
|
||
clean : | ||
rm -f *.o | ||
rm -f *.bin | ||
rm -f *.hex | ||
rm -f *.elf | ||
rm -f *.list | ||
rm -f *.img | ||
rm -f *.bc | ||
rm -f *.clang.opt.s | ||
|
||
vectors.o : vectors.s | ||
$(ARMGNU)-as vectors.s -o vectors.o | ||
|
||
blinker02.o : blinker02.c | ||
$(ARMGNU)-gcc $(COPS) -c blinker02.c -o blinker02.o | ||
|
||
blinker02.elf : memmap vectors.o blinker02.o | ||
$(ARMGNU)-ld vectors.o blinker02.o -T memmap -o blinker02.elf | ||
$(ARMGNU)-objdump -D blinker02.elf > blinker02.list | ||
|
||
blinker02.bin : blinker02.elf | ||
$(ARMGNU)-objcopy blinker02.elf -O binary blinker02.bin | ||
|
||
blinker02.hex : blinker02.elf | ||
$(ARMGNU)-objcopy blinker02.elf -O ihex blinker02.hex | ||
|
||
|
||
|
||
|
||
|
||
|
||
LOPS = -Wall -m32 -emit-llvm | ||
LLCOPS = -march=arm -mcpu=arm1176jzf-s | ||
LLCOPS0 = -march=arm | ||
LLCOPS1 = -march=arm -mcpu=arm1176jzf-s | ||
COPS = -Wall -O2 -nostdlib -nostartfiles -ffreestanding | ||
OOPS = -std-compile-opts | ||
|
||
clang : blinker02.clang.hex blinker02.clang.bin | ||
|
||
|
||
blinker02.clang.bc : blinker02.c | ||
clang $(LOPS) -c blinker02.c -o blinker02.clang.bc | ||
|
||
blinker02.clang.opt.elf : memmap vectors.o blinker02.clang.bc | ||
opt $(OOPS) blinker02.clang.bc -o blinker02.clang.opt.bc | ||
llc $(LLCOPS) blinker02.clang.opt.bc -o blinker02.clang.opt.s | ||
$(ARMGNU)-as blinker02.clang.opt.s -o blinker02.clang.opt.o | ||
$(ARMGNU)-ld -o blinker02.clang.opt.elf -T memmap vectors.o blinker02.clang.opt.o | ||
$(ARMGNU)-objdump -D blinker02.clang.opt.elf > blinker02.clang.opt.list | ||
|
||
blinker02.clang.hex : blinker02.clang.opt.elf | ||
$(ARMGNU)-objcopy blinker02.clang.opt.elf blinker02.clang.hex -O ihex | ||
|
||
blinker02.clang.bin : blinker02.clang.opt.elf | ||
$(ARMGNU)-objcopy blinker02.clang.opt.elf blinker02.clang.bin -O binary | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
See the top level README for information on where to find the | ||
schematic and programmers reference manual for the ARM processor | ||
on the raspberry pi. Also find information on how to load and run | ||
these programs. | ||
|
||
Same as blinker02 in the directory above, except the raspberry pi 1 | ||
A+ and B+ have two leds one on gpio47 the other gpio35. | ||
|
||
I tested this on an A+. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
//------------------------------------------------------------------------- | ||
//------------------------------------------------------------------------- | ||
|
||
extern void PUT32 ( unsigned int, unsigned int ); | ||
extern unsigned int GET32 ( unsigned int ); | ||
extern void dummy ( unsigned int ); | ||
|
||
#define SYSTIMERCLO 0x20003004 | ||
#define GPFSEL3 0x2020000C | ||
#define GPFSEL4 0x20200010 | ||
#define GPSET1 0x20200020 | ||
#define GPCLR1 0x2020002C | ||
|
||
//0x01000000 17 seconds | ||
//0x00400000 4 seconds | ||
#define TIMER_BIT 0x00400000 | ||
|
||
//------------------------------------------------------------------------- | ||
int notmain ( void ) | ||
{ | ||
unsigned int ra; | ||
|
||
ra=GET32(GPFSEL4); | ||
ra&=~(7<<21); | ||
ra|=1<<21; | ||
PUT32(GPFSEL4,ra); | ||
|
||
ra=GET32(GPFSEL3); | ||
ra&=~(7<<15); | ||
ra|=1<<15; | ||
PUT32(GPFSEL3,ra); | ||
|
||
|
||
while(1) | ||
{ | ||
PUT32(GPSET1,1<<(47-32)); | ||
PUT32(GPCLR1,1<<(35-32)); | ||
while(1) | ||
{ | ||
ra=GET32(SYSTIMERCLO); | ||
if((ra&=TIMER_BIT)==TIMER_BIT) break; | ||
} | ||
PUT32(GPCLR1,1<<(47-32)); | ||
PUT32(GPSET1,1<<(35-32)); | ||
while(1) | ||
{ | ||
ra=GET32(SYSTIMERCLO); | ||
if((ra&=TIMER_BIT)==0) break; | ||
} | ||
} | ||
return(0); | ||
} | ||
//------------------------------------------------------------------------- | ||
//------------------------------------------------------------------------- | ||
|
||
|
||
//------------------------------------------------------------------------- | ||
// | ||
// Copyright (c) 2012 David Welch [email protected] | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
//------------------------------------------------------------------------- |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
MEMORY | ||
{ | ||
ram : ORIGIN = 0x8000, LENGTH = 0x1000 | ||
} | ||
|
||
SECTIONS | ||
{ | ||
.text : { *(.text*) } > ram | ||
.bss : { *(.bss*) } > ram | ||
} |
Oops, something went wrong.