Revision d54d2f07 Target/Modules/PowerManagement_1-1/Boot/blt_conf.h
Target/Modules/PowerManagement_1-1/Boot/blt_conf.h | ||
---|---|---|
23 | 23 |
* You should have received a copy of the GNU General Public License along with OpenBLT. |
24 | 24 |
* If not, see <http://www.gnu.org/licenses/>. |
25 | 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
|
|
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 | 28 |
* proprietary components. The exception text is included at the bottom of the license |
29 | 29 |
* file <license.html>. |
30 |
*
|
|
30 |
* |
|
31 | 31 |
* \endinternal |
32 | 32 |
****************************************************************************************/ |
33 | 33 |
#ifndef BLT_CONF_H |
... | ... | |
37 | 37 |
* C P U D R I V E R C O N F I G U R A T I O N |
38 | 38 |
****************************************************************************************/ |
39 | 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
|
|
40 |
* the speed of the crystal oscillator and/or the speed at which the system runs is |
|
41 | 41 |
* needed. Set these through configurables BOOT_CPU_XTAL_SPEED_KHZ and |
42 | 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
|
|
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 | 45 |
* big endian mode. |
46 |
*
|
|
46 |
* |
|
47 | 47 |
* Set BOOT_CPU_USER_PROGRAM_START_HOOK to 1 if you would like a hook function to be |
48 | 48 |
* called the moment the user program is about to be started. This could be used to |
49 | 49 |
* de-initialize application specific parts, for example to stop blinking an LED, etc. |
50 |
*/
|
|
50 |
*/ |
|
51 | 51 |
/** \brief Frequency of the external crystal oscillator. */ |
52 | 52 |
#define BOOT_CPU_XTAL_SPEED_KHZ (8000) |
53 | 53 |
/** \brief Desired system speed. */ |
... | ... | |
66 | 66 |
* have to be controlled by this bootloader. Additionally the bootloader should be able |
67 | 67 |
* to send program code of user programs for other devices. |
68 | 68 |
* Make sure that one of the communication interfaces is the gateway! |
69 |
*/
|
|
69 |
*/ |
|
70 | 70 |
/** \brief Bootloader of main device. */ |
71 | 71 |
#define BOOTLOADER_OF_MAIN_DEVICE (1) |
72 | 72 |
|
... | ... | |
74 | 74 |
/**************************************************************************************** |
75 | 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 | 76 |
****************************************************************************************/ |
77 |
/* The CAN communication interface is selected by setting the BOOT_COM_CAN_ENABLE
|
|
77 |
/* The CAN communication interface is selected by setting the BOOT_COM_CAN_ENABLE |
|
78 | 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
|
|
79 |
* in bits/second. Two CAN messages are reserved for communication with the host. The |
|
80 | 80 |
* message identifier for sending data from the target to the host is configured with |
81 | 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
|
|
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 | 84 |
* BOOT_COM_CAN_RX_MAX_DATA, respectively. It is common for a microcontroller to have more |
85 | 85 |
* than 1 CAN controller on board. The zero-based BOOT_COM_CAN_CHANNEL_INDEX selects the |
86 | 86 |
* CAN controller channel. |
87 |
*
|
|
87 |
* |
|
88 | 88 |
*/ |
89 | 89 |
/** \brief Enable/disable CAN transport layer. */ |
90 | 90 |
#define BOOT_GATE_CAN_ENABLE (1) |
91 | 91 |
/** \brief Configure the desired CAN baudrate. */ |
92 |
#define BOOT_COM_CAN_BAUDRATE (500000)
|
|
92 |
#define BOOT_COM_CAN_BAUDRATE (1000000)
|
|
93 | 93 |
/** \brief Configure CAN message ID target->host. */ |
94 | 94 |
#define BOOT_COM_CAN_TX_MSG_ID (0x700) |
95 | 95 |
/** \brief Configure number of bytes in the target->host CAN message. */ |
... | ... | |
100 | 100 |
#define BOOT_COM_CAN_RX_MAX_DATA (255) |
101 | 101 |
/** \brief Select the desired CAN peripheral as a zero based index. */ |
102 | 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 (0x01010101) |
|
116 |
/** \brief Configure legacy device ID. */ |
|
117 |
#define BOOT_COM_DEVICE_LEGACY_ID (0x2) |
|
103 | 118 |
|
104 |
/** \brief Configure device ID for communication (start with 1). */ |
|
105 |
#define BOOT_COM_DEVICE_ID (0x2) |
|
106 | 119 |
|
107 |
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
|
|
120 |
/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE |
|
108 | 121 |
* configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed |
109 |
* in bits/second. The maximum amount of data bytes in a message for data transmission
|
|
110 |
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA,
|
|
122 |
* in bits/second. The maximum amount of data bytes in a message for data transmission |
|
123 |
* and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA, |
|
111 | 124 |
* respectively. It is common for a microcontroller to have more than 1 UART interface |
112 | 125 |
* on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface. |
113 |
*
|
|
126 |
* |
|
114 | 127 |
*/ |
115 | 128 |
/** \brief Enable/disable UART transport layer. */ |
116 | 129 |
#define BOOT_COM_UART_ENABLE (1) |
... | ... | |
129 | 142 |
|
130 | 143 |
|
131 | 144 |
/* The NET communication interface for firmware updates via TCP/IP is selected by setting |
132 |
* the BOOT_COM_NET_ENABLE configurable to 1. The maximum amount of data bytes in a
|
|
133 |
* message for data transmission and reception is set through BOOT_COM_NET_TX_MAX_DATA
|
|
134 |
* and BOOT_COM_NET_RX_MAX_DATA, respectively. The default IP address is configured
|
|
145 |
* the BOOT_COM_NET_ENABLE configurable to 1. The maximum amount of data bytes in a |
|
146 |
* message for data transmission and reception is set through BOOT_COM_NET_TX_MAX_DATA |
|
147 |
* and BOOT_COM_NET_RX_MAX_DATA, respectively. The default IP address is configured |
|
135 | 148 |
* with the macros BOOT_COM_NET_IPADDRx. The default netmask is configued with the macros |
136 | 149 |
* BOOT_COM_NET_NETMASKx. The default gateway is configured with the macros |
137 | 150 |
* BOOT_COM_NET_GATEWAYx. The bootloader acts and a TCP/IP server. The port the server |
... | ... | |
177 | 190 |
* to be set. This allows a dynamic override of the BOOT_COM_NET_NETMASKx values. |
178 | 191 |
*/ |
179 | 192 |
#define BOOT_COM_NET_NETMASK_HOOK_ENABLE (0) |
180 |
/** \brief Enable/disable a hook function that is called when the gateway address is
|
|
181 |
* about to be set. This allows a dynamic override of the BOOT_COM_NET_GATEWAYx
|
|
193 |
/** \brief Enable/disable a hook function that is called when the gateway address is |
|
194 |
* about to be set. This allows a dynamic override of the BOOT_COM_NET_GATEWAYx |
|
182 | 195 |
* values. |
183 | 196 |
*/ |
184 | 197 |
#define BOOT_COM_NET_GATEWAY_HOOK_ENABLE (0) |
... | ... | |
190 | 203 |
#if (BOOT_COM_NET_ENABLE > 0) |
191 | 204 |
/* Override the default time that the backdoor is open if firmware updates via TCP/IP |
192 | 205 |
* are supported. in this case a reactivation of the bootloader results in a re- |
193 |
* initialization of the ethernet MAC. when directly connected to the ethernet port of
|
|
194 |
* a PC this will go relatively fast (depending on what MS Windows is being used), but
|
|
206 |
* initialization of the ethernet MAC. when directly connected to the ethernet port of |
|
207 |
* a PC this will go relatively fast (depending on what MS Windows is being used), but |
|
195 | 208 |
* when connected to the network via a router this can take several seconds. feel free to |
196 |
* shorten/lengthen this time for finetuning. the only downside of a long backdoor open
|
|
209 |
* shorten/lengthen this time for finetuning. the only downside of a long backdoor open |
|
197 | 210 |
* time is that the starting of the user program will also be delayed for this time. |
198 | 211 |
* |
199 |
* Also note that when the target is directly connected to the ethernet port of a PC,
|
|
200 |
* the checkbox "Automatically retry socket connection" should be checked in the
|
|
212 |
* Also note that when the target is directly connected to the ethernet port of a PC, |
|
213 |
* the checkbox "Automatically retry socket connection" should be checked in the |
|
201 | 214 |
* Microboot settings. if connecting via a router the uncheck this checkbox. |
202 | 215 |
*/ |
203 | 216 |
#define BACKDOOR_ENTRY_TIMEOUT_MS (10000) |
... | ... | |
208 | 221 |
* 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 |
209 | 222 |
****************************************************************************************/ |
210 | 223 |
/* The file system interface is selected by setting the BOOT_FILE_SYS_ENABLE configurable |
211 |
* to 1. This enables support for firmware updates from a file stored on a locally
|
|
212 |
* attached file system such as an SD-card. Note that this interface can be enabled
|
|
224 |
* to 1. This enables support for firmware updates from a file stored on a locally |
|
225 |
* attached file system such as an SD-card. Note that this interface can be enabled |
|
213 | 226 |
* together with one of the remote communication interfaces such as UART, CAN or USB. |
214 | 227 |
* |
215 | 228 |
* Set BOOT_FILE_LOGGING_ENABLE to 1 if you would like log messages to be created during |
... | ... | |
223 | 236 |
* additional information on the error cause. |
224 | 237 |
* |
225 | 238 |
* Set BOOT_FILE_STARTED_HOOK_ENABLE to 1 if you would like to be informed when a new |
226 |
* firmware update is started by the bootloader.
|
|
239 |
* firmware update is started by the bootloader. |
|
227 | 240 |
* |
228 | 241 |
* Set BOOT_FILE_COMPLETED_HOOK_ENABLE to 1 if you would like to be informed when a |
229 |
* firmware update is completed by the bootloader.
|
|
242 |
* firmware update is completed by the bootloader. |
|
230 | 243 |
*/ |
231 | 244 |
/** \brief Enable/disable support for firmware updates from a locally attached storage.*/ |
232 | 245 |
#define BOOT_FILE_SYS_ENABLE (0) |
233 | 246 |
/** \brief Enable/disable logging messages during firmware updates. */ |
234 | 247 |
#define BOOT_FILE_LOGGING_ENABLE (1) |
235 | 248 |
/** \brief Enable/disable a hook function that is called upon detection of an error. */ |
236 |
#define BOOT_FILE_ERROR_HOOK_ENABLE (1)
|
|
249 |
#define BOOT_FILE_ERROR_HOOK_ENABLE (1) |
|
237 | 250 |
/** \brief Enable/disable a hook function that is called at the start of the update. */ |
238 |
#define BOOT_FILE_STARTED_HOOK_ENABLE (1)
|
|
251 |
#define BOOT_FILE_STARTED_HOOK_ENABLE (1) |
|
239 | 252 |
/** \brief Enable/disable a hook function that is called at the end of the update. */ |
240 |
#define BOOT_FILE_COMPLETED_HOOK_ENABLE (1) |
|
253 |
#define BOOT_FILE_COMPLETED_HOOK_ENABLE (1) |
|
254 |
|
|
241 | 255 |
|
242 |
|
|
243 | 256 |
/**************************************************************************************** |
244 | 257 |
* 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 |
245 | 258 |
****************************************************************************************/ |
246 | 259 |
/* It is possible to implement an application specific method to force the bootloader to |
247 | 260 |
* stay active after a reset. Such a backdoor entry into the bootloader is desired in |
248 |
* situations where the user program does not run properly and therefore cannot
|
|
261 |
* situations where the user program does not run properly and therefore cannot |
|
249 | 262 |
* reactivate the bootloader. By enabling these hook functions, the application can |
250 | 263 |
* implement the backdoor, which overrides the default backdoor entry that is programmed |
251 | 264 |
* into the bootloader. When desired for security purposes, these hook functions can |
... | ... | |
291 | 304 |
* 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 |
292 | 305 |
****************************************************************************************/ |
293 | 306 |
/* A security mechanism can be enabled in the bootloader's XCP module by setting configu- |
294 |
* rable BOOT_XCP_SEED_KEY_ENABLE to 1. Before any memory erase or programming
|
|
295 |
* operations can be performed, access to this resource need to be unlocked.
|
|
296 |
* In the Microboot settings on tab "XCP Protection" you need to specify a DLL that
|
|
297 |
* implements the unlocking algorithm. The demo programs are configured for the (simple)
|
|
298 |
* algorithm in "FeaserKey.dll". The source code for this DLL is available so it can be
|
|
299 |
* customized to your needs.
|
|
307 |
* rable BOOT_XCP_SEED_KEY_ENABLE to 1. Before any memory erase or programming |
|
308 |
* operations can be performed, access to this resource need to be unlocked. |
|
309 |
* In the Microboot settings on tab "XCP Protection" you need to specify a DLL that |
|
310 |
* implements the unlocking algorithm. The demo programs are configured for the (simple) |
|
311 |
* algorithm in "FeaserKey.dll". The source code for this DLL is available so it can be |
|
312 |
* customized to your needs. |
|
300 | 313 |
* During the unlock sequence, Microboot requests a seed from the bootloader, which is in |
301 |
* the format of a byte array. Using this seed the unlock algorithm in the DLL computes
|
|
302 |
* a key, which is also a byte array, and sends this back to the bootloader. The
|
|
314 |
* the format of a byte array. Using this seed the unlock algorithm in the DLL computes |
|
315 |
* a key, which is also a byte array, and sends this back to the bootloader. The |
|
303 | 316 |
* bootloader then verifies this key to determine if programming and erase operations are |
304 | 317 |
* permitted. |
305 | 318 |
* After enabling this feature the hook functions XcpGetSeedHook() and XcpVerifyKeyHook() |
Also available in: Unified diff