Commit 8938f6dc authored by bg nerilex's avatar bg nerilex

complete restructuring to "embedded-crypto-lib", compiles for AVR (mega644)...

complete restructuring to "embedded-crypto-lib", compiles for AVR (mega644) and Cortex-M0 (NRF51822)
parent 3d940f2a
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: false
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: true
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: true
Standard: Cpp11
IndentWidth: 4
TabWidth: 8
UseTab: Never
BreakBeforeBraces: Linux
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
SpaceBeforeParens: ControlStatements
DisableFormat: false
...
/out/*/**
**/old/**
**/.old/**
**/to_port/**
**/.to_port/**
*~
*.ps
SHELL=sh
.DEFAULT_GOAL := info
include build_system/Makefile
BOARD := PCA10001
include Makefile
set WORKAREASIZE 0
source [find interface/jlink.cfg]
transport select swd
source [find target/nrf51.cfg]
init
reset halt
arm semihosting enable
resume
reset run
wait_halt [expr 1000 * 60 * 60 * 24 * 3]
shutdown
#source [find /usr/share/openocd/scripts/interface/luminary-icdi.cfg]
source [find /usr/share/openocd/scripts/interface/ftdi/luminary-icdi.cfg]
source [find /usr/share/openocd/scripts/target/stellaris.cfg]
# GDB can also flash my flash!
#gdb_memory_map enable
#gdb_flash_program enable
adapter_khz 5500
#source [find /usr/share/openocd/scripts/target/lm3s9b9x.cfg]
This diff is collapsed.
This diff is collapsed.
# ----------------------------------------------------------------------------
#
# GNU Make Standard Library (GMSL)
#
# A library of functions to be used with GNU Make's $(call) that
# provides functionality not available in standard GNU Make.
#
# Copyright (c) 2005-2014 John Graham-Cumming
#
# This file is part of GMSL
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# Neither the name of the John Graham-Cumming nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# ----------------------------------------------------------------------------
# Determine if the library has already been included and if so don't
# bother including it again
ifndef __gmsl_included
# Standard definitions for true and false. true is any non-empty
# string, false is an empty string. These are intended for use with
# $(if).
true := T
false :=
# ----------------------------------------------------------------------------
# Function: not
# Arguments: 1: A boolean value
# Returns: Returns the opposite of the arg. (true -> false, false -> true)
# ----------------------------------------------------------------------------
not = $(if $1,$(false),$(true))
# Prevent reinclusion of the library
__gmsl_included := $(true)
# Try to determine where this file is located. If the caller did
# include /foo/gmsl then extract the /foo/ so that __gmsl gets
# included transparently
__gmsl_root :=
ifneq ($(MAKEFILE_LIST),)
__gmsl_root := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
# If there are any spaces in the path in __gmsl_root then give up
ifeq (1,$(words $(__gmsl_root)))
__gmsl_root := $(patsubst %gmsl,%,$(__gmsl_root))
endif
endif
include $(__gmsl_root)__gmsl
endif # __gmsl_included
BCAL_STD = nessie_common.o nessie_bc_test.o performance_test.o \
bcal-basic.o bcal-performance.o keysize_descriptor.o \
bcal-nessie.o
CLI_STD = cli.o hexdigit_tab.o dbz_strings.o string-extras.o dump.o \
main-test-common.o
HFAL_STD = nessie_common.o nessie_hash_test.o performance_test.o \
hfal-basic.o hfal-performance.o hfal-nessie.o hfal-test.o shavs.o
SCAL_STD = nessie_common.o performance_test.o memxor.o \
scal-basic.o scal-nessie.o \
keysize_descriptor.o nessie_stream_test.o
# scal-performance.o
# Makefile for bcal-algos (library)
ALGO_NAME := BCAL_ALGOS
$(ALGO_NAME)_DIR := bcal/
$(ALGO_NAME)_INCDIR :=
$(ALGO_NAME)_OBJ := \
bcal_aes128.o \
bcal_aes192.o \
bcal_aes256.o \
bcal_cast5.o \
bcal_cast6.o \
bcal_cscipher.o \
bcal_des.o \
bcal_khazad.o \
bcal_noekeon.o \
bcal_present80.o \
bcal_present128.o \
bcal_rc5.o \
bcal_rc6.o \
bcal_seed.o \
bcal_serpent.o \
bcal_tdes2.o \
bcal_tdes.o \
bcal_xtea.o
# Makefile for bcal-basic (library)
ALGO_NAME := BCAL_BASIC
$(ALGO_NAME)_DIR := bcal/
$(ALGO_NAME)_INCDIR := memxor/
$(ALGO_NAME)_OBJ := bcal-basic.o keysize_descriptor.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
# Makefile for hfal-algos (library)
ALGO_NAME := HFAL_ALGOS
$(ALGO_NAME)_DIR := hfal/
$(ALGO_NAME)_INCDIR :=
$(ALGO_NAME)_OBJ := \
hfal_blake_large.o \
hfal_blake_small.o \
hfal_bmw_large.o \
hfal_bmw_small.o \
hfal_cubehash.o \
hfal_echo.o \
hfal_groestl_large.o \
hfal_groestl_small.o \
hfal_jh.o \
hfal_keccak.o \
hfal_md5.o \
hfal_sha1.o \
hfal_sha224.o \
hfal_sha256.o \
hfal_sha384.o \
hfal_sha512.o \
hfal_shabal.o \
hfal_skein1024.o \
hfal_skein256.o \
hfal_skein512.o
# Makefile for hfal-hmac (library)
ALGO_NAME := HFAL_HMAC
$(ALGO_NAME)_DIR := hfal/
$(ALGO_NAME)_INCDIR := memxor/
$(ALGO_NAME)_OBJ := hfal-basic.o hfal-hmac.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
# Makefile for scal-algos (library)
ALGO_NAME := SCAL_ALGOS
$(ALGO_NAME)_DIR := scal/
$(ALGO_NAME)_INCDIR :=
$(ALGO_NAME)_OBJ := \
scal_arcfour.o \
scal_grain.o \
scal_mickey128.o \
scal_rabbit.o \
scal_salsa20.o \
scal_trivium.o
# Makefile for scal-basic (library)
ALGO_NAME := SCAL_BASIC
$(ALGO_NAME)_DIR := scal/
$(ALGO_NAME)_INCDIR := memxor/
$(ALGO_NAME)_OBJ := scal-basic.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
# Make-Stub for AES
NAME := AES_C
TYPE := BLOCK_CIPHER
DIR := algorithm/aes/c
INCDIR := algorithm/gf2x8mul/c algorithm/memxor/c interface/bcal
OBJ := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o \
aes_keyschedule.o gf2x8mul.o \
aes128_enc.o aes128_dec.o aes192_enc.o aes192_dec.o \
aes256_enc.o aes256_dec.o
TESTBIN := main-aes-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o memxor.o \
bcal_aes128.o bcal_aes192.o bcal_aes256.o bcal-basic.o bcal-cbc.o \
keysize_descriptor.o bcal-cfb_byte.o \
bcal-cfb_bit.o bcal-ofb.o bcal-ctr.o bcal-cmac.o cmacvs.o \
bcal-eax.o bcal-performance.o
# Makefile for AES
NAME := AES_CORTEX_M0
TYPE := BLOCK_CIPHER
DIR := algorithm/aes/cortex-m0-asm
INCDIR := algorithm/gf2x8mul/c algorithm/memxor/c interface/bcal
OBJ := aes_enc.o aes_enc-asm.o aes_dec.o aes_sbox.o aes_invsbox.o \
aes_keyschedule.o gf2x8mul.o \
aes128_enc.o aes128_dec.o aes192_enc.o aes192_dec.o \
aes256_enc.o aes256_dec.o
TESTBIN := main-aes-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o memxor.o \
bcal_aes128.o bcal_aes192.o bcal_aes256.o bcal-basic.o bcal-cbc.o \
keysize_descriptor.o bcal-cfb_byte.o \
bcal-cfb_bit.o bcal-ofb.o bcal-ctr.o bcal-cmac.o cmacvs.o \
bcal-eax.o bcal-performance.o
# Makefile for AES
NAME := HELLO
TYPE := TEST
DIR :=
INCDIR :=
OBJ :=
TESTBIN := main-hello-test.o $(CLI_STD)
# Make-Stub for SHA-2
NAME := SHA2_C
TYPE := HASH_FUNCTION
DIR := algorithm/sha-2/c
INCDIR := interface/hfal
OBJ := sha224.o sha256.o sha384.o sha512.o \
sha2_small_common.o sha2_large_common.o
TESTBIN := main-sha2-test.o $(CLI_STD) $(HFAL_STD) \
hfal_sha224.o hfal_sha256.o hfal_sha512.o hfal_sha384.o
#NAME := "Labor Board"
MCU := ATMEGA644
INFO := generic ATmega board
PROGRAMMER = avrispmkII
PROG_PORT = usb
FLASHCMD := avrdude -p $(MCU) -P $(PROG_PORT) -c $(PROGRAMMER) -U flash:w:<PROGRAM_BIN>
RUNCMD = minicom -o 03
F_CPU = 16000000
OPTIMIZE = -Os
DEFS := -D$(call uc, $(MCU)) -DF_CPU=$(F_CPU) -DUART0_BAUD_RATE=38400
# override CFLAGS_A = -MMD -MF$(DEP_DIR)$(patsubst %.o,%.d,$(notdir $(1))) $(DEBUG) $(WARNING) -std=$(CSTD) $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
CFLAGS := -mmcu=$(call lc,$(MCU))
LDFLAGS = -gdwarf-2
ASFLAGS := -mmcu=$(call lc,$(MCU)) -Wa,--gdwarf-2
MCU := NRF51822
INFO := simple and cheap board from nordic semiconductor
OPENOCD_CFG = board_specific/nrf51822/openocd-nrf51.cfg
OPENOCD_RUN_CFG = board_specific/nrf51822/openocd-run.cfg
START_ADDRESS = 0
FLASHCMD = $(OPENOCD) -f $(OPENOCD_CFG) -c "init; reset halt; program <PROGRAM_BIN> $(START_ADDRESS) verify; shutdown;"
RUNCMD = $(OPENOCD) -f $(OPENOCD_CFG) -f $(OPENOCD_RUN_CFG) 2> /dev/null
PREFIX := avr-#
MARCH := avr5
LDFLAGS := -Wl,--gc-sections
CFLAGS := -ffunction-sections -fdata-sections
\ No newline at end of file
PREFIX := arm-none-eabi-#
MARCH := cortex-m0
LDFLAGS := -L /usr/lib/gcc/arm-none-eabi/4.9/armv6-m/ \
-L /usr/lib/arm-none-eabi/newlib/armv6-m/ \
-Wl,--gc-sections \
--specs=rdimon.specs \
-Wl,--start-group -lgcc -lc -lc -lm -lrdimon -Wl,--end-group
CFLAGS := -mcpu=$(MARCH) -mtune=$(MARCH) -mthumb -mabi=aapcs -mfloat-abi=soft
\ No newline at end of file
LDSCRIPT :=
CORE := AVR_5
OBJ := avr_setup.o circularbytebuffer-asm.o avr_uart_i-asm.o
DEFS := -DPLATFORM_SETUP=avr_setup
LDFLAGS :=
LDSCRIPT := nrf51_xxaa.ld
CORE := CORTEX_M0
OBJ := startup.o system_nrf51.o
LDFLAGS := -T $(LDSCRIPT)
CC = $(PREFIX)gcc
LD = $(PREFIX)ld
AS = $(PREFIX)as
OBJCOPY = $(PREFIX)objcopy
OBJDUMP = $(PREFIX)objdump
AR = $(PREFIX)ar
SIZE = $(PREFIX)size
HEXDUMP = hexdump
HASH = sha256sum
OPENOCD = openocd
READELF = readelf
CHMOD = chmod
CHOWN = chown
CHGRP = chgrp
RM = rm
RUBY = ruby
GET_TEST = host/get_test.rb
MAKE = make
MAKE2GRAPH = ~/bin/make2graph.rb
TWOPI = twopi
\ No newline at end of file
/* lm3s9b90.ld */
/*
This file is part of the OpenARMWare.
Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
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 3 of the License, 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. If not, see <http://www.gnu.org/licenses/>.
*/
MEMORY {
flash (rx): ORIGIN = 0x00000000, LENGTH = 256K
ram (rwx): ORIGIN = 0x20000000, LENGTH = 96K
}
SECTIONS {
.text : {
_text = .;
KEEP(*(.isr_vectors))
*(.text*)
*(.rodata*)
} > flash