amiro-blt / Target / Modules / PowerManagement_1-2 / Boot / blt_conf.h @ a270d48f
History | View | Annotate | Download (18.532 KB)
1 | a270d48f | Thomas Schöpping | /************************************************************************************//** |
---|---|---|---|
2 | * \file Demo\ARMCM4_STM32_Olimex_STM32E407_GCC\Boot\blt_conf.h
|
||
3 | * \brief Bootloader configuration header file.
|
||
4 | * \ingroup Boot_ARMCM4_STM32_Olimex_STM32E407_GCC
|
||
5 | * \internal
|
||
6 | *----------------------------------------------------------------------------------------
|
||
7 | * C O P Y R I G H T
|
||
8 | *----------------------------------------------------------------------------------------
|
||
9 | * Copyright (c) 2013 by Feaser http://www.feaser.com All rights reserved
|
||
10 | *
|
||
11 | *----------------------------------------------------------------------------------------
|
||
12 | * L I C E N S E
|
||
13 | *----------------------------------------------------------------------------------------
|
||
14 | * This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
|
||
15 | * modify it under the terms of the GNU General Public License as published by the Free
|
||
16 | * Software Foundation, either version 3 of the License, or (at your option) any later
|
||
17 | * version.
|
||
18 | *
|
||
19 | * OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||
20 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||
21 | * PURPOSE. See the GNU General Public License for more details.
|
||
22 | *
|
||
23 | * You should have received a copy of the GNU General Public License along with OpenBLT.
|
||
24 | * If not, see <http://www.gnu.org/licenses/>.
|
||
25 | *
|
||
26 | * A special exception to the GPL is included to allow you to distribute a combined work
|
||
27 | * that includes OpenBLT without being obliged to provide the source code for any
|
||
28 | * proprietary components. The exception text is included at the bottom of the license
|
||
29 | * file <license.html>.
|
||
30 | *
|
||
31 | * \endinternal
|
||
32 | ****************************************************************************************/
|
||
33 | #ifndef BLT_CONF_H
|
||
34 | #define BLT_CONF_H
|
||
35 | |||
36 | /****************************************************************************************
|
||
37 | * C P U D R I V E R C O N F I G U R A T I O N
|
||
38 | ****************************************************************************************/
|
||
39 | /* To properly initialize the baudrate clocks of the communication interface, typically
|
||
40 | * the speed of the crystal oscillator and/or the speed at which the system runs is
|
||
41 | * needed. Set these through configurables BOOT_CPU_XTAL_SPEED_KHZ and
|
||
42 | * BOOT_CPU_SYSTEM_SPEED_KHZ, respectively. To enable data exchange with the host that is
|
||
43 | * not dependent on the targets architecture, the byte ordering needs to be known.
|
||
44 | * Setting BOOT_CPU_BYTE_ORDER_MOTOROLA to 1 selects little endian mode and 0 selects
|
||
45 | * big endian mode.
|
||
46 | *
|
||
47 | * Set BOOT_CPU_USER_PROGRAM_START_HOOK to 1 if you would like a hook function to be
|
||
48 | * called the moment the user program is about to be started. This could be used to
|
||
49 | * de-initialize application specific parts, for example to stop blinking an LED, etc.
|
||
50 | */
|
||
51 | /** \brief Frequency of the external crystal oscillator. */
|
||
52 | #define BOOT_CPU_XTAL_SPEED_KHZ (8000) |
||
53 | /** \brief Desired system speed. */
|
||
54 | #define BOOT_CPU_SYSTEM_SPEED_KHZ (168000) |
||
55 | /** \brief Motorola or Intel style byte ordering. */
|
||
56 | #define BOOT_CPU_BYTE_ORDER_MOTOROLA (0) |
||
57 | /** \brief Enable/disable hook function call right before user program start. */
|
||
58 | #define BOOT_CPU_USER_PROGRAM_START_HOOK (1) |
||
59 | |||
60 | |||
61 | /****************************************************************************************
|
||
62 | * B O O T L O A D E R O F M A I N D E V I C E
|
||
63 | ****************************************************************************************/
|
||
64 | /* It is important to initialize if the bootloader is part of the main device. In this
|
||
65 | * case some backdoor loops have to stay opened and backdoor loops of other bootloaders
|
||
66 | * have to be controlled by this bootloader. Additionally the bootloader should be able
|
||
67 | * to send program code of user programs for other devices.
|
||
68 | * Make sure that one of the communication interfaces is the gateway!
|
||
69 | */
|
||
70 | /** \brief Bootloader of main device. */
|
||
71 | #define BOOTLOADER_OF_MAIN_DEVICE (1) |
||
72 | |||
73 | |||
74 | /****************************************************************************************
|
||
75 | * C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N
|
||
76 | ****************************************************************************************/
|
||
77 | /* The CAN communication interface is selected by setting the BOOT_COM_CAN_ENABLE
|
||
78 | * configurable to 1. Configurable BOOT_COM_CAN_BAUDRATE selects the communication speed
|
||
79 | * in bits/second. Two CAN messages are reserved for communication with the host. The
|
||
80 | * message identifier for sending data from the target to the host is configured with
|
||
81 | * BOOT_COM_CAN_TXMSG_ID. The one for receiving data from the host is configured with
|
||
82 | * BOOT_COM_CAN_RXMSG_ID. The maximum amount of data bytes in a message for data
|
||
83 | * transmission and reception is set through BOOT_COM_CAN_TX_MAX_DATA and
|
||
84 | * BOOT_COM_CAN_RX_MAX_DATA, respectively. It is common for a microcontroller to have more
|
||
85 | * than 1 CAN controller on board. The zero-based BOOT_COM_CAN_CHANNEL_INDEX selects the
|
||
86 | * CAN controller channel.
|
||
87 | *
|
||
88 | */
|
||
89 | /** \brief Enable/disable CAN transport layer. */
|
||
90 | #define BOOT_GATE_CAN_ENABLE (1) |
||
91 | /** \brief Configure the desired CAN baudrate. */
|
||
92 | #define BOOT_COM_CAN_BAUDRATE (1000000) |
||
93 | /** \brief Configure CAN message ID target->host. */
|
||
94 | #define BOOT_COM_CAN_TX_MSG_ID (0x700) |
||
95 | /** \brief Configure number of bytes in the target->host CAN message. */
|
||
96 | #define BOOT_COM_CAN_TX_MAX_DATA (255) |
||
97 | /** \brief Configure CAN message ID host->target. */
|
||
98 | #define BOOT_COM_CAN_RX_MSG_ID (0x600) |
||
99 | /** \brief Configure number of bytes in the host->target CAN message. */
|
||
100 | #define BOOT_COM_CAN_RX_MAX_DATA (255) |
||
101 | /** \brief Select the desired CAN peripheral as a zero based index. */
|
||
102 | #define BOOT_COM_CAN_CHANNEL_INDEX (0) |
||
103 | /** \brief Configure CAN message acknowledgement ID addition (ORed with original ID). */
|
||
104 | #define BOOT_COM_CAN_MSG_ACK (0x001) |
||
105 | /** \brief Configure CAN message ID addition for continuous messages (ORed with original ID). */
|
||
106 | #define BOOT_COM_CAN_MSG_SUBSEQUENT (0x002) |
||
107 | |||
108 | /**
|
||
109 | * \brief Configure device ID for communication (start with 1).
|
||
110 | * \details The device ID is a 32 bit integer, which can be interpreted bytewise:
|
||
111 | * <AMiRo_revision>:<moduleID>:<moduleVersion_major>:<moduleVersion_minor>
|
||
112 | * For this module the according values are
|
||
113 | * 1:1:1:1 = 0x01010101
|
||
114 | */
|
||
115 | #define BOOT_COM_DEVICE_ID (0x01010102) |
||
116 | |||
117 | |||
118 | /* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
|
||
119 | * configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
|
||
120 | * in bits/second. The maximum amount of data bytes in a message for data transmission
|
||
121 | * and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
|
||
122 | * respectively. It is common for a microcontroller to have more than 1 UART interface
|
||
123 | * on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface.
|
||
124 | *
|
||
125 | */
|
||
126 | /** \brief Enable/disable UART transport layer. */
|
||
127 | #define BOOT_COM_UART_ENABLE (1) |
||
128 | /** \brief Enable/disable BLUETOOTH UART transport layer. */
|
||
129 | #define BOOT_COM_BLUETOOTH_UART_ENABLE (0) |
||
130 | /** \brief Configure the desired communication speed. */
|
||
131 | #define BOOT_COM_UART_BAUDRATE (115200) |
||
132 | /** \brief Configure number of bytes in the target->host data packet. */
|
||
133 | #define BOOT_COM_UART_TX_MAX_DATA (255) |
||
134 | /** \brief Configure number of bytes in the host->target data packet. */
|
||
135 | #define BOOT_COM_UART_RX_MAX_DATA (255) |
||
136 | /** \brief Select the desired UART peripheral as a zero based index. */
|
||
137 | #define BOOT_COM_UART_CHANNEL_INDEX (0) |
||
138 | /** \brief Select the desired BLUETOOTH UART peripheral as a zero based index. */
|
||
139 | #define BOOT_COM_BLUETOOTH_UART_CHANNEL_INDEX (2) |
||
140 | |||
141 | |||
142 | /* The NET communication interface for firmware updates via TCP/IP is selected by setting
|
||
143 | * the BOOT_COM_NET_ENABLE configurable to 1. The maximum amount of data bytes in a
|
||
144 | * message for data transmission and reception is set through BOOT_COM_NET_TX_MAX_DATA
|
||
145 | * and BOOT_COM_NET_RX_MAX_DATA, respectively. The default IP address is configured
|
||
146 | * with the macros BOOT_COM_NET_IPADDRx. The default netmask is configued with the macros
|
||
147 | * BOOT_COM_NET_NETMASKx. The default gateway is configured with the macros
|
||
148 | * BOOT_COM_NET_GATEWAYx. The bootloader acts and a TCP/IP server. The port the server
|
||
149 | * listen on for connections is configured with BOOT_COM_NET_PORT.
|
||
150 | */
|
||
151 | /** \brief Enable/disable the NET transport layer. */
|
||
152 | #define BOOT_COM_NET_ENABLE (0) |
||
153 | /** \brief Configure number of bytes in the target->host data packet. */
|
||
154 | #define BOOT_COM_NET_TX_MAX_DATA (64) |
||
155 | /** \brief Configure number of bytes in the host->target data packet. */
|
||
156 | #define BOOT_COM_NET_RX_MAX_DATA (64) |
||
157 | /** \brief Configure the port that the TCP/IP server listens on */
|
||
158 | #define BOOT_COM_NET_PORT (1000) |
||
159 | /** \brief Configure the 1st byte of the IP address */
|
||
160 | #define BOOT_COM_NET_IPADDR0 (169) |
||
161 | /** \brief Configure the 2nd byte of the IP address */
|
||
162 | #define BOOT_COM_NET_IPADDR1 (254) |
||
163 | /** \brief Configure the 3rd byte of the IP address */
|
||
164 | #define BOOT_COM_NET_IPADDR2 (19) |
||
165 | /** \brief Configure the 4th byte of the IP address */
|
||
166 | #define BOOT_COM_NET_IPADDR3 (63) |
||
167 | /** \brief Configure the 1st byte of the network mask */
|
||
168 | #define BOOT_COM_NET_NETMASK0 (255) |
||
169 | /** \brief Configure the 2nd byte of the network mask */
|
||
170 | #define BOOT_COM_NET_NETMASK1 (255) |
||
171 | /** \brief Configure the 3rd byte of the network mask */
|
||
172 | #define BOOT_COM_NET_NETMASK2 (0) |
||
173 | /** \brief Configure the 4th byte of the network mask */
|
||
174 | #define BOOT_COM_NET_NETMASK3 (0) |
||
175 | /** \brief Configure the 1st byte of the gateway address */
|
||
176 | #define BOOT_COM_NET_GATEWAY0 (169) |
||
177 | /** \brief Configure the 2nd byte of the gateway address */
|
||
178 | #define BOOT_COM_NET_GATEWAY1 (254) |
||
179 | /** \brief Configure the 3rd byte of the gateway address */
|
||
180 | #define BOOT_COM_NET_GATEWAY2 (19) |
||
181 | /** \brief Configure the 4th byte of the gateway address */
|
||
182 | #define BOOT_COM_NET_GATEWAY3 (1) |
||
183 | /** \brief Enable/disable a hook function that is called when the IP address is about
|
||
184 | * to be set. This allows a dynamic override of the BOOT_COM_NET_IPADDRx values.
|
||
185 | */
|
||
186 | #define BOOT_COM_NET_IPADDR_HOOK_ENABLE (0) |
||
187 | /** \brief Enable/disable a hook function that is called when the netmask is about
|
||
188 | * to be set. This allows a dynamic override of the BOOT_COM_NET_NETMASKx values.
|
||
189 | */
|
||
190 | #define BOOT_COM_NET_NETMASK_HOOK_ENABLE (0) |
||
191 | /** \brief Enable/disable a hook function that is called when the gateway address is
|
||
192 | * about to be set. This allows a dynamic override of the BOOT_COM_NET_GATEWAYx
|
||
193 | * values.
|
||
194 | */
|
||
195 | #define BOOT_COM_NET_GATEWAY_HOOK_ENABLE (0) |
||
196 | |||
197 | |||
198 | /****************************************************************************************
|
||
199 | * B A C K D O O R C O N F I G U R A T I O N
|
||
200 | ****************************************************************************************/
|
||
201 | #if (BOOT_COM_NET_ENABLE > 0) |
||
202 | /* Override the default time that the backdoor is open if firmware updates via TCP/IP
|
||
203 | * are supported. in this case a reactivation of the bootloader results in a re-
|
||
204 | * initialization of the ethernet MAC. when directly connected to the ethernet port of
|
||
205 | * a PC this will go relatively fast (depending on what MS Windows is being used), but
|
||
206 | * when connected to the network via a router this can take several seconds. feel free to
|
||
207 | * shorten/lengthen this time for finetuning. the only downside of a long backdoor open
|
||
208 | * time is that the starting of the user program will also be delayed for this time.
|
||
209 | *
|
||
210 | * Also note that when the target is directly connected to the ethernet port of a PC,
|
||
211 | * the checkbox "Automatically retry socket connection" should be checked in the
|
||
212 | * Microboot settings. if connecting via a router the uncheck this checkbox.
|
||
213 | */
|
||
214 | #define BACKDOOR_ENTRY_TIMEOUT_MS (10000) |
||
215 | #endif
|
||
216 | |||
217 | |||
218 | /****************************************************************************************
|
||
219 | * F I L E S Y S T E M I N T E R F A C E C O N F I G U R A T I O N
|
||
220 | ****************************************************************************************/
|
||
221 | /* The file system interface is selected by setting the BOOT_FILE_SYS_ENABLE configurable
|
||
222 | * to 1. This enables support for firmware updates from a file stored on a locally
|
||
223 | * attached file system such as an SD-card. Note that this interface can be enabled
|
||
224 | * together with one of the remote communication interfaces such as UART, CAN or USB.
|
||
225 | *
|
||
226 | * Set BOOT_FILE_LOGGING_ENABLE to 1 if you would like log messages to be created during
|
||
227 | * a firmware update. The hook function FileFirmwareUpdateLogHook() will be called each
|
||
228 | * time a new string formatted log entry is available. This could be used during testing
|
||
229 | * by outputting the string on UART or to create a log file on the file system itself.
|
||
230 | *
|
||
231 | * Set BOOT_FILE_ERROR_HOOK_ENABLE to 1 if you would like to be informed in case an error
|
||
232 | * occurs during the firmware update. This could for example be used to turn on an error
|
||
233 | * LED to inform the user that something went wrong. Inspecting the log messages provides
|
||
234 | * additional information on the error cause.
|
||
235 | *
|
||
236 | * Set BOOT_FILE_STARTED_HOOK_ENABLE to 1 if you would like to be informed when a new
|
||
237 | * firmware update is started by the bootloader.
|
||
238 | *
|
||
239 | * Set BOOT_FILE_COMPLETED_HOOK_ENABLE to 1 if you would like to be informed when a
|
||
240 | * firmware update is completed by the bootloader.
|
||
241 | */
|
||
242 | /** \brief Enable/disable support for firmware updates from a locally attached storage.*/
|
||
243 | #define BOOT_FILE_SYS_ENABLE (0) |
||
244 | /** \brief Enable/disable logging messages during firmware updates. */
|
||
245 | #define BOOT_FILE_LOGGING_ENABLE (1) |
||
246 | /** \brief Enable/disable a hook function that is called upon detection of an error. */
|
||
247 | #define BOOT_FILE_ERROR_HOOK_ENABLE (1) |
||
248 | /** \brief Enable/disable a hook function that is called at the start of the update. */
|
||
249 | #define BOOT_FILE_STARTED_HOOK_ENABLE (1) |
||
250 | /** \brief Enable/disable a hook function that is called at the end of the update. */
|
||
251 | #define BOOT_FILE_COMPLETED_HOOK_ENABLE (1) |
||
252 | |||
253 | |||
254 | /****************************************************************************************
|
||
255 | * B A C K D O O R E N T R Y C O N F I G U R A T I O N
|
||
256 | ****************************************************************************************/
|
||
257 | /* It is possible to implement an application specific method to force the bootloader to
|
||
258 | * stay active after a reset. Such a backdoor entry into the bootloader is desired in
|
||
259 | * situations where the user program does not run properly and therefore cannot
|
||
260 | * reactivate the bootloader. By enabling these hook functions, the application can
|
||
261 | * implement the backdoor, which overrides the default backdoor entry that is programmed
|
||
262 | * into the bootloader. When desired for security purposes, these hook functions can
|
||
263 | * also be implemented in a way that disables the backdoor entry altogether.
|
||
264 | */
|
||
265 | /** \brief Enable/disable the backdoor override hook functions. */
|
||
266 | #define BOOT_BACKDOOR_HOOKS_ENABLE (1) |
||
267 | |||
268 | |||
269 | /****************************************************************************************
|
||
270 | * N O N - V O L A T I L E M E M O R Y D R I V E R C O N F I G U R A T I O N
|
||
271 | ****************************************************************************************/
|
||
272 | /* The NVM driver typically supports erase and program operations of the internal memory
|
||
273 | * present on the microcontroller. Through these hook functions the NVM driver can be
|
||
274 | * extended to support additional memory types such as external flash memory and serial
|
||
275 | * eeproms. The size of the internal memory in kilobytes is specified with configurable
|
||
276 | * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can
|
||
277 | * be overridden with a application specific method by enabling configuration switch
|
||
278 | * BOOT_NVM_CHECKSUM_HOOKS_ENABLE.
|
||
279 | */
|
||
280 | /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */
|
||
281 | #define BOOT_NVM_HOOKS_ENABLE (0) |
||
282 | /** \brief Configure the size of the default memory device (typically flash EEPROM). */
|
||
283 | #define BOOT_NVM_SIZE_KB (1024) |
||
284 | /** \brief Enable/disable hooks functions to override the user program checksum handling. */
|
||
285 | #define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) |
||
286 | |||
287 | |||
288 | /****************************************************************************************
|
||
289 | * W A T C H D O G D R I V E R C O N F I G U R A T I O N
|
||
290 | ****************************************************************************************/
|
||
291 | /* The COP driver cannot be configured internally in the bootloader, because its use
|
||
292 | * and configuration is application specific. The bootloader does need to service the
|
||
293 | * watchdog in case it is used. When the application requires the use of a watchdog,
|
||
294 | * set BOOT_COP_HOOKS_ENABLE to be able to initialize and service the watchdog through
|
||
295 | * hook functions.
|
||
296 | */
|
||
297 | /** \brief Enable/disable the hook functions for controlling the watchdog. */
|
||
298 | #define BOOT_COP_HOOKS_ENABLE (0) |
||
299 | |||
300 | |||
301 | /****************************************************************************************
|
||
302 | * S E E D / K E Y S E C U R I T Y C O N F I G U R A T I O N
|
||
303 | ****************************************************************************************/
|
||
304 | /* A security mechanism can be enabled in the bootloader's XCP module by setting configu-
|
||
305 | * rable BOOT_XCP_SEED_KEY_ENABLE to 1. Before any memory erase or programming
|
||
306 | * operations can be performed, access to this resource need to be unlocked.
|
||
307 | * In the Microboot settings on tab "XCP Protection" you need to specify a DLL that
|
||
308 | * implements the unlocking algorithm. The demo programs are configured for the (simple)
|
||
309 | * algorithm in "FeaserKey.dll". The source code for this DLL is available so it can be
|
||
310 | * customized to your needs.
|
||
311 | * During the unlock sequence, Microboot requests a seed from the bootloader, which is in
|
||
312 | * the format of a byte array. Using this seed the unlock algorithm in the DLL computes
|
||
313 | * a key, which is also a byte array, and sends this back to the bootloader. The
|
||
314 | * bootloader then verifies this key to determine if programming and erase operations are
|
||
315 | * permitted.
|
||
316 | * After enabling this feature the hook functions XcpGetSeedHook() and XcpVerifyKeyHook()
|
||
317 | * are called by the bootloader to obtain the seed and to verify the key, respectively.
|
||
318 | */
|
||
319 | #define BOOT_XCP_SEED_KEY_ENABLE (0) |
||
320 | |||
321 | |||
322 | #endif /* BLT_CONF_H */ |
||
323 | /*********************************** end of blt_conf.h *********************************/
|