BootloaderConfigText.h
/*
* Copyright (c) 2013-15, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. 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.
*/
#pragma once
char code_section1[] =
"/*\n\
* Copyright (c) 2013 - 15, Freescale Semiconductor, Inc.\n\
* All rights reserved\n\
*\n\
* Redistribution and use in source and binary forms, with or without modification,\n\
*are permitted provided that the following conditions are met :\n\
*\n\
* o Redistributions of source code must retain the above copyright notice, this list\n\
* of conditions and the following disclaimer.\n\
*\n\
* o Redistributions in binary form must reproduce the above copyright notice, this\n\
* list of conditions and the following disclaimer in the documentation and / or\n\
* other materials provided with the distribution.\n\
*\n\
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its\n\
* contributors may be used to endorse or promote products derived from this\n\
* software without specific prior written permission.\n\
*\n\
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n\
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n\
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\
* DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\n\
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n\
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\
*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n\
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n\
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\
*/\n\
\n\\n\
\n\
#include <stdint.h>\n\
\n\\n\
typedef struct BootloaderConfiguration\n\
{\n\
uint32_t tag; //!< [00:03] Magic number to verify bootloader configuration is\n\
uint32_t crcStartAddress; //!< [04:07] Start address for application image CRC\n\
uint32_t crcByteCount; //!< [08:0b] Byte count for application image CRC\n\
uint32_t crcExpectedValue; //!< [0c:0f] Expected CRC value for application CRC\n\
uint8_t enabledPeripherals; //!< [10:10] Bitfield of peripherals to enable.\n\
uint8_t i2cSlaveAddress; //!< [11:11] If not 0xFF, used as the 7-bit I2C slave\n\
uint16_t peripheralDetectionTimeoutMs; //!< [12:13] Timeout in milliseconds\n\
uint16_t usbVid; //!< [14:15] Sets the USB Vendor ID reported by the device\n\
uint16_t usbPid; //!< [16:17] Sets the USB Product ID reported by the device\n\
uint32_t usbStringsPointer; //!< [18:1b] Sets the USB Strings reported by the\n\
uint8_t clockFlags; //!< [1c:1c] The flags in the clockFlags configuration\n\
uint8_t clockDivider; //!< [1d:1d] Inverted value of the divider to use for\n\
uint8_t bootFlags; //!< [1e:1e] If bit 0 is cleared, then Kinetis bootloader\n\
uint8_t pad0; //!< [1f:1f] Reserved, set to 0xFF\n\
uint32_t mmcauConfigPointer; //!< [20:23] A pointer to the MMCAU configuration\n\
uint32_t keyBlobPointer; //!< [24:27]Holds a pointer value to the key blob\n\
uint8_t pad1; //!< [28:28] reserved\n\
uint8_t canConfig1; //!< [29:29] ClkSel[1], PropSeg[3], SpeedIndex[4]\n\
uint16_t canConfig2; //!< [2a:2b] Pdiv[8], Pseg1[3], Pseg2[3], rjw[2]\n\
uint16_t canTxId; //!< [2c:2d] txId\n\
uint16_t canRxId; //!< [2e:2f] rxId\n\
uint32_t qspi_config_block_pointer; //!< [30:33] A pointer to the QSPI config\n\
uint32_t reserved[3]; //!<[34:3f] reserved\n\
} bootloader_config_t;\n\
\n\
/*\n\
* Warning: To enable bootloader configuration, User still needs two extra steps :\n\
*\n\
* Step1 : Enable BOOTLOADER_CONFIG.\n\
* Example : #define BOOTLOADER_CONFIG 1\n\
*\n\
* Step2 : Add configuration of the section \"BootloaderConfig\" to your\n\
* linker configuration file.\n\
* Example(IAR) :\n\
* define symbol __application_startaddress = 0; // User-defined\n\
* define symbol m_bootloader_config_start = __application_startaddress + 0x3C0;\n\
* define symbol m_bootloader_config_end = __application_startaddress + 0x3FF;\n\
* define region m_bootloader_config_region = mem:[from m_bootloader_config_start to m_bootloader_config_end];\n\
* place in m_bootloader_config_region{ section BootloaderConfig };\n\
*\n\
* Example(Keil) :\n\
* #define __application_startaddress = 0 // User-defined\n\
* #define m_bootloader_config_start __application_startaddress + 0x3C0\n\
* #define m_bootloader_config_size 0x00000040\n\
*\n\
* LR_m_bootloader_config m_bootloader_config_start m_bootloader_config_size{\n\
* ER_m_bootloader_config m_bootloader_config_start m_bootloader_config_size{ ; load address = execution address\n\
* * (BootloaderConfig)\n\
* }\n\
* }\n\
*\n\
* Example(ARM - GCC) :\n\
* MEMORY\n\
* {\n\
* m_bootloader_config(RX) : ORIGIN = 0x000003C0, LENGTH = 0x00000040\n\
* }\n\
* .bootloader_config :\n\
* {\n\
* . = ALIGN(4);\n\
* KEEP(*(.BootloaderConfig)) // Bootloader Configuration Area (BCA)\n\
* . = ALIGN(4);\n\
* } > m_bootloader_config\n\
*\n\
*/\n\
\n\
#ifdef BOOTLOADER_CONFIG\n\
/* Bootlader configuration area */\n\
#if defined(__IAR_SYSTEMS_ICC__)\n\
/* Pragma to place the Bootloader Configuration Array on correct location\n\
* defined in linker file. */\n\
#pragma language = extended\n\
#pragma location = \"BootloaderConfig\"\n\
__root const bootloader_config_t BootloaderConfig @\"BootloaderConfig\" =\n\
#elif defined(__GNUC__)\n\
__attribute__((section(\".BootloaderConfig\"))) const bootloader_config_t BootloaderConfig =\n\
#elif defined(__CC_ARM)\n\
__attribute__((section(\"BootloaderConfig\"))) const bootloader_config_t BootloaderConfig __attribute__((used)) =\n\
#else\n\
#error Unsupported compiler!\n\
#endif\n\
{";
char code_section2[] =
"\n };\n\
#endif";