#!/bin/sh PROJ="${1?'project'}" OPENOCD=openocd # location of OpenOCD Board .cfg files (only used with 'make flash-target') # # This path is from Ubuntu 14.04. # OPENOCD_BOARD_DIR=/usr/share/openocd/scripts/board # Configuration (cfg) file containing programming directives for OpenOCD # # If you are using an STLINK v2.0 from an STM32 F4 DISCOVERY board, # set this variable to "stm32f4discovery.cfg". # # If you are using an STLINK v2.1 from an STM32 F4 NUCLEO board, # set this variable to "st_nucleo_f401re.cfg". # # If you are using something else, look for a matching configuration file in # the OPENOCD_BOARD_DIR directory. # OPENOCD_PROC_FILE=stm32f4discovery.cfg if [ "x`lsusb -d 0483:374b`" != "x" ]; then for fn in st_nucleo_f4.cfg st_nucleo_f401re.cfg; do if [ -f "$OPENOCD_BOARD_DIR/$fn" ]; then OPENOCD_PROC_FILE="$fn" fi done fi # This used to be "... verify reset exit", but that fails on Debian Jessie. # The Net of a Million Lies claims that the "exit" is unnecessary, so the # simplest solution is just to omit it. Should this turn out to be a mistake, # well, we'll have to do something more clever to deal with these silly version # skew problems between the several versions of openocd in current use. $OPENOCD -f $OPENOCD_BOARD_DIR/$OPENOCD_PROC_FILE -c "program $PROJ.elf verify reset" # exit Cryptech HSM on STM-32 ARM processorgit repositories
aboutsummaryrefslogtreecommitdiff
path: root/projects/hsm/cryptech_miniterm
blob: af52b0e98827cc6f6bcee63ee4674c0a2d12c625 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
#
# Copyright (c) 2016, NORDUnet A/S All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# - Redistributions of source code must retain the above copyright notice,
#   this list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright
#   notice, this list of conditions and the following disclaimer in the
#   documentation and/or other materials provided with the distribution.
#
# - Neither the name of the NORDUnet 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
# HOLDER 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.

"""
Utility to run PySerial's "miniterm" with default settings suitable
for talking to the Cryptech Alpha's console port.
"""

import serial.tools.miniterm
import sys
import os

default_port = os.getenv("CRYPTECH_CTY_CLIENT_SERIAL_DEVICE")
default_baud = os.getenv("CRYPTECH_CTY_CLIENT_SERIAL_SPEED", 921600)

sys.exit(serial.tools.miniterm.main(default_port     = default_port,
                                    default_baudrate = int(default_baud)))