added a blinker01 example for the A+ and B+
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
|
||||
ARMGNU ?= arm-none-eabi
|
||||
|
||||
AOPS = --warn --fatal-warnings
|
||||
COPS = -Wall -Werror -O2 -nostdlib -nostartfiles -ffreestanding
|
||||
|
||||
|
||||
|
||||
gcc : blinker01.hex blinker01.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
|
||||
|
||||
blinker01.o : blinker01.c
|
||||
$(ARMGNU)-gcc $(COPS) -c blinker01.c -o blinker01.o
|
||||
|
||||
blinker01.elf : memmap vectors.o blinker01.o
|
||||
$(ARMGNU)-ld vectors.o blinker01.o -T memmap -o blinker01.elf
|
||||
$(ARMGNU)-objdump -D blinker01.elf > blinker01.list
|
||||
|
||||
blinker01.bin : blinker01.elf
|
||||
$(ARMGNU)-objcopy blinker01.elf -O binary blinker01.bin
|
||||
|
||||
blinker01.hex : blinker01.elf
|
||||
$(ARMGNU)-objcopy blinker01.elf -O ihex blinker01.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 : blinker01.clang.hex blinker01.clang.bin
|
||||
|
||||
|
||||
blinker01.clang.bc : blinker01.c
|
||||
clang $(LOPS) -c blinker01.c -o blinker01.clang.bc
|
||||
|
||||
blinker01.clang.opt.elf : memmap vectors.o blinker01.clang.bc
|
||||
opt $(OOPS) blinker01.clang.bc -o blinker01.clang.opt.bc
|
||||
llc $(LLCOPS) blinker01.clang.opt.bc -o blinker01.clang.opt.s
|
||||
$(ARMGNU)-as blinker01.clang.opt.s -o blinker01.clang.opt.o
|
||||
$(ARMGNU)-ld -o blinker01.clang.opt.elf -T memmap vectors.o blinker01.clang.opt.o
|
||||
$(ARMGNU)-objdump -D blinker01.clang.opt.elf > blinker01.clang.opt.list
|
||||
|
||||
blinker01.clang.hex : blinker01.clang.opt.elf
|
||||
$(ARMGNU)-objcopy blinker01.clang.opt.elf blinker01.clang.hex -O ihex
|
||||
|
||||
blinker01.clang.bin : blinker01.clang.opt.elf
|
||||
$(ARMGNU)-objcopy blinker01.clang.opt.elf blinker01.clang.bin -O binary
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
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 blinker01 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+. I probably have a B+ around somewhere, but
|
||||
not sure where. The A+ does appear to have two leds and they are both
|
||||
blinking.
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
extern void PUT32 ( unsigned int, unsigned int );
|
||||
extern unsigned int GET32 ( unsigned int );
|
||||
extern void dummy ( unsigned int );
|
||||
|
||||
#define GPFSEL3 0x2020000C
|
||||
#define GPFSEL4 0x20200010
|
||||
#define GPSET1 0x20200020
|
||||
#define GPCLR1 0x2020002C
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
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));
|
||||
for(ra=0;ra<0x100000;ra++) dummy(ra);
|
||||
PUT32(GPCLR1,1<<(47-32));
|
||||
PUT32(GPSET1,1<<(35-32));
|
||||
for(ra=0;ra<0x100000;ra++) dummy(ra);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2015 David Welch dwelch@dwelch.com
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
ram : ORIGIN = 0x8000, LENGTH = 0x10000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text : { *(.text*) } > ram
|
||||
.bss : { *(.bss*) } > ram
|
||||
}
|
||||
@@ -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 dwelch@dwelch.com
|
||||
;@
|
||||
;@ 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.
|
||||
;@
|
||||
;@-------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user