added a blinker01 example for the A+ and B+
This commit is contained in:
@@ -6,8 +6,9 @@ these programs.
|
||||
|
||||
The code in this directory is for the old/original-ish raspberry pi
|
||||
which you can still get raspberry pi 1 if you will. The pi2 directory
|
||||
is for the raspberry pi 2 the one with the quad core arm. You have to
|
||||
match the right program to the right raspberry pi.
|
||||
is for the raspberry pi 2 the one with the quad core arm. The plus
|
||||
directory is for the raspberry pi B+ and A+. You have to match the
|
||||
right program to the right raspberry pi.
|
||||
|
||||
This simple example sets up a small stack, not much to this program
|
||||
so the stack doesnt need much room. It then enables gpio16 as
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,10 +1,10 @@
|
||||
:1080000002D9A0E3050000EBFEFFFFEA001080E5C7
|
||||
:108010001EFF2FE1000090E51EFF2FE11EFF2FE164
|
||||
:1080200010402DE95C009FE5F9FFFFEB0717C0E367
|
||||
:10803000011781E34C009FE5F3FFFFEB48009FE54C
|
||||
:108040000118A0E3F0FFFFEB0040A0E30400A0E173
|
||||
:10803000011781E34C009FE5F3FFFFEB0118A0E37C
|
||||
:1080400044009FE5F0FFFFEB0040A0E30400A0E147
|
||||
:10805000014084E2F0FFFFEB010654E3FAFFFF1A50
|
||||
:1080600028009FE50118A0E3E7FFFFEB0040A0E335
|
||||
:108060000118A0E324009FE5E7FFFFEB0040A0E339
|
||||
:108070000400A0E1014084E2E7FFFFEB010654E3C6
|
||||
:10808000FAFFFF1AECFFFFEA040020201C0020206A
|
||||
:048090002800202084
|
||||
|
||||
@@ -30,8 +30,8 @@ Disassembly of section .text:
|
||||
8030: e3811701 orr r1, r1, #262144 ; 0x40000
|
||||
8034: e59f004c ldr r0, [pc, #76] ; 8088 <notmain+0x68>
|
||||
8038: ebfffff3 bl 800c <PUT32>
|
||||
803c: e59f0048 ldr r0, [pc, #72] ; 808c <notmain+0x6c>
|
||||
8040: e3a01801 mov r1, #65536 ; 0x10000
|
||||
803c: e3a01801 mov r1, #65536 ; 0x10000
|
||||
8040: e59f0044 ldr r0, [pc, #68] ; 808c <notmain+0x6c>
|
||||
8044: ebfffff0 bl 800c <PUT32>
|
||||
8048: e3a04000 mov r4, #0
|
||||
804c: e1a00004 mov r0, r4
|
||||
@@ -39,8 +39,8 @@ Disassembly of section .text:
|
||||
8054: ebfffff0 bl 801c <dummy>
|
||||
8058: e3540601 cmp r4, #1048576 ; 0x100000
|
||||
805c: 1afffffa bne 804c <notmain+0x2c>
|
||||
8060: e59f0028 ldr r0, [pc, #40] ; 8090 <notmain+0x70>
|
||||
8064: e3a01801 mov r1, #65536 ; 0x10000
|
||||
8060: e3a01801 mov r1, #65536 ; 0x10000
|
||||
8064: e59f0024 ldr r0, [pc, #36] ; 8090 <notmain+0x70>
|
||||
8068: ebffffe7 bl 800c <PUT32>
|
||||
806c: e3a04000 mov r4, #0
|
||||
8070: e1a00004 mov r0, r4
|
||||
@@ -61,10 +61,10 @@ Disassembly of section .ARM.attributes:
|
||||
8: 01006962 tsteq r0, r2, ror #18
|
||||
c: 00000020 andeq r0, r0, r0, lsr #32
|
||||
10: 4d524105 ldfmie f4, [r2, #-20] ; 0xffffffec
|
||||
14: 54347620 ldrtpl r7, [r4], #-1568 ; 0x620
|
||||
14: 54347620 ldrtpl r7, [r4], #-1568 ; 0xfffff9e0
|
||||
18: 08020600 stmdaeq r2, {r9, sl}
|
||||
1c: 12010901 andne r0, r1, #16384 ; 0x4000
|
||||
20: 15011404 strne r1, [r1, #-1028] ; 0x404
|
||||
20: 15011404 strne r1, [r1, #-1028] ; 0xfffffbfc
|
||||
24: 18031701 stmdane r3, {r0, r8, r9, sl, ip}
|
||||
28: Address 0x0000000000000028 is out of bounds.
|
||||
|
||||
@@ -74,6 +74,6 @@ Disassembly of section .comment:
|
||||
00000000 <.comment>:
|
||||
0: 3a434347 bcc 10d0d24 <notmain+0x10c8d04>
|
||||
4: 4e472820 cdpmi 8, 4, cr2, cr7, cr0, {1}
|
||||
8: 34202955 strtcc r2, [r0], #-2389 ; 0x955
|
||||
c: 322e382e eorcc r3, lr, #3014656 ; 0x2e0000
|
||||
8: 35202955 strcc r2, [r0, #-2389]! ; 0xfffff6ab
|
||||
c: 302e332e eorcc r3, lr, lr, lsr #6
|
||||
...
|
||||
|
||||
Binary file not shown.
@@ -7,6 +7,11 @@ extern unsigned int GET32 ( unsigned int );
|
||||
extern void dummy ( unsigned int );
|
||||
extern void HOP ( unsigned int );
|
||||
|
||||
void put32(unsigned long int addr, unsigned long int val) {
|
||||
volatile unsigned long int *a;
|
||||
a = addr;
|
||||
*a = val;
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
int notmain ( void )
|
||||
{
|
||||
@@ -25,7 +30,7 @@ int notmain ( void )
|
||||
PUT32(ra,0xe3811902); ra+=4;
|
||||
PUT32(ra,0xe580100c); ra+=4;
|
||||
PUT32(ra,0xe3a02902); ra+=4;
|
||||
PUT32(ra,0xe3a03008); ra+=4;
|
||||
put32(ra,0xe3a03008); ra+=4;
|
||||
PUT32(ra,0xe5802020); ra+=4;
|
||||
PUT32(ra,0xe580302c); ra+=4;
|
||||
PUT32(ra,0xe3a04601); ra+=4;
|
||||
|
||||
70
blinker01/plus/Makefile
Normal file
70
blinker01/plus/Makefile
Normal file
@@ -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
|
||||
|
||||
|
||||
12
blinker01/plus/README
Normal file
12
blinker01/plus/README
Normal file
@@ -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.
|
||||
55
blinker01/plus/blinker01.c
Normal file
55
blinker01/plus/blinker01.c
Normal file
@@ -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.
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
11
blinker01/plus/memmap
Normal file
11
blinker01/plus/memmap
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
ram : ORIGIN = 0x8000, LENGTH = 0x10000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text : { *(.text*) } > ram
|
||||
.bss : { *(.bss*) } > ram
|
||||
}
|
||||
39
blinker01/plus/vectors.s
Normal file
39
blinker01/plus/vectors.s
Normal file
@@ -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.
|
||||
;@
|
||||
;@-------------------------------------------------------------------------
|
||||
Binary file not shown.
Reference in New Issue
Block a user