aboutsummaryrefslogblamecommitdiff
path: root/src/cc20rng/Makefile
blob: bc5fce57f506f26b94b2b489c923c59983a7daab (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-
# Application number and version info are included in the ELF file
# symbol table through two global, asbolute symbols. Use nm(1) on an
# ELF file to figure things out. Example:
#   nm cc20rng.elf | awk '/VERSION/{print $1}'

# Application number:
# - cc20rng: 01
# - entropy: 02
APPLICATION = 0x00000001

# Version info is four octects, from most significant to least:
# - Major version, two bytes: 00..FFFF
# - Minor version, one byte: 00..FF
# - Patch level, one byte: 00..FF
VERSION = 0x00010000

# put your *.o targets here, make should handle the rest!
SRCS = main.c stm_init.c system_stm32f4xx.c stm32f4xx_it.c stm32f4xx_hal_msp.c cc20_prng.c

# all the files will be generated with this name
PROJ_NAME=cc20rng

TOPLEVEL=../..
include $(TOPLEVEL)/common.mk


OBJS = $(SRCS:.c=.o)

###################################################

.PHONY: lib proj

all: lib proj

lib:
	$(MAKE) -C $(STD_PERIPH_LIB) STDPERIPH_SETTINGS="$(STDPERIPH_SETTINGS)"


proj: 	$(PROJ_NAME).elf

$(PROJ_NAME).elf: $(SRCS)
	$(CC) $(CFLAGS) $^ -o $@ -L$(STD_PERIPH_LIB) -lstmf4 -L$(LDSCRIPT_INC) -T$(MCU_LINKSCRIPT) -g -Wl,--defsym=APPLICATION=$(APPLICATION) -Wl,--defsym=VERSION=$(VERSION)
	$(OBJCOPY) -O ihex $(PROJ_NAME).elf $(PROJ_NAME).hex
	$(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin
	$(OBJDUMP) -St $(PROJ_NAME).elf >$(PROJ_NAME).lst
	$(SIZE) $(PROJ_NAME).elf

c-format:
	clang-format-4.0 -i cc20_prng.[ch]
	clang-format-4.0 -style="{IndentWidth: 2}" -i main.c

clean:
	rm -f *.o
	rm -f $(PROJ_NAME).elf
	rm -f $(PROJ_NAME).hex
	rm -f $(PROJ_NAME).bin
	rm -f $(PROJ_NAME).map
	rm -f $(PROJ_NAME).lst

really-clean: clean
	$(MAKE) -C $(STD_PERIPH_LIB) clean

debug:
    $(GDB) -ex "target remote localhost:3333" \
        -ex "set remote hardware-breakpoint-limit 6" \
        -ex "set remote hardware-watchpoint-limit 4" $(PROJ_NAME).elf

flash-target:
	$(OPENOCD) -f $(OPENOCD_BOARD_DIR)/$(OPENOCD_PROC_FILE) \
		-c "program $(PROJ_NAME).elf verify" -c "reset"

# test program not using cross compiling
test: clean test.c cc20_prng.c
	cc -DCHACHA20_PRNG_DEBUG -O2 -g -o test test.c cc20_prng.c
	./test
1, text2)) except tornado.iostream.StreamClosedError: self.close() def stdin_loop(self): return self.copy_loop(self.stdin_stream, self.socket_stream, "\n", "\r") def stdout_loop(self): return self.copy_loop(self.socket_stream, self.stdout_stream, "\r\n", "\n") def main(): parser = argparse.ArgumentParser(formatter_class = argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("cty_socket", nargs = "?", help = "CTY PF_UNIX socket name", default = os.getenv("CRYPTECH_CTY_CLIENT_SOCKET_NAME", "/tmp/.cryptech_muxd.cty")) args = parser.parse_args() s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) try: s.connect(args.cty_socket) except socket.error: sys.exit("Couldn't connect to socket {}".format(args.cty_socket)) tornado.ioloop.IOLoop.current().run_sync(FemtoTerm(s).run) if __name__ == "__main__": try: main() except KeyboardInterrupt: pass