From f7b25fa1bf55e332b9aa2a60f1f0a059c38c1127 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= Date: Fri, 19 Nov 2010 13:32:48 +0000 Subject: [PATCH] cleanup: no carriage return, just line feed! MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Asbjørn Sloth Tønnesen --- README | 4 +- bitbucket_lpc1768/CMSIS/system_LPC17xx.d | 16 +-- bitbucket_lpc1768/lpcrc/Makefile | 24 ++-- bitbucket_lpc1768/lpcrc/lpcrc.c | 194 ++++++++++++------------- bitbucket_lpc1768/main.d | 20 +-- bitbucket_lpc1768/main.dump | 122 ++++++++-------- bitbucket_lpc1768/main.map | 230 +++++++++++++++--------------- bitbucket_lpc1768/openocd.cfg | 6 +- bitbucket_lpc1768/quiet | 124 ++++++++-------- bitbucket_lpc1768/startup.d | 16 +-- lpc176x/Makefile | 40 +++--- lpc176x/main.c | 12 +- lpc176x/sysinit.c | 164 ++++++++++----------- lpc176x/sysinit.h | 2 +- new_cmsis/.gdbinit | 2 +- new_cmsis/Makefile | 52 +++---- new_cmsis/openocd.cfg | 4 +- 17 files changed, 516 insertions(+), 516 deletions(-) diff --git a/README b/README index 713786a..b94ff4e 100644 --- a/README +++ b/README @@ -1,2 +1,2 @@ -Steff test -Svenne test +Steff test +Svenne test diff --git a/bitbucket_lpc1768/CMSIS/system_LPC17xx.d b/bitbucket_lpc1768/CMSIS/system_LPC17xx.d index 5a903d2..2b7fdc4 100644 --- a/bitbucket_lpc1768/CMSIS/system_LPC17xx.d +++ b/bitbucket_lpc1768/CMSIS/system_LPC17xx.d @@ -1,8 +1,8 @@ -system_LPC17xx.o: CMSIS/system_LPC17xx.c CMSIS/LPC17xx.h CMSIS/core_cm3.h \ - CMSIS/system_LPC17xx.h - -CMSIS/LPC17xx.h: - -CMSIS/core_cm3.h: - -CMSIS/system_LPC17xx.h: +system_LPC17xx.o: CMSIS/system_LPC17xx.c CMSIS/LPC17xx.h CMSIS/core_cm3.h \ + CMSIS/system_LPC17xx.h + +CMSIS/LPC17xx.h: + +CMSIS/core_cm3.h: + +CMSIS/system_LPC17xx.h: diff --git a/bitbucket_lpc1768/lpcrc/Makefile b/bitbucket_lpc1768/lpcrc/Makefile index 6957146..f7c03d3 100644 --- a/bitbucket_lpc1768/lpcrc/Makefile +++ b/bitbucket_lpc1768/lpcrc/Makefile @@ -1,12 +1,12 @@ -CC = gcc -LD = gcc -LDFLAGS = -Wall -O4 -std=c99 -EXES = lpcrc - -all: $(EXES) - -% : %.c - $(LD) $(LDFLAGS) -o $@ $< - -clean: - rm -f $(EXES) +CC = gcc +LD = gcc +LDFLAGS = -Wall -O4 -std=c99 +EXES = lpcrc + +all: $(EXES) + +% : %.c + $(LD) $(LDFLAGS) -o $@ $< + +clean: + rm -f $(EXES) diff --git a/bitbucket_lpc1768/lpcrc/lpcrc.c b/bitbucket_lpc1768/lpcrc/lpcrc.c index ed316b2..e811c45 100644 --- a/bitbucket_lpc1768/lpcrc/lpcrc.c +++ b/bitbucket_lpc1768/lpcrc/lpcrc.c @@ -1,97 +1,97 @@ -/* - * Software License Agreement (BSD License) - * - * Copyright (c) 2010, Roel Verdult - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * 3. Neither the name of the copyright holders 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 ''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 HOLDERS 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. - * - */ - -#include -#include - -#define BLOCK_COUNT 7 -#define BLOCK_LENGTH 4 -#define BLOCK_TOTAL (BLOCK_COUNT*BLOCK_LENGTH) - -typedef unsigned char byte_t; - -int main(int argc, char *argv[]) -{ - FILE* pf; - byte_t buf[BLOCK_TOTAL]; - uint32_t crc = 0; - uint32_t block; - - // Check for required arguments - if (argc < 2) - { - printf("syntax: lpcrc \n"); - return 1; - } - - // Try to open the supplied firmware - if ((pf = fopen(argv[1],"rb+")) == NULL) - { - printf("error: could not open file [%s] with write access\n",argv[1]); - return 1; - } - - // Read out the data blocks used for crc calculation - if (fread(buf,1,BLOCK_TOTAL,pf) != BLOCK_TOTAL) - { - printf("error: could not read required bytes\n"); - fclose(pf); - return 1; - } - - // Compute the crc value - for (block=0; block +#include + +#define BLOCK_COUNT 7 +#define BLOCK_LENGTH 4 +#define BLOCK_TOTAL (BLOCK_COUNT*BLOCK_LENGTH) + +typedef unsigned char byte_t; + +int main(int argc, char *argv[]) +{ + FILE* pf; + byte_t buf[BLOCK_TOTAL]; + uint32_t crc = 0; + uint32_t block; + + // Check for required arguments + if (argc < 2) + { + printf("syntax: lpcrc \n"); + return 1; + } + + // Try to open the supplied firmware + if ((pf = fopen(argv[1],"rb+")) == NULL) + { + printf("error: could not open file [%s] with write access\n",argv[1]); + return 1; + } + + // Read out the data blocks used for crc calculation + if (fread(buf,1,BLOCK_TOTAL,pf) != BLOCK_TOTAL) + { + printf("error: could not read required bytes\n"); + fclose(pf); + return 1; + } + + // Compute the crc value + for (block=0; block&2 - -rm -f quiet.log -"$@" 2>> quiet.log -RET=$? -# if we check $? we won't notice the warnings -if [ $RET -ne 0 -o -s quiet.log ]; then - echo "$@" >& 2 - if [ $RET -ne 0 ]; then - $RED >& 2 - else - $YELLOW >& 2 - fi - cat quiet.log >& 2 - $NORM &> 2 - - exit $RET -else - $GREEN >& 2 - printf "${MSG}\n" 1>&2 - $NORM >& 2 -fi -rm quiet.log -exit $RET +#!/bin/sh +HELP='Usage: + quiet fname cmd args ... + +Runs the passed in command printing only "cmd" and "fname" unless an +error occurs in which case it prints the whole command line and +colorized program output. Useful for running compilation commands since +it removes the cluter, making it easier to spot errors and warnings. + +' +# Copyright (c) 2008-2010 LoEE +# This program is released under the new BSD license. + +if [ $# -lt 2 ]; then + printf "$HELP" + exit +fi + +GREEN="" +RED="" +NORM="" +if [ "$TERM@" = "rxvt@" ]; then + GREEN="printf \033[32m" + RED="printf \033[31m" + YELLOW="printf \033[33m" # this is not yellow :) + NORM="printf \033[m\017" +fi +if [ "$OSTYPE@" = "msys@" ]; then + OLDATTR=$(eecolor.exe) + GREEN="eecolor.exe 0 10" + RED="eecolor.exe 0 12" + YELLOW="eecolor 0 14" + NORM="eecolor.exe ${OLDATTR}" +fi + +MSG="$(printf "%-16s $1" "$2")" +shift; + +printf "${MSG}\r" 1>&2 + +rm -f quiet.log +"$@" 2>> quiet.log +RET=$? +# if we check $? we won't notice the warnings +if [ $RET -ne 0 -o -s quiet.log ]; then + echo "$@" >& 2 + if [ $RET -ne 0 ]; then + $RED >& 2 + else + $YELLOW >& 2 + fi + cat quiet.log >& 2 + $NORM &> 2 + + exit $RET +else + $GREEN >& 2 + printf "${MSG}\n" 1>&2 + $NORM >& 2 +fi +rm quiet.log +exit $RET diff --git a/bitbucket_lpc1768/startup.d b/bitbucket_lpc1768/startup.d index ced91ea..1505e22 100644 --- a/bitbucket_lpc1768/startup.d +++ b/bitbucket_lpc1768/startup.d @@ -1,8 +1,8 @@ -startup.o: startup.c CMSIS/LPC17xx.h CMSIS/core_cm3.h \ - CMSIS/system_LPC17xx.h - -CMSIS/LPC17xx.h: - -CMSIS/core_cm3.h: - -CMSIS/system_LPC17xx.h: +startup.o: startup.c CMSIS/LPC17xx.h CMSIS/core_cm3.h \ + CMSIS/system_LPC17xx.h + +CMSIS/LPC17xx.h: + +CMSIS/core_cm3.h: + +CMSIS/system_LPC17xx.h: diff --git a/lpc176x/Makefile b/lpc176x/Makefile index fe29076..68b4885 100644 --- a/lpc176x/Makefile +++ b/lpc176x/Makefile @@ -1,20 +1,20 @@ -CROSS_COMPILE ?= arm-none-eabi -CC=$(CROSS_COMPILE)-gcc -LD=$(CROSS_COMPILE)-ld -AR=$(CROSS_COMPILE)-ar -AS=$(CROSS_COMPILE)-as -STRINGS=$(CROSS_COMPILE)-strings -STRIP=$(CROSS_COMPILE)-strip -OBJCOPY=$(CROSS_COMPILE)-objcopy -OBJDUMP=$(CROSS_COMPILE)-objdump - -LDFLAGS=-nostdlib - -ALL=main -OBJS=main.o sysinit.o - -$(ALL): $(OBJS) - -.PHONY: clean -clean: - rm -f $(ALL) $(OBJS) +CROSS_COMPILE ?= arm-none-eabi +CC=$(CROSS_COMPILE)-gcc +LD=$(CROSS_COMPILE)-ld +AR=$(CROSS_COMPILE)-ar +AS=$(CROSS_COMPILE)-as +STRINGS=$(CROSS_COMPILE)-strings +STRIP=$(CROSS_COMPILE)-strip +OBJCOPY=$(CROSS_COMPILE)-objcopy +OBJDUMP=$(CROSS_COMPILE)-objdump + +LDFLAGS=-nostdlib + +ALL=main +OBJS=main.o sysinit.o + +$(ALL): $(OBJS) + +.PHONY: clean +clean: + rm -f $(ALL) $(OBJS) diff --git a/lpc176x/main.c b/lpc176x/main.c index fe8fd4d..752b578 100644 --- a/lpc176x/main.c +++ b/lpc176x/main.c @@ -1,6 +1,6 @@ -#include "sysinit.h" - -int main(int argc, char **argv) { - sysinit(); - return 0; -} +#include "sysinit.h" + +int main(int argc, char **argv) { + sysinit(); + return 0; +} diff --git a/lpc176x/sysinit.c b/lpc176x/sysinit.c index c64c591..89a1735 100644 --- a/lpc176x/sysinit.c +++ b/lpc176x/sysinit.c @@ -1,82 +1,82 @@ -void sysinit() { - // xtal_freq = 12000000; - - volatile int *scs; - scs = (int *)0x400fc1a0; - // enable main oscillator - *scs = 0x20; - - // wait for oscillator to get ready - while ((*scs & (1<<6)) == 0); - - volatile int *cclkcfg; - cclkcfg = (int *)0x400FC104; - // set clockdivider to 1/4x - *cclkcfg = 0x03; - - // peripheral clocks (all set to 1/4x cclk) - volatile int *pclksel0, *pclksel1; - pclksel0=(int *)0x400FC1A8; - *pclksel0 = 0; - pclksel1=(int *)0x400FC1AC; - *pclksel1 = 0; - - // main clock set (pll0) - volatile int *clksrcsel; - clksrcsel = (int *)0x400FC10C; - *clksrcsel = 0x01; - - volatile int *pll0con, *pll0stat, *pll0feed, *pll0cfg; - pll0con=(int*)0x400FC080; - pll0stat=(int *)0x400FC088; - // pll0feed : feed 0xAA followed by 0x55 to feed - pll0feed=(int *)0x400FC08C; - pll0cfg=(int *)0x400FC084; - - // FORMULA = FCCO = (2 * M * FIN) / N - // as Xtal (FIN) is 12MHz, N = 6 , M = 25 gives 100 MHz - // as both msel and nsel stores "N-1" store 24 and 5 - *pll0cfg = 24 | (5 << 16); - - // feed to set clock - *pll0feed = 0xaa; - *pll0feed = 0x55; - - - // enable pll0 - *pll0con = 0x01; - *pll0feed = 0xaa; - *pll0feed = 0x55; - - // wait for enable - while (!(*pll0stat & (1<<26))); - - // lock pll0 - *pll0con = 0x03; - *pll0feed = 0xaa; - *pll0feed = 0x55; - - // wait for lock - while (!(*pll0stat & ((1<<25) | (1<<24)))); - - volatile int *pll1con, *pll1cfg, *pll1stat, *pll1feed; - pll1con=(int *)0x400FC0A0; - pll1cfg=(int *)0x400FC0A4; - pll1stat=(int *)0x400FC0A8; - pll1feed=(int *)0x400FC0AC; - - // setup pll1 (multiplier 4, divider 6) - *pll1cfg = 3 | (0x01 << 5); - - // enable pll1 - *pll1con = 0x01; - *pll1feed = 0xaa; - *pll1feed = 0x55; - while (!(*pll1stat & (1<<10))); - - // connect pll1 - *pll1con = 0x03; - *pll1feed = 0xaa; - *pll1feed = 0x55; - while (!(*pll1stat & ((1<< 9) | (1<< 8)))); -} +void sysinit() { + // xtal_freq = 12000000; + + volatile int *scs; + scs = (int *)0x400fc1a0; + // enable main oscillator + *scs = 0x20; + + // wait for oscillator to get ready + while ((*scs & (1<<6)) == 0); + + volatile int *cclkcfg; + cclkcfg = (int *)0x400FC104; + // set clockdivider to 1/4x + *cclkcfg = 0x03; + + // peripheral clocks (all set to 1/4x cclk) + volatile int *pclksel0, *pclksel1; + pclksel0=(int *)0x400FC1A8; + *pclksel0 = 0; + pclksel1=(int *)0x400FC1AC; + *pclksel1 = 0; + + // main clock set (pll0) + volatile int *clksrcsel; + clksrcsel = (int *)0x400FC10C; + *clksrcsel = 0x01; + + volatile int *pll0con, *pll0stat, *pll0feed, *pll0cfg; + pll0con=(int*)0x400FC080; + pll0stat=(int *)0x400FC088; + // pll0feed : feed 0xAA followed by 0x55 to feed + pll0feed=(int *)0x400FC08C; + pll0cfg=(int *)0x400FC084; + + // FORMULA = FCCO = (2 * M * FIN) / N + // as Xtal (FIN) is 12MHz, N = 6 , M = 25 gives 100 MHz + // as both msel and nsel stores "N-1" store 24 and 5 + *pll0cfg = 24 | (5 << 16); + + // feed to set clock + *pll0feed = 0xaa; + *pll0feed = 0x55; + + + // enable pll0 + *pll0con = 0x01; + *pll0feed = 0xaa; + *pll0feed = 0x55; + + // wait for enable + while (!(*pll0stat & (1<<26))); + + // lock pll0 + *pll0con = 0x03; + *pll0feed = 0xaa; + *pll0feed = 0x55; + + // wait for lock + while (!(*pll0stat & ((1<<25) | (1<<24)))); + + volatile int *pll1con, *pll1cfg, *pll1stat, *pll1feed; + pll1con=(int *)0x400FC0A0; + pll1cfg=(int *)0x400FC0A4; + pll1stat=(int *)0x400FC0A8; + pll1feed=(int *)0x400FC0AC; + + // setup pll1 (multiplier 4, divider 6) + *pll1cfg = 3 | (0x01 << 5); + + // enable pll1 + *pll1con = 0x01; + *pll1feed = 0xaa; + *pll1feed = 0x55; + while (!(*pll1stat & (1<<10))); + + // connect pll1 + *pll1con = 0x03; + *pll1feed = 0xaa; + *pll1feed = 0x55; + while (!(*pll1stat & ((1<< 9) | (1<< 8)))); +} diff --git a/lpc176x/sysinit.h b/lpc176x/sysinit.h index c409b71..cd30e1b 100644 --- a/lpc176x/sysinit.h +++ b/lpc176x/sysinit.h @@ -1 +1 @@ -void sysinit(); +void sysinit(); diff --git a/new_cmsis/.gdbinit b/new_cmsis/.gdbinit index 6b85ea0..702cc6e 100644 --- a/new_cmsis/.gdbinit +++ b/new_cmsis/.gdbinit @@ -1 +1 @@ -target remote localhost:3333 +target remote localhost:3333 diff --git a/new_cmsis/Makefile b/new_cmsis/Makefile index f320ab3..f143b3b 100644 --- a/new_cmsis/Makefile +++ b/new_cmsis/Makefile @@ -1,26 +1,26 @@ -PROJECT=rapper -PLATFORM ?= arm-none-eabi -LDFLAGS=--gc-sections -g -T LPC1768-flash.ld -CFLAGS=-W -Wall --std=gnu99 -fgnu89-inline -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections -I. -g -#CFLAGS+=-Os - -# objects are separated by space -OBJECTS=startup.o system_LPC17xx.o main.o core_cm3.o - - -all: $(PROJECT).elf - -$(PROJECT).elf: $(OBJECTS) - $(PLATFORM)-ld -Map $(PROJECT).map $(LDFLAGS) $(OBJECTS) -o $@ - -%.o: %.c - $(PLATFORM)-gcc -MM $< -MF $(patsubst %.o,%.d,$@) -MP - $(PLATFORM)-gcc $(CFLAGS) -c $< -o $@ - -.PHONY: clean gdb - -clean: - rm -f $(PROJECT).elf $(OBJECTS) $(OBJECTS:.o=.d) $(PROJECT).map - -gdb: - $(PLATFORM)-gdb $(PROJECT).elf +PROJECT=rapper +PLATFORM ?= arm-none-eabi +LDFLAGS=--gc-sections -g -T LPC1768-flash.ld +CFLAGS=-W -Wall --std=gnu99 -fgnu89-inline -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections -I. -g +#CFLAGS+=-Os + +# objects are separated by space +OBJECTS=startup.o system_LPC17xx.o main.o core_cm3.o + + +all: $(PROJECT).elf + +$(PROJECT).elf: $(OBJECTS) + $(PLATFORM)-ld -Map $(PROJECT).map $(LDFLAGS) $(OBJECTS) -o $@ + +%.o: %.c + $(PLATFORM)-gcc -MM $< -MF $(patsubst %.o,%.d,$@) -MP + $(PLATFORM)-gcc $(CFLAGS) -c $< -o $@ + +.PHONY: clean gdb + +clean: + rm -f $(PROJECT).elf $(OBJECTS) $(OBJECTS:.o=.d) $(PROJECT).map + +gdb: + $(PLATFORM)-gdb $(PROJECT).elf diff --git a/new_cmsis/openocd.cfg b/new_cmsis/openocd.cfg index 45dba2e..8780393 100644 --- a/new_cmsis/openocd.cfg +++ b/new_cmsis/openocd.cfg @@ -1,2 +1,2 @@ -source [find interface/ngxtech.cfg] -source [find target/lpc1768.cfg] +source [find interface/ngxtech.cfg] +source [find target/lpc1768.cfg] -- 1.7.10.4