|
| 1 | +/* |
| 2 | + * Copyright (c) 2015, Devan Lai |
| 3 | + * |
| 4 | + * Permission to use, copy, modify, and/or distribute this software |
| 5 | + * for any purpose with or without fee is hereby granted, provided |
| 6 | + * that the above copyright notice and this permission notice |
| 7 | + * appear in all copies. |
| 8 | + * |
| 9 | + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR |
| 13 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
| 14 | + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
| 15 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 16 | + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | + */ |
| 18 | + |
| 19 | +/* |
| 20 | + Portions of this file are derived from: |
| 21 | +
|
| 22 | + Dapper Mime - an open-source CMSIS-DAP implementation |
| 23 | + HAL for STM32F0xx2 |
| 24 | + this file is used by the mbed CMSIS-DAP routines |
| 25 | +
|
| 26 | + Copyright (C) 2014 Peter Lawrence |
| 27 | +
|
| 28 | + Permission is hereby granted, free of charge, to any person obtaining a |
| 29 | + copy of this software and associated documentation files (the "Software"), |
| 30 | + to deal in the Software without restriction, including without limitation |
| 31 | + the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 32 | + and/or sell copies of the Software, and to permit persons to whom the |
| 33 | + Software is furnished to do so, subject to the following conditions: |
| 34 | +
|
| 35 | + The above copyright notice and this permission notice shall be included in |
| 36 | + all copies or substantial portions of the Software. |
| 37 | +
|
| 38 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 39 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 40 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 41 | + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 42 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 43 | + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 44 | + DEALINGS IN THE SOFTWARE. |
| 45 | +*/ |
| 46 | + |
| 47 | +#ifndef __DAP_CONFIG_H__ |
| 48 | +#define __DAP_CONFIG_H__ |
| 49 | + |
| 50 | +//************************************************************************************************** |
| 51 | +/** |
| 52 | +\defgroup DAP_Config_Debug_gr CMSIS-DAP Debug Unit Information |
| 53 | +\ingroup DAP_ConfigIO_gr |
| 54 | +@{ |
| 55 | +Provides definitions about: |
| 56 | + - Definition of Cortex-M processor parameters used in CMSIS-DAP Debug Unit. |
| 57 | + - Debug Unit communication packet size. |
| 58 | + - Debug Access Port communication mode (JTAG or SWD). |
| 59 | + - Optional information about a connected Target Device (for Evaluation Boards). |
| 60 | +*/ |
| 61 | + |
| 62 | +#include "config.h" |
| 63 | + |
| 64 | +// Board configuration options |
| 65 | + |
| 66 | +/// Processor Clock of the Cortex-M MCU used in the Debug Unit. |
| 67 | +/// This value is used to calculate the SWD/JTAG clock speed. |
| 68 | +#define CPU_CLOCK 48000000 ///< Specifies the CPU Clock in Hz |
| 69 | + |
| 70 | +/// Number of processor cycles for I/O Port write operations. |
| 71 | +/// This value is used to calculate the SWD/JTAG clock speed that is generated with I/O |
| 72 | +/// Port write operations in the Debug Unit by a Cortex-M MCU. Most Cortex-M processors |
| 73 | +/// requrie 2 processor cycles for a I/O Port Write operation. If the Debug Unit uses |
| 74 | +/// a Cortex-M0+ processor with high-speed peripheral I/O only 1 processor cycle might be |
| 75 | +/// required. |
| 76 | +#define IO_PORT_WRITE_CYCLES 2 ///< I/O Cycles: 2=default, 1=Cortex-M0+ fast I/0 |
| 77 | + |
| 78 | +/// Indicate that Serial Wire Debug (SWD) communication mode is available at the Debug Access Port. |
| 79 | +/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>. |
| 80 | +#define DAP_SWD 1 ///< SWD Mode: 1 = available, 0 = not available |
| 81 | + |
| 82 | +/// Indicate that JTAG communication mode is available at the Debug Port. |
| 83 | +/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>. |
| 84 | +#if defined(CONF_JTAG) |
| 85 | +#define DAP_JTAG 1 ///< JTAG Mode: 1 = available |
| 86 | +#else |
| 87 | +#define DAP_JTAG 0 ///< JTAG Mode: 0 = not available |
| 88 | +#endif |
| 89 | + |
| 90 | +/// Configure maximum number of JTAG devices on the scan chain connected to the Debug Access Port. |
| 91 | +/// This setting impacts the RAM requirements of the Debug Unit. Valid range is 1 .. 255. |
| 92 | +#define DAP_JTAG_DEV_CNT 8 ///< Maximum number of JTAG devices on scan chain |
| 93 | + |
| 94 | +/// Default communication mode on the Debug Access Port. |
| 95 | +/// Used for the command \ref DAP_Connect when Port Default mode is selected. |
| 96 | +#define DAP_DEFAULT_PORT 1 ///< Default JTAG/SWJ Port Mode: 1 = SWD, 2 = JTAG. |
| 97 | + |
| 98 | +/// Default communication speed on the Debug Access Port for SWD and JTAG mode. |
| 99 | +/// Used to initialize the default SWD/JTAG clock frequency. |
| 100 | +/// The command \ref DAP_SWJ_Clock can be used to overwrite this default setting. |
| 101 | +#define DAP_DEFAULT_SWJ_CLOCK 10000000 ///< Default SWD/JTAG clock frequency in Hz. |
| 102 | + |
| 103 | +/// Maximum Package Size for Command and Response data. |
| 104 | +/// This configuration settings is used to optimized the communication performance with the |
| 105 | +/// debugger and depends on the USB peripheral. Change setting to 1024 for High-Speed USB. |
| 106 | +#define DAP_PACKET_SIZE 64 ///< USB: 64 = Full-Speed, 1024 = High-Speed. |
| 107 | + |
| 108 | +/// Maximum Package Buffers for Command and Response data. |
| 109 | +/// This configuration settings is used to optimized the communication performance with the |
| 110 | +/// debugger and depends on the USB peripheral. For devices with limited RAM or USB buffer the |
| 111 | +/// setting can be reduced (valid range is 1 .. 255). Change setting to 4 for High-Speed USB. |
| 112 | +#define DAP_PACKET_COUNT 12 ///< Buffers: 64 = Full-Speed, 4 = High-Speed. |
| 113 | + |
| 114 | +#define DAP_PACKET_QUEUE_SIZE (DAP_PACKET_COUNT+8) |
| 115 | + |
| 116 | +/// Debug Unit is connected to fixed Target Device. |
| 117 | +/// The Debug Unit may be part of an evaluation board and always connected to a fixed |
| 118 | +/// known device. In this case a Device Vendor and Device Name string is stored which |
| 119 | +/// may be used by the debugger or IDE to configure device parameters. |
| 120 | +#define TARGET_DEVICE_FIXED 0 ///< Target Device: 1 = known, 0 = unknown; |
| 121 | + |
| 122 | +#if TARGET_DEVICE_FIXED |
| 123 | +#define TARGET_DEVICE_VENDOR "" ///< String indicating the Silicon Vendor |
| 124 | +#define TARGET_DEVICE_NAME "" ///< String indicating the Target Device |
| 125 | +#endif |
| 126 | + |
| 127 | +///@} |
| 128 | + |
| 129 | +#define SWCLK_GPIO_PORT GPIOA |
| 130 | +#define SWCLK_GPIO_PIN GPIO1 |
| 131 | +#define SWDIO_GPIO_PORT GPIOA |
| 132 | +#define SWDIO_GPIO_PIN GPIO0 |
| 133 | +#define nRESET_GPIO_PORT GPIOA |
| 134 | +#define nRESET_GPIO_PIN GPIO4 |
| 135 | + |
| 136 | +#define LED_CON_GPIO_PORT GPIOA |
| 137 | +#define LED_CON_GPIO_PIN GPIO5 |
| 138 | +#define LED_RUN_GPIO_PORT GPIOA |
| 139 | +#define LED_RUN_GPIO_PIN GPIO6 |
| 140 | +#define LED_ACT_GPIO_PORT GPIOA |
| 141 | +#define LED_ACT_GPIO_PIN GPIO7 |
| 142 | + |
| 143 | +#define SWDIO_GPIO_PIN_NUM 0 |
| 144 | + |
| 145 | +#endif |
0 commit comments