Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
BootloaderConfigText.h
1 /*
2 * Copyright (c) 2013-15, Freescale Semiconductor, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * o Redistributions of source code must retain the above copyright notice, this list
9 * of conditions and the following disclaimer.
10 *
11 * o Redistributions in binary form must reproduce the above copyright notice, this
12 * list of conditions and the following disclaimer in the documentation and/or
13 * other materials provided with the distribution.
14 *
15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 
31 #pragma once
32 
33 char code_section1[] =
34  "/*\n\
35 * Copyright (c) 2013 - 15, Freescale Semiconductor, Inc.\n\
36 * All rights reserved\n\
37 *\n\
38 * Redistribution and use in source and binary forms, with or without modification,\n\
39 *are permitted provided that the following conditions are met :\n\
40 *\n\
41 * o Redistributions of source code must retain the above copyright notice, this list\n\
42 * of conditions and the following disclaimer.\n\
43 *\n\
44 * o Redistributions in binary form must reproduce the above copyright notice, this\n\
45 * list of conditions and the following disclaimer in the documentation and / or\n\
46 * other materials provided with the distribution.\n\
47 *\n\
48 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its\n\
49 * contributors may be used to endorse or promote products derived from this\n\
50 * software without specific prior written permission.\n\
51 *\n\
52 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n\
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n\
54 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\
55 * DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\n\
56 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n\
57 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\
58 *LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n\
59 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\
60 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n\
61 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\
62 */\n\
63 \n\\n\
71 \n\
72 #include <stdint.h>\n\
73 \n\\n\
83 typedef struct BootloaderConfiguration\n\
84 {\n\
85  uint32_t tag; //!< [00:03] Magic number to verify bootloader configuration is\n\
87  uint32_t crcStartAddress; //!< [04:07] Start address for application image CRC\n\
91  uint32_t crcByteCount; //!< [08:0b] Byte count for application image CRC\n\
94  uint32_t crcExpectedValue; //!< [0c:0f] Expected CRC value for application CRC\n\
98  uint8_t enabledPeripherals; //!< [10:10] Bitfield of peripherals to enable.\n\
103  uint8_t i2cSlaveAddress; //!< [11:11] If not 0xFF, used as the 7-bit I2C slave\n\
106  uint16_t peripheralDetectionTimeoutMs; //!< [12:13] Timeout in milliseconds\n\
109  uint16_t usbVid; //!< [14:15] Sets the USB Vendor ID reported by the device\n\
111  uint16_t usbPid; //!< [16:17] Sets the USB Product ID reported by the device\n\
113  uint32_t usbStringsPointer; //!< [18:1b] Sets the USB Strings reported by the\n\
115  uint8_t clockFlags; //!< [1c:1c] The flags in the clockFlags configuration\n\
118  uint8_t clockDivider; //!< [1d:1d] Inverted value of the divider to use for\n\
120  uint8_t bootFlags; //!< [1e:1e] If bit 0 is cleared, then Kinetis bootloader\n\
125  uint8_t pad0; //!< [1f:1f] Reserved, set to 0xFF\n\
126  uint32_t mmcauConfigPointer; //!< [20:23] A pointer to the MMCAU configuration\n\
128  uint32_t keyBlobPointer; //!< [24:27]Holds a pointer value to the key blob\n\
130  uint8_t pad1; //!< [28:28] reserved\n\
131  uint8_t canConfig1; //!< [29:29] ClkSel[1], PropSeg[3], SpeedIndex[4]\n\
132  uint16_t canConfig2; //!< [2a:2b] Pdiv[8], Pseg1[3], Pseg2[3], rjw[2]\n\
133  uint16_t canTxId; //!< [2c:2d] txId\n\
134  uint16_t canRxId; //!< [2e:2f] rxId\n\
135  uint32_t qspi_config_block_pointer; //!< [30:33] A pointer to the QSPI config\n\
137  uint32_t reserved[3]; //!<[34:3f] reserved\n\
138 } bootloader_config_t;\n\
139 \n\
140 /*\n\
141 * Warning: To enable bootloader configuration, User still needs two extra steps :\n\
142 *\n\
143 * Step1 : Enable BOOTLOADER_CONFIG.\n\
144 * Example : #define BOOTLOADER_CONFIG 1\n\
145 *\n\
146 * Step2 : Add configuration of the section \"BootloaderConfig\" to your\n\
147 * linker configuration file.\n\
148 * Example(IAR) :\n\
149 * define symbol __application_startaddress = 0; // User-defined\n\
150 * define symbol m_bootloader_config_start = __application_startaddress + 0x3C0;\n\
151 * define symbol m_bootloader_config_end = __application_startaddress + 0x3FF;\n\
152 * define region m_bootloader_config_region = mem:[from m_bootloader_config_start to m_bootloader_config_end];\n\
153 * place in m_bootloader_config_region{ section BootloaderConfig };\n\
154 *\n\
155 * Example(Keil) :\n\
156 * #define __application_startaddress = 0 // User-defined\n\
157 * #define m_bootloader_config_start __application_startaddress + 0x3C0\n\
158 * #define m_bootloader_config_size 0x00000040\n\
159 *\n\
160 * LR_m_bootloader_config m_bootloader_config_start m_bootloader_config_size{\n\
161 * ER_m_bootloader_config m_bootloader_config_start m_bootloader_config_size{ ; load address = execution address\n\
162 * * (BootloaderConfig)\n\
163 * }\n\
164 * }\n\
165 *\n\
166 * Example(ARM - GCC) :\n\
167 * MEMORY\n\
168 * {\n\
169 * m_bootloader_config(RX) : ORIGIN = 0x000003C0, LENGTH = 0x00000040\n\
170 * }\n\
171 * .bootloader_config :\n\
172 * {\n\
173 * . = ALIGN(4);\n\
174 * KEEP(*(.BootloaderConfig)) // Bootloader Configuration Area (BCA)\n\
175 * . = ALIGN(4);\n\
176 * } > m_bootloader_config\n\
177 *\n\
178 */\n\
179 \n\
180 #ifdef BOOTLOADER_CONFIG\n\
181 /* Bootlader configuration area */\n\
182 #if defined(__IAR_SYSTEMS_ICC__)\n\
183 /* Pragma to place the Bootloader Configuration Array on correct location\n\
184 * defined in linker file. */\n\
185 #pragma language = extended\n\
186 #pragma location = \"BootloaderConfig\"\n\
187 __root const bootloader_config_t BootloaderConfig @\"BootloaderConfig\" =\n\
188 #elif defined(__GNUC__)\n\
189 __attribute__((section(\".BootloaderConfig\"))) const bootloader_config_t BootloaderConfig =\n\
190 #elif defined(__CC_ARM)\n\
191 __attribute__((section(\"BootloaderConfig\"))) const bootloader_config_t BootloaderConfig __attribute__((used)) =\n\
192 #else\n\
193 #error Unsupported compiler!\n\
194 #endif\n\
195  {";
196 
197 char code_section2[] =
198  "\n };\n\
199 #endif";