started firmware directory with some basic stuff
This commit is contained in:
3
firmware/README
Normal file
3
firmware/README
Normal file
@ -0,0 +1,3 @@
|
||||
The firmware is set up for compilation with the GCC toolchain available here:
|
||||
|
||||
https://code.launchpad.net/gcc-arm-embedded
|
11
firmware/blinky/.svn/all-wcprops
Normal file
11
firmware/blinky/.svn/all-wcprops
Normal file
@ -0,0 +1,11 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 53
|
||||
/svnroot/ubertooth/!svn/ver/290/trunk/firmware/blinky
|
||||
END
|
||||
Makefile
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 62
|
||||
/svnroot/ubertooth/!svn/ver/290/trunk/firmware/blinky/Makefile
|
||||
END
|
130
firmware/blinky/.svn/entries
Normal file
130
firmware/blinky/.svn/entries
Normal file
@ -0,0 +1,130 @@
|
||||
10
|
||||
|
||||
dir
|
||||
521
|
||||
https://ubertooth.svn.sourceforge.net/svnroot/ubertooth/trunk/firmware/blinky
|
||||
https://ubertooth.svn.sourceforge.net/svnroot/ubertooth
|
||||
|
||||
|
||||
|
||||
2011-07-10T13:32:39.197284Z
|
||||
290
|
||||
dspill
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
d7262849-8e69-412d-bc16-bc45eed4bc56
|
||||
|
||||
blinky.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-12-02T23:22:44.000000Z
|
||||
60483a461451553a1a6de27972e8ba60
|
||||
2010-12-02T23:22:56.790894Z
|
||||
42
|
||||
ossmann
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
979
|
||||
|
||||
Makefile
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-10T21:06:49.000000Z
|
||||
33b65970a295f421b0b601f6ab457ffd
|
||||
2011-07-10T13:32:39.197284Z
|
||||
290
|
||||
dspill
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
311
|
||||
|
||||
README
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-12-02T23:22:44.000000Z
|
||||
3ea0531d00ac7eb13bf3576e9538df25
|
||||
2010-12-02T23:22:56.790894Z
|
||||
42
|
||||
ossmann
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
182
|
||||
|
12
firmware/blinky/.svn/text-base/Makefile.svn-base
Normal file
12
firmware/blinky/.svn/text-base/Makefile.svn-base
Normal file
@ -0,0 +1,12 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = blinky
|
||||
|
||||
# List C source files here. (C dependencies are automatically generated.)
|
||||
SRC = $(TARGET).c \
|
||||
$(LIBS_PATH)/LPC17xx_Startup.c \
|
||||
$(LIBS_PATH)/LPC17xx_Interrupts.c \
|
||||
$(LIBS_PATH)/ubertooth.c
|
||||
|
||||
include ../common.mk
|
3
firmware/blinky/.svn/text-base/README.svn-base
Normal file
3
firmware/blinky/.svn/text-base/README.svn-base
Normal file
@ -0,0 +1,3 @@
|
||||
This is the simplest example firmware for Project Ubertooth. It leaves the
|
||||
CC2400 wireless transceiver and the USB peripheral off and flashes three LEDs
|
||||
with a period of 2 seconds.
|
38
firmware/blinky/.svn/text-base/blinky.c.svn-base
Normal file
38
firmware/blinky/.svn/text-base/blinky.c.svn-base
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2010 Michael Ossmann
|
||||
*
|
||||
* This file is part of Project Ubertooth.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "ubertooth.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
gpio_init();
|
||||
|
||||
while (1) {
|
||||
USRLED_SET;
|
||||
TXLED_SET;
|
||||
RXLED_SET;
|
||||
wait(1);
|
||||
USRLED_CLR;
|
||||
TXLED_CLR;
|
||||
RXLED_CLR;
|
||||
wait(1);
|
||||
}
|
||||
}
|
443
firmware/blinky/.svn/tmp/Makefile.2.tmp
Normal file
443
firmware/blinky/.svn/tmp/Makefile.2.tmp
Normal file
@ -0,0 +1,443 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#----------------------------------------------------------------------------
|
||||
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
|
||||
# >> Modified for use with the LUFA project. <<
|
||||
#
|
||||
# Released to the Public Domain
|
||||
#
|
||||
# Altered for ARM Cortex-M3 by Opendous Inc. - 2010-01-05
|
||||
# Altered for Project Ubertooth by Michael Ossmann 2010
|
||||
#
|
||||
# Additional material for this makefile was written by:
|
||||
# Peter Fleury
|
||||
# Tim Henigan
|
||||
# Colin O'Flynn
|
||||
# Reiner Patommel
|
||||
# Markus Pfaff
|
||||
# Sander Pool
|
||||
# Frederik Rouleau
|
||||
# Carlos Lamas
|
||||
# Dean Camera
|
||||
# Denver Gingerich
|
||||
# Opendous Inc.
|
||||
# Michael Ossmann
|
||||
#
|
||||
#----------------------------------------------------------------------------
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make program = Download the hex file to the device
|
||||
#
|
||||
# make doxygen = Generate DoxyGen documentation for the project (must have
|
||||
# DoxyGen installed)
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only.
|
||||
#
|
||||
# make filename.i = Create a preprocessed source file for use in submitting
|
||||
# bug reports to the GCC project.
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# CPU architecture
|
||||
CPU = cortex-m3
|
||||
|
||||
# Instruction Set to use (also known as CPU Mode)
|
||||
CPU_MODE = mthumb
|
||||
|
||||
# Additional CPU flags
|
||||
CPU_FLAGS = -mapcs-frame
|
||||
CPU_FLAGS_ASM = -mthumb-interwork
|
||||
|
||||
# set to UBERTOOTH_ZERO or UBERTOOTH_ONE
|
||||
BOARD ?= UBERTOOTH_ONE
|
||||
|
||||
# Output format. (can be srec, ihex, binary)
|
||||
FORMAT = ihex
|
||||
|
||||
# Output Directory
|
||||
OUTDIR = .
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = blinky
|
||||
|
||||
# List C source files here. (C dependencies are automatically generated.)
|
||||
SRC = $(TARGET).c \
|
||||
../common/LPC17xx_Startup.c \
|
||||
../common/LPC17xx_Interrupts.c \
|
||||
../common/ubertooth.c
|
||||
|
||||
# List C++ source files here. (C dependencies are automatically generated.)
|
||||
CPPSRC =
|
||||
|
||||
# List Assembler source files here.
|
||||
# Make them always end in a capital .S. Files ending in a lowercase .s
|
||||
# will not be considered source files but generated files (assembler
|
||||
# output from the compiler), and will be deleted upon "make clean"!
|
||||
# Even though the DOS/Win* filesystem matches both .s and .S the same,
|
||||
# it will preserve the spelling of the filenames, and gcc itself does
|
||||
# care about how the name is spelled on its command-line.
|
||||
ASRC =
|
||||
|
||||
# Object files directory
|
||||
# To put object files in current directory, use a dot (.), do NOT make
|
||||
# this an empty or blank macro!
|
||||
OBJDIR = .
|
||||
|
||||
# Optimization level, can be [0, 1, 2, 3, s].
|
||||
# 0 = turn off optimization. s = optimize for size.
|
||||
# (Note: 3 is not always the best optimization level. See libc FAQ.)
|
||||
OPT = 0
|
||||
|
||||
# Debugging format.
|
||||
DEBUG = dwarf-2 -g3
|
||||
|
||||
# Linker Script for the current MCU
|
||||
LINKER_SCRIPT = ../common/LPC17xx_Linker_Script.ld
|
||||
|
||||
# List any extra directories to look for include files here.
|
||||
# Each directory must be seperated by a space.
|
||||
# Use forward slashes for directory separators.
|
||||
# For a directory that has spaces, enclose it in quotes.
|
||||
EXTRAINCDIRS = ../common
|
||||
|
||||
# Compiler flag to set the C Standard level.
|
||||
# c89 = "ANSI" C
|
||||
# gnu89 = c89 plus GCC extensions
|
||||
# c99 = ISO C99 standard (not yet fully implemented)
|
||||
# gnu99 = c99 plus GCC extensions
|
||||
CSTANDARD = -std=gnu99
|
||||
|
||||
# Place -D or -U options here for C sources
|
||||
CDEFS = -D$(BOARD) $(COMPILE_OPTS)
|
||||
|
||||
# Place -D or -U options here for ASM sources
|
||||
ADEFS =
|
||||
|
||||
# Place -D or -U options here for C++ sources
|
||||
CPPDEFS =
|
||||
|
||||
#---------------- Compiler Options C ----------------
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -alhms...: create assembler listing
|
||||
CFLAGS = -g$(DEBUG)
|
||||
CFLAGS += $(CDEFS)
|
||||
CFLAGS += -O$(OPT)
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Wno-unused
|
||||
CFLAGS += -Wno-comments
|
||||
CFLAGS += -fmessage-length=0
|
||||
CFLAGS += -fno-builtin
|
||||
CFLAGS += -ffunction-sections
|
||||
CFLAGS += -Wextra
|
||||
CFLAGS += -D__thumb2__=1
|
||||
CFLAGS += -msoft-float
|
||||
CFLAGS += -mno-sched-prolog
|
||||
CFLAGS += -fno-hosted
|
||||
CFLAGS += -mtune=cortex-m3
|
||||
CFLAGS += -march=armv7-m
|
||||
CFLAGS += -mfix-cortex-m3-ldrd
|
||||
#CFLAGS += -Wundef
|
||||
#CFLAGS += -funsigned-char
|
||||
#CFLAGS += -funsigned-bitfields
|
||||
#CFLAGS += -fno-inline-small-functions
|
||||
#CFLAGS += -fpack-struct
|
||||
#CFLAGS += -fshort-enums
|
||||
#CFLAGS += -Wstrict-prototypes
|
||||
#CFLAGS += -fno-unit-at-a-time
|
||||
#CFLAGS += -Wunreachable-code
|
||||
#CFLAGS += -Wsign-compare
|
||||
CFLAGS += -Wa,-alhms=$(<:%.c=$(OBJDIR)/%.lst)
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
CFLAGS += $(CSTANDARD)
|
||||
|
||||
#---------------- Compiler Options C++ ----------------
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -alhms...: create assembler listing
|
||||
CPPFLAGS = -g$(DEBUG)
|
||||
CPPFLAGS += $(CPPDEFS)
|
||||
CPPFLAGS += -O$(OPT)
|
||||
#CPPFLAGS += -funsigned-char
|
||||
#CPPFLAGS += -funsigned-bitfields
|
||||
#CPPFLAGS += -fpack-struct
|
||||
#CPPFLAGS += -fshort-enums
|
||||
#CPPFLAGS += -fno-exceptions
|
||||
CPPFLAGS += -Wall
|
||||
#CFLAGS += -Wundef
|
||||
#CPPFLAGS += -mshort-calls
|
||||
#CPPFLAGS += -fno-unit-at-a-time
|
||||
#CPPFLAGS += -Wstrict-prototypes
|
||||
#CPPFLAGS += -Wunreachable-code
|
||||
#CPPFLAGS += -Wsign-compare
|
||||
CPPFLAGS += -Wa,-alhms=$(<:%.cpp=$(OBJDIR)/%.lst)
|
||||
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
#CPPFLAGS += $(CSTANDARD)
|
||||
|
||||
#---------------- Assembler Options ----------------
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -alhms: create listing
|
||||
# -gstabs: have the assembler create line number information
|
||||
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
|
||||
# dump that will be displayed for a given single line of source input.
|
||||
ASFLAGS = -g$(DEBUG) $(ADEFS) -I. -alhms=$(<:%.S=$(OBJDIR)/%.lst)
|
||||
|
||||
#---------------- Library Options ----------------
|
||||
|
||||
# List any extra directories to look for libraries here.
|
||||
# Each directory must be seperated by a space.
|
||||
# Use forward slashes for directory separators.
|
||||
# For a directory that has spaces, enclose it in quotes.
|
||||
EXTRALIBDIRS =
|
||||
|
||||
#---------------- Linker Options ----------------
|
||||
# -Wl,...: tell GCC to pass this to linker.
|
||||
# -Map: create map file
|
||||
# --cref: add cross reference to map file
|
||||
LDFLAGS = -Wl,-Map=$(TARGET).map
|
||||
#LDFLAGS += -Wl,--relax
|
||||
LDFLAGS += --gc-sections
|
||||
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
|
||||
LDFLAGS += -static
|
||||
LDFLAGS += -Wl,--start-group
|
||||
#LDFLAGS += -L$(THUMB2GNULIB) -L$(THUMB2GNULIB2)
|
||||
LDFLAGS += -lc -lg -lstdc++ -lsupc++
|
||||
LDFLAGS += -lgcc -lm
|
||||
LDFLAGS += -Wl,--end-group
|
||||
|
||||
#---------------- Programming Options ----------------
|
||||
LPCISP ?= ~/src/lpc21isp/lpc21isp
|
||||
PROGDEV ?= /dev/ttyUSB0
|
||||
|
||||
#============================================================================
|
||||
|
||||
# Define programs and commands.
|
||||
CC = arm-none-eabi-gcc
|
||||
LD = arm-none-eabi-gcc -T
|
||||
AS = arm-none-eabi-as
|
||||
OBJCOPY = arm-none-eabi-objcopy
|
||||
OBJDUMP = arm-none-eabi-objdump
|
||||
READELF = arm-none-eabi-readelf
|
||||
SIZE = arm-none-eabi-size
|
||||
AR = arm-none-eabi-ar -r
|
||||
NM = arm-none-eabi-nm
|
||||
REMOVE = rm -f
|
||||
|
||||
# Define Messages
|
||||
# English
|
||||
MSG_BEGIN = -------- begin --------
|
||||
MSG_END = -------- end --------
|
||||
MSG_SIZE_BEFORE = Size before:
|
||||
MSG_SIZE_AFTER = Size after:
|
||||
MSG_FLASH = Creating load file for Flash:
|
||||
MSG_EEPROM = Creating load file for EEPROM:
|
||||
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
||||
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
||||
MSG_LINKING = Linking:
|
||||
MSG_COMPILING = Compiling C:
|
||||
MSG_COMPILING_CPP = Compiling C++:
|
||||
MSG_ASSEMBLING = Assembling:
|
||||
MSG_CLEANING = Cleaning project:
|
||||
MSG_CREATING_LIBRARY = Creating library:
|
||||
|
||||
# Define all object files.
|
||||
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
|
||||
|
||||
# Define all listing files.
|
||||
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
||||
|
||||
# Compiler flags to generate dependency files.
|
||||
GENDEPFLAGS = -MMD -MP -MD
|
||||
|
||||
# Combine all necessary flags and optional flags.
|
||||
# Add target processor to flags.
|
||||
ALL_CFLAGS = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS) -I. $(CFLAGS) $(GENDEPFLAGS)
|
||||
ALL_CPPFLAGS = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
|
||||
ALL_ASFLAGS = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS_ASM) $(ASFLAGS)
|
||||
# only difference between Linker flags and CFLAGS is CPU_FLAGS_ASM as -mapcs-frame is not needed
|
||||
ALL_CFLAGS_LINKER = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS_ASM)
|
||||
|
||||
# Default target.
|
||||
all: begin gccversion sizebefore build showtarget sizeafter end
|
||||
|
||||
# Change the build target to build a HEX file or a library.
|
||||
build: elf hex bin srec lss sym
|
||||
#build: lib
|
||||
|
||||
elf: $(TARGET).elf
|
||||
hex: $(TARGET).hex
|
||||
bin: $(TARGET).bin
|
||||
srec: $(TARGET).srec
|
||||
eep: $(TARGET).eep
|
||||
lss: $(TARGET).lss
|
||||
sym: $(TARGET).sym
|
||||
LIBNAME=lib$(TARGET).a
|
||||
lib: $(LIBNAME)
|
||||
|
||||
# Eye candy.
|
||||
begin:
|
||||
@echo
|
||||
@echo $(MSG_BEGIN)
|
||||
|
||||
end:
|
||||
@echo $(MSG_END)
|
||||
@echo
|
||||
|
||||
# Display size of file.
|
||||
ELFSIZE = $(SIZE) $(FORMAT_FLAG) $(TARGET).elf
|
||||
|
||||
sizebefore:
|
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
|
||||
2>/dev/null; echo; fi
|
||||
|
||||
sizeafter:
|
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
|
||||
2>/dev/null; echo; fi
|
||||
|
||||
showtarget:
|
||||
@echo
|
||||
@echo --------- Target Information ---------
|
||||
@echo ARM Model: $(CPU)
|
||||
@echo Board: $(BOARD)
|
||||
@echo --------------------------------------
|
||||
|
||||
# Display compiler version information.
|
||||
gccversion:
|
||||
@$(CC) --version
|
||||
|
||||
program: $(TARGET).hex
|
||||
$(LPCISP) -control $(TARGET).hex $(PROGDEV) 230400 4000
|
||||
|
||||
# Create final output files (.hex, .eep) from ELF output file.
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O $(FORMAT) $< $@
|
||||
|
||||
%.bin: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O binary $< $(TARGET).bin
|
||||
|
||||
%.srec: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O srec $< $(TARGET).srec
|
||||
|
||||
%.eep: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EEPROM) $@
|
||||
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||
--change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EXTENDED_LISTING) $@
|
||||
$(OBJDUMP) -h -z -S $< > $@
|
||||
|
||||
# Create a symbol table from ELF output file.
|
||||
%.sym: %.elf
|
||||
@echo
|
||||
@echo $(MSG_SYMBOL_TABLE) $@
|
||||
$(NM) -n $< > $@
|
||||
|
||||
# Create library from object files.
|
||||
.SECONDARY : $(TARGET).a
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.a: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_CREATING_LIBRARY) $@
|
||||
$(AR) $@ $(OBJ)
|
||||
|
||||
# Link: create ELF output file from object files.
|
||||
.SECONDARY : $(TARGET).elf
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.elf: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_LINKING) $@
|
||||
$(LD) $(LINKER_SCRIPT) $(ALL_CFLAGS_LINKER) $(LDFLAGS) -o $@ $^
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
$(OBJDIR)/%.o : %.c
|
||||
@echo
|
||||
@echo $(MSG_COMPILING) $<
|
||||
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
# Compile: create object files from C++ source files.
|
||||
$(OBJDIR)/%.o : %.cpp
|
||||
@echo
|
||||
@echo $(MSG_COMPILING_CPP) $<
|
||||
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
|
||||
|
||||
# Compile: create assembler files from C source files.
|
||||
%.s : %.c
|
||||
$(AS) -S $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
# Compile: create assembler files from C++ source files.
|
||||
%.s : %.cpp
|
||||
$(CC) -S $(ALL_CPPFLAGS) $< -o $@
|
||||
|
||||
# Assemble: create object files from assembler source files.
|
||||
$(OBJDIR)/%.o : %.S
|
||||
@echo
|
||||
@echo $(MSG_ASSEMBLING) $<
|
||||
$(AS) $< $(ALL_ASFLAGS) --MD $(OBJDIR)/$(@F).d -o $@
|
||||
|
||||
# Create preprocessed source for use in sending a bug report.
|
||||
%.i : %.c
|
||||
$(CC) -E -mmcu=$(CPU) -I. $(CFLAGS) $< -o $@
|
||||
|
||||
# Target: clean project.
|
||||
clean: begin clean_list clean_binary end
|
||||
|
||||
clean_binary:
|
||||
$(REMOVE) $(TARGET).hex
|
||||
|
||||
clean_list:
|
||||
@echo $(MSG_CLEANING)
|
||||
$(REMOVE) $(TARGET).eep
|
||||
$(REMOVE) $(TARGET)eep.hex
|
||||
$(REMOVE) $(TARGET).cof
|
||||
$(REMOVE) $(TARGET).elf
|
||||
$(REMOVE) $(TARGET).map
|
||||
$(REMOVE) $(TARGET).sym
|
||||
$(REMOVE) $(TARGET).lss
|
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
|
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
|
||||
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
||||
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.o)
|
||||
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.o.d)
|
||||
$(REMOVE) *.o.d
|
||||
$(REMOVE) $(SRC:.c=.s)
|
||||
$(REMOVE) $(SRC:.c=.d)
|
||||
$(REMOVE) $(SRC:.c=.i)
|
||||
$(REMOVE) InvalidEvents.tmp
|
||||
$(REMOVE) $(TARGET).bin
|
||||
$(REMOVE) $(TARGET).srec
|
||||
|
||||
doxygen:
|
||||
@echo Generating Project Documentation...
|
||||
@doxygen Doxygen.conf
|
||||
@echo Documentation Generation Complete.
|
||||
|
||||
clean_doxygen:
|
||||
rm -rf Documentation
|
||||
|
||||
# Create object files directory
|
||||
$(shell mkdir $(OBJDIR)/ 2>/dev/null)
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : all showtarget begin end sizebefore sizeafter \
|
||||
gccversion build elf hex eep lss sym program clean \
|
||||
clean_list clean_binary doxygen
|
443
firmware/blinky/.svn/tmp/Makefile.tmp
Normal file
443
firmware/blinky/.svn/tmp/Makefile.tmp
Normal file
@ -0,0 +1,443 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#----------------------------------------------------------------------------
|
||||
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
|
||||
# >> Modified for use with the LUFA project. <<
|
||||
#
|
||||
# Released to the Public Domain
|
||||
#
|
||||
# Altered for ARM Cortex-M3 by Opendous Inc. - 2010-01-05
|
||||
# Altered for Project Ubertooth by Michael Ossmann 2010
|
||||
#
|
||||
# Additional material for this makefile was written by:
|
||||
# Peter Fleury
|
||||
# Tim Henigan
|
||||
# Colin O'Flynn
|
||||
# Reiner Patommel
|
||||
# Markus Pfaff
|
||||
# Sander Pool
|
||||
# Frederik Rouleau
|
||||
# Carlos Lamas
|
||||
# Dean Camera
|
||||
# Denver Gingerich
|
||||
# Opendous Inc.
|
||||
# Michael Ossmann
|
||||
#
|
||||
#----------------------------------------------------------------------------
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make program = Download the hex file to the device
|
||||
#
|
||||
# make doxygen = Generate DoxyGen documentation for the project (must have
|
||||
# DoxyGen installed)
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only.
|
||||
#
|
||||
# make filename.i = Create a preprocessed source file for use in submitting
|
||||
# bug reports to the GCC project.
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# CPU architecture
|
||||
CPU = cortex-m3
|
||||
|
||||
# Instruction Set to use (also known as CPU Mode)
|
||||
CPU_MODE = mthumb
|
||||
|
||||
# Additional CPU flags
|
||||
CPU_FLAGS = -mapcs-frame
|
||||
CPU_FLAGS_ASM = -mthumb-interwork
|
||||
|
||||
# set to UBERTOOTH_ZERO or UBERTOOTH_ONE
|
||||
BOARD ?= UBERTOOTH_ONE
|
||||
|
||||
# Output format. (can be srec, ihex, binary)
|
||||
FORMAT = ihex
|
||||
|
||||
# Output Directory
|
||||
OUTDIR = .
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = blinky
|
||||
|
||||
# List C source files here. (C dependencies are automatically generated.)
|
||||
SRC = $(TARGET).c \
|
||||
../common/LPC17xx_Startup.c \
|
||||
../common/LPC17xx_Interrupts.c \
|
||||
../common/ubertooth.c
|
||||
|
||||
# List C++ source files here. (C dependencies are automatically generated.)
|
||||
CPPSRC =
|
||||
|
||||
# List Assembler source files here.
|
||||
# Make them always end in a capital .S. Files ending in a lowercase .s
|
||||
# will not be considered source files but generated files (assembler
|
||||
# output from the compiler), and will be deleted upon "make clean"!
|
||||
# Even though the DOS/Win* filesystem matches both .s and .S the same,
|
||||
# it will preserve the spelling of the filenames, and gcc itself does
|
||||
# care about how the name is spelled on its command-line.
|
||||
ASRC =
|
||||
|
||||
# Object files directory
|
||||
# To put object files in current directory, use a dot (.), do NOT make
|
||||
# this an empty or blank macro!
|
||||
OBJDIR = .
|
||||
|
||||
# Optimization level, can be [0, 1, 2, 3, s].
|
||||
# 0 = turn off optimization. s = optimize for size.
|
||||
# (Note: 3 is not always the best optimization level. See libc FAQ.)
|
||||
OPT = 0
|
||||
|
||||
# Debugging format.
|
||||
DEBUG = dwarf-2 -g3
|
||||
|
||||
# Linker Script for the current MCU
|
||||
LINKER_SCRIPT = ../common/LPC17xx_Linker_Script.ld
|
||||
|
||||
# List any extra directories to look for include files here.
|
||||
# Each directory must be seperated by a space.
|
||||
# Use forward slashes for directory separators.
|
||||
# For a directory that has spaces, enclose it in quotes.
|
||||
EXTRAINCDIRS = ../common
|
||||
|
||||
# Compiler flag to set the C Standard level.
|
||||
# c89 = "ANSI" C
|
||||
# gnu89 = c89 plus GCC extensions
|
||||
# c99 = ISO C99 standard (not yet fully implemented)
|
||||
# gnu99 = c99 plus GCC extensions
|
||||
CSTANDARD = -std=gnu99
|
||||
|
||||
# Place -D or -U options here for C sources
|
||||
CDEFS = -D$(BOARD) $(COMPILE_OPTS)
|
||||
|
||||
# Place -D or -U options here for ASM sources
|
||||
ADEFS =
|
||||
|
||||
# Place -D or -U options here for C++ sources
|
||||
CPPDEFS =
|
||||
|
||||
#---------------- Compiler Options C ----------------
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -alhms...: create assembler listing
|
||||
CFLAGS = -g$(DEBUG)
|
||||
CFLAGS += $(CDEFS)
|
||||
CFLAGS += -O$(OPT)
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Wno-unused
|
||||
CFLAGS += -Wno-comments
|
||||
CFLAGS += -fmessage-length=0
|
||||
CFLAGS += -fno-builtin
|
||||
CFLAGS += -ffunction-sections
|
||||
CFLAGS += -Wextra
|
||||
CFLAGS += -D__thumb2__=1
|
||||
CFLAGS += -msoft-float
|
||||
CFLAGS += -mno-sched-prolog
|
||||
CFLAGS += -fno-hosted
|
||||
CFLAGS += -mtune=cortex-m3
|
||||
CFLAGS += -march=armv7-m
|
||||
CFLAGS += -mfix-cortex-m3-ldrd
|
||||
#CFLAGS += -Wundef
|
||||
#CFLAGS += -funsigned-char
|
||||
#CFLAGS += -funsigned-bitfields
|
||||
#CFLAGS += -fno-inline-small-functions
|
||||
#CFLAGS += -fpack-struct
|
||||
#CFLAGS += -fshort-enums
|
||||
#CFLAGS += -Wstrict-prototypes
|
||||
#CFLAGS += -fno-unit-at-a-time
|
||||
#CFLAGS += -Wunreachable-code
|
||||
#CFLAGS += -Wsign-compare
|
||||
CFLAGS += -Wa,-alhms=$(<:%.c=$(OBJDIR)/%.lst)
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
CFLAGS += $(CSTANDARD)
|
||||
|
||||
#---------------- Compiler Options C++ ----------------
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -alhms...: create assembler listing
|
||||
CPPFLAGS = -g$(DEBUG)
|
||||
CPPFLAGS += $(CPPDEFS)
|
||||
CPPFLAGS += -O$(OPT)
|
||||
#CPPFLAGS += -funsigned-char
|
||||
#CPPFLAGS += -funsigned-bitfields
|
||||
#CPPFLAGS += -fpack-struct
|
||||
#CPPFLAGS += -fshort-enums
|
||||
#CPPFLAGS += -fno-exceptions
|
||||
CPPFLAGS += -Wall
|
||||
#CFLAGS += -Wundef
|
||||
#CPPFLAGS += -mshort-calls
|
||||
#CPPFLAGS += -fno-unit-at-a-time
|
||||
#CPPFLAGS += -Wstrict-prototypes
|
||||
#CPPFLAGS += -Wunreachable-code
|
||||
#CPPFLAGS += -Wsign-compare
|
||||
CPPFLAGS += -Wa,-alhms=$(<:%.cpp=$(OBJDIR)/%.lst)
|
||||
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
#CPPFLAGS += $(CSTANDARD)
|
||||
|
||||
#---------------- Assembler Options ----------------
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -alhms: create listing
|
||||
# -gstabs: have the assembler create line number information
|
||||
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
|
||||
# dump that will be displayed for a given single line of source input.
|
||||
ASFLAGS = -g$(DEBUG) $(ADEFS) -I. -alhms=$(<:%.S=$(OBJDIR)/%.lst)
|
||||
|
||||
#---------------- Library Options ----------------
|
||||
|
||||
# List any extra directories to look for libraries here.
|
||||
# Each directory must be seperated by a space.
|
||||
# Use forward slashes for directory separators.
|
||||
# For a directory that has spaces, enclose it in quotes.
|
||||
EXTRALIBDIRS =
|
||||
|
||||
#---------------- Linker Options ----------------
|
||||
# -Wl,...: tell GCC to pass this to linker.
|
||||
# -Map: create map file
|
||||
# --cref: add cross reference to map file
|
||||
LDFLAGS = -Wl,-Map=$(TARGET).map
|
||||
#LDFLAGS += -Wl,--relax
|
||||
LDFLAGS += --gc-sections
|
||||
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
|
||||
LDFLAGS += -static
|
||||
LDFLAGS += -Wl,--start-group
|
||||
#LDFLAGS += -L$(THUMB2GNULIB) -L$(THUMB2GNULIB2)
|
||||
LDFLAGS += -lc -lg -lstdc++ -lsupc++
|
||||
LDFLAGS += -lgcc -lm
|
||||
LDFLAGS += -Wl,--end-group
|
||||
|
||||
#---------------- Programming Options ----------------
|
||||
LPCISP ?= ~/src/lpc21isp/lpc21isp
|
||||
PROGDEV ?= /dev/ttyUSB0
|
||||
|
||||
#============================================================================
|
||||
|
||||
# Define programs and commands.
|
||||
CC = arm-none-eabi-gcc
|
||||
LD = arm-none-eabi-gcc -T
|
||||
AS = arm-none-eabi-as
|
||||
OBJCOPY = arm-none-eabi-objcopy
|
||||
OBJDUMP = arm-none-eabi-objdump
|
||||
READELF = arm-none-eabi-readelf
|
||||
SIZE = arm-none-eabi-size
|
||||
AR = arm-none-eabi-ar -r
|
||||
NM = arm-none-eabi-nm
|
||||
REMOVE = rm -f
|
||||
|
||||
# Define Messages
|
||||
# English
|
||||
MSG_BEGIN = -------- begin --------
|
||||
MSG_END = -------- end --------
|
||||
MSG_SIZE_BEFORE = Size before:
|
||||
MSG_SIZE_AFTER = Size after:
|
||||
MSG_FLASH = Creating load file for Flash:
|
||||
MSG_EEPROM = Creating load file for EEPROM:
|
||||
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
||||
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
||||
MSG_LINKING = Linking:
|
||||
MSG_COMPILING = Compiling C:
|
||||
MSG_COMPILING_CPP = Compiling C++:
|
||||
MSG_ASSEMBLING = Assembling:
|
||||
MSG_CLEANING = Cleaning project:
|
||||
MSG_CREATING_LIBRARY = Creating library:
|
||||
|
||||
# Define all object files.
|
||||
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
|
||||
|
||||
# Define all listing files.
|
||||
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
||||
|
||||
# Compiler flags to generate dependency files.
|
||||
GENDEPFLAGS = -MMD -MP -MD
|
||||
|
||||
# Combine all necessary flags and optional flags.
|
||||
# Add target processor to flags.
|
||||
ALL_CFLAGS = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS) -I. $(CFLAGS) $(GENDEPFLAGS)
|
||||
ALL_CPPFLAGS = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
|
||||
ALL_ASFLAGS = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS_ASM) $(ASFLAGS)
|
||||
# only difference between Linker flags and CFLAGS is CPU_FLAGS_ASM as -mapcs-frame is not needed
|
||||
ALL_CFLAGS_LINKER = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS_ASM)
|
||||
|
||||
# Default target.
|
||||
all: begin gccversion sizebefore build showtarget sizeafter end
|
||||
|
||||
# Change the build target to build a HEX file or a library.
|
||||
build: elf hex bin srec lss sym
|
||||
#build: lib
|
||||
|
||||
elf: $(TARGET).elf
|
||||
hex: $(TARGET).hex
|
||||
bin: $(TARGET).bin
|
||||
srec: $(TARGET).srec
|
||||
eep: $(TARGET).eep
|
||||
lss: $(TARGET).lss
|
||||
sym: $(TARGET).sym
|
||||
LIBNAME=lib$(TARGET).a
|
||||
lib: $(LIBNAME)
|
||||
|
||||
# Eye candy.
|
||||
begin:
|
||||
@echo
|
||||
@echo $(MSG_BEGIN)
|
||||
|
||||
end:
|
||||
@echo $(MSG_END)
|
||||
@echo
|
||||
|
||||
# Display size of file.
|
||||
ELFSIZE = $(SIZE) $(FORMAT_FLAG) $(TARGET).elf
|
||||
|
||||
sizebefore:
|
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
|
||||
2>/dev/null; echo; fi
|
||||
|
||||
sizeafter:
|
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
|
||||
2>/dev/null; echo; fi
|
||||
|
||||
showtarget:
|
||||
@echo
|
||||
@echo --------- Target Information ---------
|
||||
@echo ARM Model: $(CPU)
|
||||
@echo Board: $(BOARD)
|
||||
@echo --------------------------------------
|
||||
|
||||
# Display compiler version information.
|
||||
gccversion:
|
||||
@$(CC) --version
|
||||
|
||||
program: $(TARGET).hex
|
||||
$(LPCISP) -control $(TARGET).hex $(PROGDEV) 230400 4000
|
||||
|
||||
# Create final output files (.hex, .eep) from ELF output file.
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O $(FORMAT) $< $@
|
||||
|
||||
%.bin: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O binary $< $(TARGET).bin
|
||||
|
||||
%.srec: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O srec $< $(TARGET).srec
|
||||
|
||||
%.eep: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EEPROM) $@
|
||||
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||
--change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EXTENDED_LISTING) $@
|
||||
$(OBJDUMP) -h -z -S $< > $@
|
||||
|
||||
# Create a symbol table from ELF output file.
|
||||
%.sym: %.elf
|
||||
@echo
|
||||
@echo $(MSG_SYMBOL_TABLE) $@
|
||||
$(NM) -n $< > $@
|
||||
|
||||
# Create library from object files.
|
||||
.SECONDARY : $(TARGET).a
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.a: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_CREATING_LIBRARY) $@
|
||||
$(AR) $@ $(OBJ)
|
||||
|
||||
# Link: create ELF output file from object files.
|
||||
.SECONDARY : $(TARGET).elf
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.elf: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_LINKING) $@
|
||||
$(LD) $(LINKER_SCRIPT) $(ALL_CFLAGS_LINKER) $(LDFLAGS) -o $@ $^
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
$(OBJDIR)/%.o : %.c
|
||||
@echo
|
||||
@echo $(MSG_COMPILING) $<
|
||||
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
# Compile: create object files from C++ source files.
|
||||
$(OBJDIR)/%.o : %.cpp
|
||||
@echo
|
||||
@echo $(MSG_COMPILING_CPP) $<
|
||||
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
|
||||
|
||||
# Compile: create assembler files from C source files.
|
||||
%.s : %.c
|
||||
$(AS) -S $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
# Compile: create assembler files from C++ source files.
|
||||
%.s : %.cpp
|
||||
$(CC) -S $(ALL_CPPFLAGS) $< -o $@
|
||||
|
||||
# Assemble: create object files from assembler source files.
|
||||
$(OBJDIR)/%.o : %.S
|
||||
@echo
|
||||
@echo $(MSG_ASSEMBLING) $<
|
||||
$(AS) $< $(ALL_ASFLAGS) --MD $(OBJDIR)/$(@F).d -o $@
|
||||
|
||||
# Create preprocessed source for use in sending a bug report.
|
||||
%.i : %.c
|
||||
$(CC) -E -mmcu=$(CPU) -I. $(CFLAGS) $< -o $@
|
||||
|
||||
# Target: clean project.
|
||||
clean: begin clean_list clean_binary end
|
||||
|
||||
clean_binary:
|
||||
$(REMOVE) $(TARGET).hex
|
||||
|
||||
clean_list:
|
||||
@echo $(MSG_CLEANING)
|
||||
$(REMOVE) $(TARGET).eep
|
||||
$(REMOVE) $(TARGET)eep.hex
|
||||
$(REMOVE) $(TARGET).cof
|
||||
$(REMOVE) $(TARGET).elf
|
||||
$(REMOVE) $(TARGET).map
|
||||
$(REMOVE) $(TARGET).sym
|
||||
$(REMOVE) $(TARGET).lss
|
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
|
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
|
||||
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
||||
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.o)
|
||||
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.o.d)
|
||||
$(REMOVE) *.o.d
|
||||
$(REMOVE) $(SRC:.c=.s)
|
||||
$(REMOVE) $(SRC:.c=.d)
|
||||
$(REMOVE) $(SRC:.c=.i)
|
||||
$(REMOVE) InvalidEvents.tmp
|
||||
$(REMOVE) $(TARGET).bin
|
||||
$(REMOVE) $(TARGET).srec
|
||||
|
||||
doxygen:
|
||||
@echo Generating Project Documentation...
|
||||
@doxygen Doxygen.conf
|
||||
@echo Documentation Generation Complete.
|
||||
|
||||
clean_doxygen:
|
||||
rm -rf Documentation
|
||||
|
||||
# Create object files directory
|
||||
$(shell mkdir $(OBJDIR)/ 2>/dev/null)
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : all showtarget begin end sizebefore sizeafter \
|
||||
gccversion build elf hex eep lss sym program clean \
|
||||
clean_list clean_binary doxygen
|
12
firmware/blinky/Makefile
Normal file
12
firmware/blinky/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = blinky
|
||||
|
||||
# List C source files here. (C dependencies are automatically generated.)
|
||||
SRC = $(TARGET).c \
|
||||
$(LIBS_PATH)/LPC43xx_M4_Startup.c \
|
||||
$(LIBS_PATH)/LPC43xx_M4_Interrupts.c \
|
||||
$(LIBS_PATH)/hackrf_core.c
|
||||
|
||||
include ../common/Makefile_inc.mk
|
1
firmware/blinky/README
Normal file
1
firmware/blinky/README
Normal file
@ -0,0 +1 @@
|
||||
This is the simplest example firmware for HackRF. It flashes three LEDs.
|
44
firmware/blinky/blinky.c
Normal file
44
firmware/blinky/blinky.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2010 - 2012 Michael Ossmann
|
||||
*
|
||||
* This file is part of HackRF.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "hackrf_core.h"
|
||||
|
||||
void wait(uint8_t duration)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < duration * 1000000; i++);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
gpio_init();
|
||||
|
||||
while (1) {
|
||||
LED1_SET;
|
||||
LED2_SET;
|
||||
LED3_SET;
|
||||
wait(1);
|
||||
LED1_CLR;
|
||||
LED2_CLR;
|
||||
LED3_CLR;
|
||||
wait(1);
|
||||
}
|
||||
}
|
158
firmware/common/LPC4330_M4.ld
Normal file
158
firmware/common/LPC4330_M4.ld
Normal file
@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright 2010 - 2012 Michael Ossmann
|
||||
*
|
||||
* This file is part of HackRF
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
|
||||
ENTRY(_start)
|
||||
SEARCH_DIR(.)
|
||||
GROUP(libgcc.a libc.a libm.a libnosys.a)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/*
|
||||
* Our code is installed in SPIFI at 0x80000000 (and copied to RAM at
|
||||
* 0x10000000 by the bootloader?), but it is addressed through the 256M
|
||||
* shadow area at 0x00000000.
|
||||
*/
|
||||
shadow (rx) : ORIGIN = 0x00000000, LENGTH = 1M
|
||||
ram (rwx) : ORIGIN = 0x10000000, LENGTH = 128K
|
||||
/* there are some additional RAM regions */
|
||||
}
|
||||
|
||||
/*
|
||||
* much copied from: Linker script for Cortex-M3
|
||||
*
|
||||
* Version:CodeSourcery Sourcery G++ Lite 2007q3-53
|
||||
* BugURL:https://support.codesourcery.com/GNUToolchain/
|
||||
*
|
||||
* Copyright 2007 CodeSourcery.
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
|
||||
EXTERN(Reset_Handler)
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(0x400); /* Ensure that vector table is aligned as hardware requires. */
|
||||
_interrupt_vector_table = .;
|
||||
KEEP(*(.irq_handler_table))
|
||||
|
||||
*(.text .text.* .gnu.linkonce.t.*)
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.init))
|
||||
|
||||
. = ALIGN(4);
|
||||
__preinit_array_start = .;
|
||||
KEEP (*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__init_array_start = .;
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
__init_array_end = .;
|
||||
|
||||
. = ALIGN(0x4);
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*crtend.o(.ctors))
|
||||
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.fini))
|
||||
|
||||
. = ALIGN(4);
|
||||
__fini_array_start = .;
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
__fini_array_end = .;
|
||||
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*crtend.o(.dtors))
|
||||
|
||||
. = ALIGN(8);
|
||||
_etext = .;
|
||||
|
||||
} > shadow
|
||||
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > shadow
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > shadow
|
||||
__exidx_end = .;
|
||||
|
||||
_etext = .;
|
||||
|
||||
.data :
|
||||
{
|
||||
_data = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
_edata = .;
|
||||
} > ram AT>shadow
|
||||
|
||||
/* zero initialized data */
|
||||
.bss :
|
||||
{
|
||||
_bss = .;
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
_ebss = .;
|
||||
__bss_end__ = .;
|
||||
} > ram
|
||||
|
||||
/* Where we put the heap with cr_clib */
|
||||
.cr_heap :
|
||||
{
|
||||
end = .;
|
||||
__end__ = .;
|
||||
_pvHeapStart = .;
|
||||
} > ram
|
||||
|
||||
/* Leave room above stack for IAP to run */
|
||||
_StackTop = ORIGIN(ram) + LENGTH(ram) - 32;
|
||||
|
||||
}
|
205
firmware/common/LPC43xx_M4_Interrupts.c
Normal file
205
firmware/common/LPC43xx_M4_Interrupts.c
Normal file
@ -0,0 +1,205 @@
|
||||
/*
|
||||
* Copyright 2010 - 2012 Michael Ossmann
|
||||
*
|
||||
* This file is part of HackRF
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/*
|
||||
Copyright 2010-07 By Opendous Inc. (www.MicropendousX.org)
|
||||
NVIC handler info copied from NXP User Manual UM10360
|
||||
|
||||
Basic interrupt handlers and NVIC interrupt handler
|
||||
function table for the LPC17xx. See TODOs for
|
||||
modification instructions.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software
|
||||
and its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
|
||||
/* Reset_Handler variables defined in linker script */
|
||||
extern unsigned long _StackTop;
|
||||
|
||||
extern void Reset_Handler(void);
|
||||
|
||||
/* Default interrupt handler */
|
||||
static void Default_Handler(void) { while(1) {;} }
|
||||
|
||||
/* Empty handlers aliased to the default handler */
|
||||
void NMI_Handler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void HardFault_Handler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void MemManagement_Handler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void BusFault_Handler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void UsageFault_Handler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void SVC_Handler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void DebugMon_Handler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void PendSV_Handler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void SysTick_Handler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void DAC_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void M0CORE_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void DMA_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void ETHERNET_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void SDIO_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void LCD_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void USB0_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void USB1_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void SCT_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void RITIMER_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void TIMER0_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void TIMER1_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void TIMER2_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void TIMER3_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void MCPWM_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void ADC0_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void I2C0_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void I2C1_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void SPI_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void ADC1_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void SSP0_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void SSP1_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void USART0_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void UART1_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void USART2_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void USART3_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void I2S0_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void I2S1_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void SPIFI_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void SGPIO_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void PIN_INT0_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void PIN_INT1_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void PIN_INT2_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void PIN_INT3_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void PIN_INT4_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void PIN_INT5_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void PIN_INT6_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void PIN_INT7_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void GINT0_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void GINT1_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void EVENTROUTER_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void C_CAN1_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void ATIMER_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void RTC_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void WWDT_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void C_CAN0_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
void QEI_IRQHandler(void) __attribute__ ((weak, alias ("Default_Handler")));
|
||||
|
||||
/*
|
||||
* This table must be appropriately placed using a linker script:
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.irq_handler_table))
|
||||
*(.text*)
|
||||
*(.rodata*)
|
||||
} > rom
|
||||
*/
|
||||
|
||||
/* TODO - simply name a handler function in your code the same as a handler
|
||||
* in the following table and it will override the default empty handler.
|
||||
* Your function should be of the form: static void Something_Handler(void) {}
|
||||
*/
|
||||
__attribute__ ((section(".irq_handler_table")))
|
||||
void (* const _NVIC_Handler_Functions[])(void) =
|
||||
{
|
||||
// Cortex-M4 Interrupts: IRQ Number - Exception Number - Offset - Vector Description
|
||||
(void *)&_StackTop, // 0x00 Initial SP Value - defined in Linker Script
|
||||
Reset_Handler, // 1 0x04 Reset Handler
|
||||
NMI_Handler, // -14 2 0x08 Non-Maskable Interrupt Handler
|
||||
HardFault_Handler, // -13 3 0x0C Hard Fault Handler
|
||||
MemManagement_Handler, // -12 4 0x10 Memory Management Fault Handler
|
||||
BusFault_Handler, // -11 5 0x14 Bus Fault Handler
|
||||
UsageFault_Handler, // -10 6 0x18 Usage Fault Handler
|
||||
0, // 7 Reserved
|
||||
0, // 8 Reserved
|
||||
0, // 9 Reserved
|
||||
0, // 10 0x2C Reserved
|
||||
SVC_Handler, // 11 SVCall Handler
|
||||
DebugMon_Handler, // 12 Debug Monitor Handler
|
||||
0, // -2 13 0x38 Reserved
|
||||
PendSV_Handler, // -1 14 0x3C PendSV Handler
|
||||
SysTick_Handler, // 0 15 0x40 SysTick Handler
|
||||
|
||||
|
||||
/* from table 21, section 7.6.1, UM10503 LPC43xx User Manual */
|
||||
DAC_IRQHandler, // 0 16 0x40
|
||||
M0CORE_IRQHandler, // 1 17 0x44 Cortex-M0; Latched TXEV; for M4-M0 communication
|
||||
DMA_IRQHandler, // 2 18 0x48
|
||||
0, // 3 19 0x4C reserved
|
||||
0, // 4 20 0x50 reserved
|
||||
ETHERNET_IRQHandler, // 5 21 0x54
|
||||
SDIO_IRQHandler, // 6 22 0x58
|
||||
LCD_IRQHandler, // 7 23 0x5C
|
||||
USB0_IRQHandler, // 8 24 0x60
|
||||
USB1_IRQHandler, // 9 25 0x64
|
||||
SCT_IRQHandler, // 10 26 0x68 SCT combined interrupt
|
||||
RITIMER_IRQHandler, // 11 27 0x6C
|
||||
TIMER0_IRQHandler, // 12 28 0x70
|
||||
TIMER1_IRQHandler, // 13 29 0x74
|
||||
TIMER2_IRQHandler, // 14 30 0x78
|
||||
TIMER3_IRQHandler, // 15 31 0x7C
|
||||
MCPWM_IRQHandler, // 16 32 0x80
|
||||
ADC0_IRQHandler, // 17 33 0x84
|
||||
I2C0_IRQHandler, // 18 34 0x88
|
||||
I2C1_IRQHandler, // 19 35 0x8C
|
||||
SPI_IRQHandler, // 20 36 0x90
|
||||
ADC1_IRQHandler, // 21 37 0x94
|
||||
SSP0_IRQHandler, // 22 38 0x98
|
||||
SSP1_IRQHandler, // 23 39 0x9C
|
||||
USART0_IRQHandler, // 24 40 0xA0
|
||||
UART1_IRQHandler, // 25 41 0xA4 Combined UART interrupt with Modem interrupt
|
||||
USART2_IRQHandler, // 26 42 0xA8
|
||||
USART3_IRQHandler, // 27 43 0xAC Combined USART interrupt with IrDA interrupt
|
||||
I2S0_IRQHandler, // 28 44 0xB0
|
||||
I2S1_IRQHandler, // 29 45 0xB4
|
||||
SPIFI_IRQHandler, // 30 46 0xB8
|
||||
SGPIO_IRQHandler, // 31 47 0xBC
|
||||
PIN_INT0_IRQHandler, // 32 48 0xC0 GPIO pin interrupt 0
|
||||
PIN_INT1_IRQHandler, // 33 49 0xC4 GPIO pin interrupt 1
|
||||
PIN_INT2_IRQHandler, // 34 50 0xC8 GPIO pin interrupt 2
|
||||
PIN_INT3_IRQHandler, // 35 51 0xCC GPIO pin interrupt 3
|
||||
PIN_INT4_IRQHandler, // 36 52 0xD0 GPIO pin interrupt 4
|
||||
PIN_INT5_IRQHandler, // 37 53 0xD4 GPIO pin interrupt 5
|
||||
PIN_INT6_IRQHandler, // 38 54 0xD8 GPIO pin interrupt 6
|
||||
PIN_INT7_IRQHandler, // 39 55 0xDC GPIO pin interrupt 7
|
||||
GINT0_IRQHandler, // 40 56 0xE0 GPIO global interrupt 0
|
||||
GINT1_IRQHandler, // 41 57 0xE4 GPIO global interrupt 1
|
||||
EVENTROUTER_IRQHandler, // 42 58 0xE8
|
||||
C_CAN1_IRQHandler, // 43 59 0xEC
|
||||
0, // 44 60 0xF0 reserved
|
||||
0, // 45 61 0xF4 reserved
|
||||
ATIMER_IRQHandler, // 46 62 0xF8 Alarm timer interrupt
|
||||
RTC_IRQHandler, // 47 63 0xFC
|
||||
0, // 48 64 0x100 reserved
|
||||
WWDT_IRQHandler, // 49 65 0x104
|
||||
0, // 50 66 0x108 reserved
|
||||
C_CAN0_IRQHandler, // 51 67 0x10C
|
||||
QEI_IRQHandler, // 52 68 0x110
|
||||
};
|
88
firmware/common/LPC43xx_M4_Startup.c
Normal file
88
firmware/common/LPC43xx_M4_Startup.c
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright 2010 - 2012 Michael Ossmann
|
||||
*
|
||||
* This file is part of HackRF.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/*
|
||||
Copyright 2010-07 By Opendous Inc. (www.MicropendousX.org)
|
||||
NVIC handler info copied from NXP User Manual UM10360
|
||||
|
||||
Start-up code for LPC17xx. See TODOs for
|
||||
modification instructions.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software
|
||||
and its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
#include <lpc43.h>
|
||||
|
||||
/* Reset_Handler variables defined in linker script */
|
||||
extern unsigned long _interrupt_vector_table;
|
||||
extern unsigned long _data;
|
||||
extern unsigned long _edata;
|
||||
extern unsigned long _etext;
|
||||
extern unsigned long _bss;
|
||||
extern unsigned long _ebss;
|
||||
|
||||
extern void __libc_init_array(void);
|
||||
extern int main(void);
|
||||
|
||||
/* Reset Handler */
|
||||
void Reset_Handler(void)
|
||||
{
|
||||
unsigned long *src, *dest;
|
||||
|
||||
// Copy the data segment initializers from flash to SRAM
|
||||
src = &_etext;
|
||||
for(dest = &_data; dest < &_edata; )
|
||||
{
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
||||
// Initialize the .bss segment of memory to zeros
|
||||
src = &_bss;
|
||||
while (src < &_ebss)
|
||||
{
|
||||
*src++ = 0;
|
||||
}
|
||||
|
||||
__libc_init_array();
|
||||
|
||||
// Set the vector table location.
|
||||
SCB_VTOR = &_interrupt_vector_table;
|
||||
|
||||
main();
|
||||
|
||||
// In case main() fails, have something to breakpoint
|
||||
while (1) {;}
|
||||
}
|
451
firmware/common/Makefile_inc.mk
Normal file
451
firmware/common/Makefile_inc.mk
Normal file
@ -0,0 +1,451 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#----------------------------------------------------------------------------
|
||||
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
|
||||
# >> Modified for use with the LUFA project. <<
|
||||
#
|
||||
# Released to the Public Domain
|
||||
#
|
||||
# Altered for ARM Cortex-M3 by Opendous Inc. - 2010-01-05
|
||||
# Altered for Project Ubertooth by Michael Ossmann 2010
|
||||
# Altered for HackRF by Michael Ossmann 2012
|
||||
#
|
||||
# Additional material for this makefile was written by:
|
||||
# Peter Fleury
|
||||
# Tim Henigan
|
||||
# Colin O'Flynn
|
||||
# Reiner Patommel
|
||||
# Markus Pfaff
|
||||
# Sander Pool
|
||||
# Frederik Rouleau
|
||||
# Carlos Lamas
|
||||
# Dean Camera
|
||||
# Denver Gingerich
|
||||
# Opendous Inc.
|
||||
# Michael Ossmann
|
||||
#
|
||||
#----------------------------------------------------------------------------
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make program = Download the hex file to the device
|
||||
#
|
||||
# make doxygen = Generate DoxyGen documentation for the project (must have
|
||||
# DoxyGen installed)
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only.
|
||||
#
|
||||
# make filename.i = Create a preprocessed source file for use in submitting
|
||||
# bug reports to the GCC project.
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
BOARD ?= JELLYBEAN
|
||||
|
||||
HACKRF_OPTS = -D$(BOARD)
|
||||
|
||||
# comment to disable RF transmission
|
||||
HACKRF_OPTS += -DTX_ENABLE
|
||||
|
||||
# CPU architecture
|
||||
CPU = cortex-m4
|
||||
|
||||
# Instruction Set to use (also known as CPU Mode)
|
||||
CPU_MODE = mthumb
|
||||
|
||||
# Additional CPU flags
|
||||
CPU_FLAGS = -mapcs-frame
|
||||
CPU_FLAGS += -mfloat-abi=hard
|
||||
CPU_FLAGS += -mfpu=fpv4-sp-d16
|
||||
#CPU_FLAGS_ASM = -mthumb-interwork
|
||||
|
||||
# Output format. (can be srec, ihex, binary)
|
||||
FORMAT = ihex
|
||||
|
||||
# Output Directory
|
||||
OUTDIR = .
|
||||
|
||||
# Library paths
|
||||
LIBS_PATH = ../common
|
||||
|
||||
# List Assembler source files here.
|
||||
# Make them always end in a capital .S. Files ending in a lowercase .s
|
||||
# will not be considered source files but generated files (assembler
|
||||
# output from the compiler), and will be deleted upon "make clean"!
|
||||
# Even though the DOS/Win* filesystem matches both .s and .S the same,
|
||||
# it will preserve the spelling of the filenames, and gcc itself does
|
||||
# care about how the name is spelled on its command-line.
|
||||
ASRC =
|
||||
|
||||
# Object files directory
|
||||
# To put object files in current directory, use a dot (.), do NOT make
|
||||
# this an empty or blank macro!
|
||||
OBJDIR = .
|
||||
|
||||
# Optimization level, can be [0, 1, 2, 3, s].
|
||||
# 0 = turn off optimization. s = optimize for size.
|
||||
# (Note: 3 is not always the best optimization level. See libc FAQ.)
|
||||
OPT = 2
|
||||
|
||||
# Debugging format.
|
||||
DEBUG = dwarf-2 -g3
|
||||
|
||||
# Linker Script for the current MCU
|
||||
LINKER_SCRIPT ?= LPC4330_M4.ld
|
||||
|
||||
# List any extra directories to look for include files here.
|
||||
# Each directory must be seperated by a space.
|
||||
# Use forward slashes for directory separators.
|
||||
# For a directory that has spaces, enclose it in quotes.
|
||||
EXTRAINCDIRS = $(LIBS_PATH)
|
||||
|
||||
# Compiler flag to set the C Standard level.
|
||||
# c89 = "ANSI" C
|
||||
# gnu89 = c89 plus GCC extensions
|
||||
# c99 = ISO C99 standard (not yet fully implemented)
|
||||
# gnu99 = c99 plus GCC extensions
|
||||
CSTANDARD = -std=gnu99
|
||||
|
||||
# Place -D or -U options here for C sources
|
||||
CDEFS = $(HACKRF_OPTS) $(COMPILE_OPTS) -Wa,-a,-ad
|
||||
|
||||
# Place -D or -U options here for ASM sources
|
||||
ADEFS =
|
||||
|
||||
# Place -D or -U options here for C++ sources
|
||||
CPPDEFS = -D$(BOARD) $(COMPILE_OPTS)
|
||||
|
||||
#---------------- Compiler Options C ----------------
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -alhms...: create assembler listing
|
||||
CFLAGS = -g$(DEBUG)
|
||||
CFLAGS += $(CDEFS)
|
||||
CFLAGS += -O$(OPT)
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Wno-unused
|
||||
CFLAGS += -Wno-comments
|
||||
CFLAGS += -fmessage-length=0
|
||||
CFLAGS += -fno-builtin
|
||||
CFLAGS += -ffunction-sections
|
||||
CFLAGS += -Wextra
|
||||
CFLAGS += -D__thumb2__=1
|
||||
CFLAGS += -msoft-float
|
||||
CFLAGS += -mno-sched-prolog
|
||||
CFLAGS += -fno-hosted
|
||||
CFLAGS += -mtune=cortex-m3
|
||||
#CFLAGS += -march=armv7e-m
|
||||
CFLAGS += -mfix-cortex-m3-ldrd
|
||||
#CFLAGS += -Wundef
|
||||
#CFLAGS += -funsigned-char
|
||||
#CFLAGS += -funsigned-bitfields
|
||||
#CFLAGS += -fno-inline-small-functions
|
||||
#CFLAGS += -fpack-struct
|
||||
#CFLAGS += -fshort-enums
|
||||
#CFLAGS += -Wstrict-prototypes
|
||||
#CFLAGS += -fno-unit-at-a-time
|
||||
#CFLAGS += -Wunreachable-code
|
||||
#CFLAGS += -Wsign-compare
|
||||
CFLAGS += -Wa,-alhms=$(<:%.c=$(OBJDIR)/%.lst)
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
CFLAGS += $(CSTANDARD)
|
||||
|
||||
#---------------- Compiler Options C++ ----------------
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -alhms...: create assembler listing
|
||||
CPPFLAGS = -g$(DEBUG)
|
||||
CPPFLAGS += $(CPPDEFS)
|
||||
CPPFLAGS += -O$(OPT)
|
||||
#CPPFLAGS += -funsigned-char
|
||||
#CPPFLAGS += -funsigned-bitfields
|
||||
#CPPFLAGS += -fpack-struct
|
||||
#CPPFLAGS += -fshort-enums
|
||||
#CPPFLAGS += -fno-exceptions
|
||||
CPPFLAGS += -Wall
|
||||
#CFLAGS += -Wundef
|
||||
#CPPFLAGS += -mshort-calls
|
||||
#CPPFLAGS += -fno-unit-at-a-time
|
||||
#CPPFLAGS += -Wstrict-prototypes
|
||||
#CPPFLAGS += -Wunreachable-code
|
||||
#CPPFLAGS += -Wsign-compare
|
||||
CPPFLAGS += -Wa,-alhms=$(<:%.cpp=$(OBJDIR)/%.lst)
|
||||
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
#CPPFLAGS += $(CSTANDARD)
|
||||
CPPFLAGS += -fno-exceptions
|
||||
CPPFLAGS += -fno-rtti
|
||||
CPPFLAGS += -fno-threadsafe-statics
|
||||
CPPFLAGS += -Wextra
|
||||
CPPFLAGS += -Weffc++
|
||||
|
||||
#---------------- Assembler Options ----------------
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -alhms: create listing
|
||||
# -gstabs: have the assembler create line number information
|
||||
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
|
||||
# dump that will be displayed for a given single line of source input.
|
||||
ASFLAGS = -g$(DEBUG) $(ADEFS) -I. -alhms=$(<:%.S=$(OBJDIR)/%.lst)
|
||||
|
||||
#---------------- Library Options ----------------
|
||||
|
||||
# List any extra directories to look for libraries here.
|
||||
# Each directory must be seperated by a space.
|
||||
# Use forward slashes for directory separators.
|
||||
# For a directory that has spaces, enclose it in quotes.
|
||||
EXTRALIBDIRS = $(LIBS_PATH)
|
||||
|
||||
#---------------- Linker Options ----------------
|
||||
# -Wl,...: tell GCC to pass this to linker.
|
||||
# -Map: create map file
|
||||
# --cref: add cross reference to map file
|
||||
LDFLAGS = -Wl,-Map=$(TARGET).map
|
||||
#LDFLAGS += -Wl,--relax
|
||||
#LDFLAGS += --gc-sections
|
||||
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
|
||||
LDFLAGS += -static
|
||||
LDFLAGS += -Wl,--start-group
|
||||
#LDFLAGS += -L$(THUMB2GNULIB) -L$(THUMB2GNULIB2)
|
||||
LDFLAGS += -lc -lg -lstdc++ -lsupc++
|
||||
LDFLAGS += -lgcc -lm
|
||||
LDFLAGS += -Wl,--end-group
|
||||
|
||||
#---------------- Programming Options ----------------
|
||||
LPCISP ?= ~/src/lpc21isp/lpc21isp
|
||||
PROGDEV ?= /dev/ttyUSB0
|
||||
|
||||
#============================================================================
|
||||
|
||||
# Define programs and commands.
|
||||
CC = arm-none-eabi-gcc
|
||||
LD = arm-none-eabi-gcc -T
|
||||
AS = arm-none-eabi-as
|
||||
OBJCOPY = arm-none-eabi-objcopy
|
||||
OBJDUMP = arm-none-eabi-objdump
|
||||
READELF = arm-none-eabi-readelf
|
||||
SIZE = arm-none-eabi-size
|
||||
AR = arm-none-eabi-ar -r
|
||||
NM = arm-none-eabi-nm
|
||||
PYTHON = /usr/bin/env python2
|
||||
REMOVE = rm -f
|
||||
|
||||
# Define Messages
|
||||
# English
|
||||
MSG_BEGIN = -------- begin --------
|
||||
MSG_END = -------- end --------
|
||||
MSG_SIZE_BEFORE = Size before:
|
||||
MSG_SIZE_AFTER = Size after:
|
||||
MSG_FLASH = Creating load file for Flash:
|
||||
MSG_DFU = Creating DFU firmware file:
|
||||
MSG_EEPROM = Creating load file for EEPROM:
|
||||
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
||||
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
||||
MSG_LINKING = Linking:
|
||||
MSG_COMPILING = Compiling C:
|
||||
MSG_COMPILING_CPP = Compiling C++:
|
||||
MSG_ASSEMBLING = Assembling:
|
||||
MSG_CLEANING = Cleaning project:
|
||||
MSG_CREATING_LIBRARY = Creating library:
|
||||
|
||||
# Define all object files.
|
||||
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
|
||||
|
||||
# Define all listing files.
|
||||
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
||||
|
||||
# Compiler flags to generate dependency files.
|
||||
GENDEPFLAGS = -MMD -MP -MD
|
||||
|
||||
# Combine all necessary flags and optional flags.
|
||||
# Add target processor to flags.
|
||||
ALL_CFLAGS = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS) -I. $(CFLAGS) $(GENDEPFLAGS)
|
||||
ALL_CPPFLAGS = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
|
||||
ALL_ASFLAGS = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS_ASM) $(ASFLAGS)
|
||||
# only difference between Linker flags and CFLAGS is CPU_FLAGS_ASM as -mapcs-frame is not needed
|
||||
ALL_CFLAGS_LINKER = -mcpu=$(CPU) -$(CPU_MODE) $(CPU_FLAGS_ASM)
|
||||
|
||||
# Default target.
|
||||
all: begin gccversion sizebefore build showtarget sizeafter end
|
||||
|
||||
# Change the build target to build a HEX file or a library.
|
||||
build: elf hex bin srec lss sym
|
||||
#build: lib
|
||||
|
||||
elf: $(TARGET).elf
|
||||
hex: $(TARGET).hex
|
||||
bin: $(TARGET).bin
|
||||
srec: $(TARGET).srec
|
||||
eep: $(TARGET).eep
|
||||
lss: $(TARGET).lss
|
||||
sym: $(TARGET).sym
|
||||
LIBNAME=lib$(TARGET).a
|
||||
lib: $(LIBNAME)
|
||||
|
||||
# Eye candy.
|
||||
begin:
|
||||
@echo
|
||||
@echo $(MSG_BEGIN)
|
||||
|
||||
end:
|
||||
@echo $(MSG_END)
|
||||
@echo
|
||||
|
||||
# Display size of file.
|
||||
ELFSIZE = $(SIZE) $(FORMAT_FLAG) $(TARGET).elf
|
||||
|
||||
sizebefore:
|
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
|
||||
2>/dev/null; echo; fi
|
||||
|
||||
sizeafter:
|
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
|
||||
2>/dev/null; echo; fi
|
||||
|
||||
showtarget:
|
||||
@echo
|
||||
@echo --------- Target Information ---------
|
||||
@echo ARM Model: $(CPU)
|
||||
@echo Board: $(BOARD)
|
||||
@echo --------------------------------------
|
||||
|
||||
# Display compiler version information.
|
||||
gccversion:
|
||||
@$(CC) --version
|
||||
|
||||
program: $(TARGET).hex
|
||||
$(LPCISP) -control $(TARGET).hex $(PROGDEV) 230400 4000
|
||||
|
||||
# Create final output files (.hex, .eep) from ELF output file.
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O $(FORMAT) $< $@
|
||||
|
||||
%.bin: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O binary $< $(TARGET).bin
|
||||
|
||||
%.srec: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O srec $< $(TARGET).srec
|
||||
|
||||
%.eep: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EEPROM) $@
|
||||
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||
--change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EXTENDED_LISTING) $@
|
||||
$(OBJDUMP) -h -z -S $< > $@
|
||||
|
||||
# Create a symbol table from ELF output file.
|
||||
%.sym: %.elf
|
||||
@echo
|
||||
@echo $(MSG_SYMBOL_TABLE) $@
|
||||
$(NM) -n $< > $@
|
||||
|
||||
# Create library from object files.
|
||||
.SECONDARY : $(TARGET).a
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.a: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_CREATING_LIBRARY) $@
|
||||
$(AR) $@ $(OBJ)
|
||||
|
||||
# Link: create ELF output file from object files.
|
||||
.SECONDARY : $(TARGET).elf
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.elf: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_LINKING) $@
|
||||
$(LD) $(LINKER_SCRIPT) $(ALL_CFLAGS_LINKER) $(LDFLAGS) -o $@ $^
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
$(OBJDIR)/%.o : %.c
|
||||
@echo
|
||||
@echo $(MSG_COMPILING) $<
|
||||
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
# Compile: create object files from C++ source files.
|
||||
$(OBJDIR)/%.o : %.cpp
|
||||
@echo
|
||||
@echo $(MSG_COMPILING_CPP) $<
|
||||
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
|
||||
|
||||
# Compile: create assembler files from C source files.
|
||||
%.s : %.c
|
||||
$(AS) -S $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
# Compile: create assembler files from C++ source files.
|
||||
%.s : %.cpp
|
||||
$(CC) -S $(ALL_CPPFLAGS) $< -o $@
|
||||
|
||||
# Assemble: create object files from assembler source files.
|
||||
$(OBJDIR)/%.o : %.S
|
||||
@echo
|
||||
@echo $(MSG_ASSEMBLING) $<
|
||||
$(AS) $< $(ALL_ASFLAGS) --MD $(OBJDIR)/$(@F).d -o $@
|
||||
|
||||
# Create preprocessed source for use in sending a bug report.
|
||||
%.i : %.c
|
||||
$(CC) -E -mmcu=$(CPU) -I. $(CFLAGS) $< -o $@
|
||||
|
||||
# Target: clean project.
|
||||
clean: begin clean_list clean_binary end
|
||||
|
||||
clean_binary:
|
||||
$(REMOVE) $(TARGET).hex
|
||||
|
||||
clean_list:
|
||||
@echo $(MSG_CLEANING)
|
||||
$(REMOVE) $(TARGET).eep
|
||||
$(REMOVE) $(TARGET)eep.hex
|
||||
$(REMOVE) $(TARGET).cof
|
||||
$(REMOVE) $(TARGET).elf
|
||||
$(REMOVE) $(TARGET).map
|
||||
$(REMOVE) $(TARGET).sym
|
||||
$(REMOVE) $(TARGET).lss
|
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
|
||||
$(REMOVE) $(CPPSRC:%.cpp=$(OBJDIR)/%.o)
|
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
|
||||
$(REMOVE) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst)
|
||||
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
||||
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.o)
|
||||
$(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.o.d)
|
||||
$(REMOVE) *.o.d
|
||||
$(REMOVE) $(SRC:.c=.s)
|
||||
$(REMOVE) $(SRC:.c=.d)
|
||||
$(REMOVE) $(CPPSRC:.cpp=.d)
|
||||
$(REMOVE) $(SRC:.c=.i)
|
||||
$(REMOVE) InvalidEvents.tmp
|
||||
$(REMOVE) $(TARGET).bin
|
||||
$(REMOVE) $(TARGET).srec
|
||||
|
||||
doxygen:
|
||||
@echo Generating Project Documentation...
|
||||
@doxygen Doxygen.conf
|
||||
@echo Documentation Generation Complete.
|
||||
|
||||
clean_doxygen:
|
||||
rm -rf Documentation
|
||||
|
||||
# Create object files directory
|
||||
$(shell mkdir $(OBJDIR)/ 2>/dev/null)
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : all showtarget begin end sizebefore sizeafter \
|
||||
gccversion build elf hex eep lss sym program clean \
|
||||
clean_list clean_binary doxygen
|
2
firmware/common/README
Normal file
2
firmware/common/README
Normal file
@ -0,0 +1,2 @@
|
||||
This directory contains things shared by multiple HackRF firmware
|
||||
implementations.
|
53
firmware/common/hackrf_core.c
Normal file
53
firmware/common/hackrf_core.c
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2010 - 2012 Michael Ossmann
|
||||
*
|
||||
* This file is part of HackRF.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "hackrf_core.h"
|
||||
|
||||
void gpio_init()
|
||||
{
|
||||
/*
|
||||
* Basic GPIO setup for all pins. This shouldn't be necessary after a
|
||||
* reset, but we might get called at other times.
|
||||
*/
|
||||
all_pins_off();
|
||||
|
||||
/* set certain pins as outputs, all others inputs */
|
||||
GPIO_DIR2 = (PIN_LED1 | PIN_LED2 | PIN_LED3);
|
||||
}
|
||||
|
||||
void all_pins_off(void)
|
||||
{
|
||||
/* configure all pins for GPIO? */
|
||||
|
||||
/* configure all pins as inputs */
|
||||
GPIO_PIN0 = 0;
|
||||
GPIO_PIN1 = 0;
|
||||
GPIO_PIN2 = 0;
|
||||
GPIO_PIN3 = 0;
|
||||
GPIO_PIN4 = 0;
|
||||
GPIO_PIN5 = 0;
|
||||
GPIO_PIN6 = 0;
|
||||
GPIO_PIN7 = 0;
|
||||
|
||||
/* pull-up on every pin? */
|
||||
|
||||
/* set all outputs low? */
|
||||
}
|
57
firmware/common/hackrf_core.h
Normal file
57
firmware/common/hackrf_core.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2010 - 2012 Michael Ossmann
|
||||
*
|
||||
* This file is part of HackRF.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __HACKRF_CORE_H
|
||||
#define __HACKRF_CORE_H
|
||||
|
||||
#include "lpc43.h"
|
||||
|
||||
/* hardware identification number */
|
||||
#define BOARD_ID_JELLYBEAN 0
|
||||
|
||||
#ifdef JELLYBEAN
|
||||
#define BOARD_ID BOARD_ID_JELLYBEAN
|
||||
#endif
|
||||
|
||||
/* GPIO pins */
|
||||
//#ifdef JELLYBEAN
|
||||
#define PIN_LED1 (1 << 1) /* GPIO2[1] on P4_1 */
|
||||
#define PIN_LED2 (1 << 2) /* GPIO2[2] on P4_2 */
|
||||
#define PIN_LED3 (1 << 8) /* GPIO2[8] on P6_12 */
|
||||
//#endif
|
||||
|
||||
/* indicator LED control */
|
||||
//#ifdef JELLYBEAN
|
||||
#define LED1 (GPIO_PIN2 & PIN_LED1)
|
||||
#define LED1_SET (GPIO_SET2 = PIN_LED1)
|
||||
#define LED1_CLR (GPIO_CLR2 = PIN_LED1)
|
||||
#define LED2 (GPIO_PIN2 & PIN_LED2)
|
||||
#define LED2_SET (GPIO_SET2 = PIN_LED2)
|
||||
#define LED2_CLR (GPIO_CLR2 = PIN_LED2)
|
||||
#define LED3 (GPIO_PIN2 & PIN_LED3)
|
||||
#define LED3_SET (GPIO_SET2 = PIN_LED3)
|
||||
#define LED3_CLR (GPIO_CLR2 = PIN_LED3)
|
||||
//#endif
|
||||
|
||||
void gpio_init(void);
|
||||
void all_pins_off(void);
|
||||
|
||||
#endif /* __HACKRF_CORE_H */
|
53
firmware/common/lpc43.h
Normal file
53
firmware/common/lpc43.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This is just a stub to see if I can get things working.
|
||||
* - mossmann
|
||||
*/
|
||||
|
||||
#ifndef __LPC43_H
|
||||
#define __LPC43_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define LPC43_REG(a) (*(volatile uint32_t *)(a))
|
||||
#define LPC43_REG8(a) (*(volatile uint8_t *)(a))
|
||||
#define LPC43_REG16(a) (*(volatile uint16_t *)(a))
|
||||
|
||||
#define SCB_VTOR LPC43_REG(0xE000ED08) /* Vector Table Offset Register */
|
||||
|
||||
#define GPIO_DIR0 LPC43_REG(0x400F6000)
|
||||
#define GPIO_DIR1 LPC43_REG(0x400F6004)
|
||||
#define GPIO_DIR2 LPC43_REG(0x400F6008)
|
||||
#define GPIO_DIR3 LPC43_REG(0x400F600C)
|
||||
#define GPIO_DIR4 LPC43_REG(0x400F6010)
|
||||
#define GPIO_DIR5 LPC43_REG(0x400F6014)
|
||||
#define GPIO_DIR6 LPC43_REG(0x400F6018)
|
||||
#define GPIO_DIR7 LPC43_REG(0x400F601C)
|
||||
|
||||
#define GPIO_PIN0 LPC43_REG(0x400F6100)
|
||||
#define GPIO_PIN1 LPC43_REG(0x400F6104)
|
||||
#define GPIO_PIN2 LPC43_REG(0x400F6108)
|
||||
#define GPIO_PIN3 LPC43_REG(0x400F610C)
|
||||
#define GPIO_PIN4 LPC43_REG(0x400F6110)
|
||||
#define GPIO_PIN5 LPC43_REG(0x400F6114)
|
||||
#define GPIO_PIN6 LPC43_REG(0x400F6118)
|
||||
#define GPIO_PIN7 LPC43_REG(0x400F611C)
|
||||
|
||||
#define GPIO_SET0 LPC43_REG(0x400F6200)
|
||||
#define GPIO_SET1 LPC43_REG(0x400F6204)
|
||||
#define GPIO_SET2 LPC43_REG(0x400F6208)
|
||||
#define GPIO_SET3 LPC43_REG(0x400F620C)
|
||||
#define GPIO_SET4 LPC43_REG(0x400F6210)
|
||||
#define GPIO_SET5 LPC43_REG(0x400F6214)
|
||||
#define GPIO_SET6 LPC43_REG(0x400F6218)
|
||||
#define GPIO_SET7 LPC43_REG(0x400F621C)
|
||||
|
||||
#define GPIO_CLR0 LPC43_REG(0x400F6280)
|
||||
#define GPIO_CLR1 LPC43_REG(0x400F6284)
|
||||
#define GPIO_CLR2 LPC43_REG(0x400F6288)
|
||||
#define GPIO_CLR3 LPC43_REG(0x400F628C)
|
||||
#define GPIO_CLR4 LPC43_REG(0x400F6290)
|
||||
#define GPIO_CLR5 LPC43_REG(0x400F6294)
|
||||
#define GPIO_CLR6 LPC43_REG(0x400F6298)
|
||||
#define GPIO_CLR7 LPC43_REG(0x400F629C)
|
||||
|
||||
#endif /* __LPC43_H */
|
Reference in New Issue
Block a user