Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Thanks to Martin Capitanio and the linux code at http://capitanio.org…
…/mlink/index.html Was able to take my new stm32 value line discovery and load a simple program into sram and run it. So far all it does is blink the green and blue leds.
- Loading branch information
Showing
10 changed files
with
1,398 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
ARMGNU = arm-none-linux-gnueabi | ||
|
||
ARCH = -mcpu=cortex-m3 | ||
#ARCH = | ||
AOPS = --warn --fatal-warnings -mthumb $(ARCH) | ||
COPS = -Wall -Werror -O2 -nostdlib -nostartfiles -ffreestanding -mthumb $(ARCH) | ||
|
||
|
||
all : blinker.bin | ||
|
||
clean : | ||
rm -f *.o | ||
rm -f *.elf | ||
rm -f *.list | ||
rm -f *.bin | ||
|
||
blinker.elf : blinker.o vectors.o memmap | ||
$(ARMGNU)-ld -T memmap vectors.o blinker.o -o blinker.elf | ||
$(ARMGNU)-objdump -D blinker.elf > blinker.list | ||
|
||
blinker.o : blinker.c | ||
$(ARMGNU)-gcc $(COPS) -c blinker.c -o blinker.o | ||
|
||
vectors.o : vectors.s | ||
$(ARMGNU)-as $(AOPS) vectors.s -o vectors.o | ||
|
||
|
||
blinker.bin : blinker.elf | ||
$(ARMGNU)-objcopy blinker.elf -O binary blinker.bin | ||
|
||
|
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,34 @@ | ||
|
||
void PUT32 ( unsigned int, unsigned int ); | ||
unsigned int GET32 ( unsigned int ); | ||
|
||
#define GPIOCBASE 0x40011000 | ||
|
||
int notmain ( void ) | ||
{ | ||
|
||
volatile unsigned int ra; | ||
unsigned int rb; | ||
unsigned int rc; | ||
|
||
//Blue LED on PORT C bit 8 | ||
//Green LED on PORT C bit 9 | ||
|
||
//output push-pull b0001 | ||
ra=GET32(GPIOCBASE+0x04); | ||
ra&=(~(0xF<<16)); | ||
ra|=0x1<<16; | ||
PUT32(GPIOCBASE+0x04,ra); | ||
|
||
rb=GET32(GPIOCBASE+0x0C); | ||
rc=rb|(3<<8); | ||
rb&=(~(3<<8)); | ||
while(1) | ||
{ | ||
PUT32(GPIOCBASE+0x0C,rb); | ||
for(ra=0;ra<1000000;ra++) continue; | ||
PUT32(GPIOCBASE+0x0C,rc); | ||
for(ra=0;ra<1000000;ra++) continue; | ||
} | ||
return(0); | ||
} |
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 = 0x20000000, LENGTH = 0x10000 | ||
} | ||
|
||
SECTIONS | ||
{ | ||
.text : { *(.text*) } > ram | ||
} | ||
|
Binary file not shown.
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,3 @@ | ||
Martin Capitanio <m@capitanio.org> | ||
Spencer Oliver <spen@spen-soft.co.uk> | ||
Lementec Fabien <fabien.lementec@gmail.com> |
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,27 @@ | ||
Copyright (c) 2011 The "Capt'ns Missing Link" Authors. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following disclaimer | ||
in the documentation and/or other materials provided with the | ||
distribution. | ||
* Neither the name of Martin Capitanio nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,5 @@ | ||
cd build | ||
make | ||
|
||
edit Makefile | ||
make run |
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,27 @@ | ||
PRG := stlink-access-test | ||
DEV := /dev/sg2 | ||
|
||
all: $(PRG) | ||
|
||
LIBS := \ | ||
-lsgutils2 | ||
|
||
OBJS += \ | ||
stlink-access-test.o | ||
|
||
$(PRG): $(OBJS) | ||
@echo 'Invoking: GCC C Linker' | ||
gcc -o$(PRG) $(OBJS) $(LIBS) | ||
|
||
%.o: ../src/%.c | ||
@echo 'Building file: $<' | ||
gcc -O0 -g3 -Wall -c -fmessage-length=0 -std=gnu99 -MMD -MP \ | ||
-MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"\ | ||
-o"$@" "$<" | ||
|
||
clean: | ||
@rm -vf *.d *.o $(PRG) | ||
|
||
run: all | ||
cp $(PRG) /tmp/ | ||
sudo /tmp/$(PRG) $(DEV) |
Oops, something went wrong.