var myVariable = `
{
  
  "0": {
    "title": "License",
    "content": "IMPORTANT: READ CAREFULLY . MICROCHIP IS WILLING TO LICENSE THIS INTEGRATED SOFTWARE FRAMEWORK SOFTWARE AND ACCOMPANYING DOCUMENTATION OFFERED TO YOU ONLY ON THE CONDITION THAT YOU ACCEPT ALL OF THE FOLLOWING TERMS. TO ACCEPT THE TERMS OF THIS LICENSE, CLICK “I ACCEPT” AND PROCEED WITH THE DOWNLOAD OR INSTALL. IF YOU DO NOT ACCEPT THESE LICENSE TERMS, CLICK “I DO NOT ACCEPT,” AND DO NOT DOWNLOAD OR INSTALL THIS SOFTWARE. . NON-EXCLUSIVE SOFTWARE LICENSE AGREEMENT FOR MICROCHIP MPLAB HARMONY INTEGRATED SOFTWARE FRAMEWORK . This Nonexclusive Software License Agreement (“Agreement”) is between you, your heirs, agents, successors and assigns (“Licensee”) and Microchip Technology Incorporated, a Delaware corporation, with a principal place of business at 2355 W. Chandler Blvd., Chandler, AZ 85224-6199, and its subsidiary, Microchip Technology (Barbados) II Incorporated (collectively, “Microchip”) for Microchip’s MPLAB Harmony Integrated Software Framework (“Software”) and accompanying documentation (“Documentation”). The Software and Documentation are licensed under this Agreement and not sold. U.S. copyright laws and international copyright treaties, and other intellectual property laws and treaties protect the Software and Documentation. Microchip reserves all rights not expressly granted to Licensee in this Agreement. . License and Sublicense Grant. . (a) Definitions. As used this Agreement, the following terms shall have the meanings defined below: . (i) &quot;Licensee Products&quot; means Licensee products that use or incorporate Microchip Products. (ii) &quot;Microchip Product&quot; means Microchip 16-bit and 32-bit microcontrollers, digital signal controllers or other Microchip semiconductor products with PIC16 and PIC18 prefix and specifically excepting the CX870 and CY920, which are not covered under this Agreement, that use or implement the Software. (iii) &quot;Object Code&quot; means the Software computer programming code provided by Microchip that is in binary form (including related documentation, if any) and error corrections, improvements and updates to such code provided by Microchip in its sole discretion, if any. (iv) &quot;Source Code&quot; means the Software computer programming code provided by Microchip that may be printed out or displayed in human readable form (including related programmer comments and documentation, if any), and error corrections, improvements, updates, modifications and derivatives of such code developed by Microchip, Licensee or Third Party. (v) &quot;Third Party&quot; means Licensee&#39;s agents, representatives, consultants, clients, customers, or contract manufacturers. (vi) &quot;Third Party Products&quot; means Third Party products that use or incorporate Microchip Products. . (b) Software License Grant. Subject to the terms of this Agreement, Microchip grants strictly to Licensee a personal, worldwide, non-exclusive, non-transferable limited license to use, modify (except as limited by Section 1(f) below), copy and distribute the Software only when the Software is embedded on a Microchip Product that is integrated into Licensee Product or Third Party Product pursuant to Section 2(d) below. . Any portion of the Software (including derivatives or modifications thereof) may not be: . (i) embedded on a non-Microchip microcontroller or digital signal controller; (ii) distributed (in Source Code or Object Code), except as described in Section 2(d) below. . (c) Documentation License Grant. Subject to all of the terms and conditions of this Agreement, Microchip grants strictly to Licensee a perpetual, worldwide, non-exclusive license to use the Documentation in support of Licensee’s use of the Software. . (d) Sublicense Grants. Subject to terms of this Agreement, Licensee may grant a limited sublicense to a Third Party to use the Software as described below only if such Third Party expressly agrees to be bound by terms of confidentiality and limited use that are no broader in scope and duration than the confidentiality and limited use terms of this Agreement: . (i) Third Party may modify Source Code for Licensee, except as limited by Section 1(f) below. (ii) Third Party may program Software into Microchip Products for Licensee. (iii) Third Party may use Software to develop and/or manufacture Licensee Product. (iv) Third Party may use Software to develop and/or manufacture Third Party Products where either: (x) the sublicensed Software contains Source Code modified or otherwise optimized by Licensee for Third Party use; or (y) the sublicensed Software is programmed into Microchip Products by Licensee on behalf of such Third Party. (v) Third Party may use the Documentation in support of Third Party&#39;s authorized use of the Software in conformance with this Section 2(d). . (e) Audit. Authorized representatives of Microchip shall have the right to reasonably inspect Licensee’s premises and to audit Licensee’s records and inventory of Licensee Products, whether located on Licensee’s premises or elsewhere at any time, announced or unannounced, and in its sole and absolute discretion, in order to ensure Licensee’s adherence to the terms of this Agreement. . (f) License and Sublicense Limitation. This Section 1 does not grant Licensee or any Third Party the right to modify any dotstack™ Bluetooth® stack, profile, or iAP protocol included in the Software. . | Third Party Requirements. Licensee acknowledges that it is Licensee’s responsibility to comply with any third party license terms or requirements applicable to the use of such third party software, specifications, systems, or tools, including but not limited to SEGGER Microcontroller GmbH &amp; Co. KG’s rights in the emWin software and certain libraries included herein. Microchip is not responsible and will not be held responsible in any manner for Licensee’s failure to comply with such applicable terms or requirements. . | Open Source Components. Notwithstanding the license grants contained herein, Licensee acknowledges that certain components of the Software may be covered by so-called “open source” software licenses (“Open Source Components”). Open Source Components means any software licenses approved as open source licenses by the Open Source Initiative or any substantially similar licenses, including any license that, as a condition of distribution, requires Microchip to provide Licensee with certain notices and/or information related to such Open Source Components, or requires that the distributor make the software available in source code format. Microchip will use commercially reasonable efforts to identify such Open Source Components in a text file or “About Box” or in a file or files referenced thereby (and will include any associated license agreement, notices, and other related information therein), or the Open Source Components will contain or be accompanied by its own license agreement. To the extent required by the licenses covering Open Source Components, the terms of such licenses will apply in lieu of the terms of this Agreement, and Microchip hereby represents and warrants that the licenses granted to such Open Source Components will be no less broad than the license granted in Section 1(b). To the extent the terms of the licenses applicable to Open Source Components prohibit any of the restrictions in this Agreement with respect to such Open Source Components, such restrictions will not apply to such Open Source Components. . | Licensee’s Obligations. . (a) Licensee will ensure Third Party compliance with the terms of this Agreement. . (b) Licensee will not: (i) engage in unauthorized use, modification, disclosure or distribution of Software or Documentation, or its derivatives; (ii) use all or any portion of the Software, Documentation, or its derivatives except in conjunction with Microchip Products; or (iii) reverse engineer (by disassembly, decompilation or otherwise) Software or any portion thereof; or (iv) copy or reproduce all or any portion of Software, except as specifically allowed by this Agreement or expressly permitted by applicable law notwithstanding the foregoing limitations. . (c) Licensee must include Microchip’s copyright, trademark and other proprietary notices in all copies of the Software, Documentation, and its derivatives. Licensee may not remove or alter any Microchip copyright or other proprietary rights notice posted in any portion of the Software or Documentation. . (d) Licensee will defend, indemnify and hold Microchip and its subsidiaries harmless from and against any and all claims, costs, damages, expenses (including reasonable attorney’s fees), liabilities, and losses, including without limitation product liability claims, directly or indirectly arising from or related to: (i) the use, modification, disclosure or distribution of the Software, Documentation or any intellectual property rights related thereto; (ii) the use, sale, and distribution of Licensee Products or Third Party Products, and (iii) breach of this Agreement. THE FOREGOING STATES THE SOLE AND EXCLUSIVE LIABILITY OF THE PARTIES FOR INTELLECTUAL PROPERTY RIGHTS INFRINGEMENT. . | Confidentiality. . (a) Licensee agrees that the Software (including but not limited to the Source Code, Object Code and library files) and its derivatives, Documentation and underlying inventions, algorithms, know-how and ideas relating to the Software and the Documentation are proprietary information belonging to Microchip and its licensors (“Proprietary Information”). Except as expressly and unambiguously allowed herein, Licensee will hold in confidence and not use or disclose any Proprietary Information and shall similarly bind its employees and Third Party(ies) in writing. Proprietary Information shall not include information that: (i) is in or enters the public domain without breach of this Agreement and through no fault of the receiving party; (ii) the receiving party was legally in possession of prior to receiving it; (iii) the receiving party can demonstrate was developed by it independently and without use of or reference to the disclosing party’s Proprietary Information; or (iv) the receiving party receives from a third party without restriction on disclosure. If Licensee is required to disclose Proprietary Information by law, court order, or government agency, such disclosure shall not be deemed a breach of this Agreement provided that Licensee gives Microchip prompt notice of such requirement in order to allow Microchip to object or limit such disclosure, Licensee cooperates with Microchip to protect Proprietary Information, and Licensee complies with any protective order in place and discloses only the information required by process of law. . (b) Licensee agrees that the provisions of this Agreement regarding unauthorized use and nondisclosure of the Software, Documentation and related Proprietary Rights are necessary to protect the legitimate business interests of Microchip and its licensors and that monetary damages alone cannot adequately compensate Microchip or its licensors if such provisions are violated. Licensee, therefore, agrees that if Microchip alleges that Licensee or Third Party has breached or violated such provision then Microchip will have the right to petition for injunctive relief, without the requirement for the posting of a bond, in addition to all other remedies at law or in equity. . | Ownership of Proprietary Rights. . (a) Microchip and its licensors retain all right, title and interest in and to the Software and Documentation (“Proprietary Rights”) including, but not limited to: (i) patent, copyright, trade secret and other intellectual property rights in the Software, Documentation, and underlying technology; (ii) the Software as implemented in any device or system, all hardware and software implementations of the Software technology (expressly excluding Licensee and Third Party code developed and used in conformance with this Agreement solely to interface with the Software and Licensee Products and/or Third Party Products); and (iii) all modifications and derivative works thereof (by whomever produced). Further, modifications and derivative works shall be considered works made for hire with ownership vesting in Microchip on creation. To the extent such modifications and derivatives do not qualify as a “work for hire,” Licensee hereby irrevocably transfers, assigns and conveys the exclusive copyright thereof to Microchip, free and clear of any and all liens, claims or other encumbrances, to the fullest extent permitted by law. Licensee and Third Party use of such modifications and derivatives is limited to the license rights described in Section 1 above. . (b) Licensee shall have no right to sell, assign or otherwise transfer all or any portion of the Software, Documentation or any related intellectual property rights except as expressly set forth in this Agreement. . | Termination of Agreement. Without prejudice to any other rights, this Agreement terminates immediately, without notice by Microchip, upon a failure by License or Third Party to comply with any provision of this Agreement. Further, Microchip may also terminate this Agreement upon reasonable belief that Licensee or Third Party have failed to comply with this Agreement. Upon termination, Licensee and Third Party will immediately stop using the Software, Documentation, and derivatives thereof, and immediately destroy all such copies, remove Software from any of Licensee’s tangible media and from systems on which the Software exists, and stop using, disclosing, copying, or reproducing Software (even as may be permitted by this Agreement). Termination of this Agreement will not affect the right of any end user or consumer to use Licensee Products or Third Party Products provided that such products were purchased prior to the termination of this Agreement. . | Dangerous Applications. The Software is not fault-tolerant and is not designed, manufactured, or intended for use in hazardous environments requiring failsafe performance (“Dangerous Applications”). Dangerous Applications include the operation of nuclear facilities, aircraft navigation, aircraft communication systems, air traffic control, direct life support machines, weapons systems, or any environment or system in which the failure of the Software could lead directly or indirectly to death, personal injury, or severe physical or environmental damage. Microchip specifically disclaims (a) any express or implied warranty of fitness for use of the Software in Dangerous Applications; and (b) any and all liability for loss, damages and claims resulting from the use of the Software in Dangerous Applications. . | Warranties and Disclaimers. THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. MICROCHIP AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR THE ACCURACY, RELIABILITY OR APPLICATION OF THE SOFTWARE OR DOCUMENTATION. MICROCHIP AND ITS LICENSORS DO NOT WARRANT THAT THE SOFTWARE WILL MEET REQUIREMENTS OF LICENSEE OR THIRD PARTY, BE UNINTERRUPTED OR ERROR-FREE. MICROCHIP AND ITS LICENSORS HAVE NO OBLIGATION TO CORRECT ANY DEFECTS IN THE SOFTWARE. LICENSEE AND THIRD PARTY ASSUME THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE AND DOCUMENTATION PROVIDED UNDER THIS AGREEMENT. . | Limited Liability. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL OR EQUITABLE THEORY FOR ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. The aggregate and cumulative liability of Microchip and its licensors for damages hereunder will in no event exceed $1000 or the amount Licensee paid Microchip for the Software and Documentation, whichever is greater. Licensee acknowledges that the foregoing limitations are reasonable and an essential part of this Agreement. . | General. . (a) Governing Law, Venue and Waiver of Trial by Jury. THIS AGREEMENT SHALL BE GOVERNED BY AND CONSTRUED UNDER THE LAWS OF THE STATE OF ARIZONA AND THE UNITED STATES WITHOUT REGARD TO CONFLICTS OF LAWS PROVISIONS. Licensee agrees that any disputes arising out of or related to this Agreement, Software or Documentation shall be brought in the courts of State of Arizona. The parties agree to waive their rights to a jury trial in actions relating to this Agreement. . (b) Attorneys’ Fees. If either Microchip or Licensee employs attorneys to enforce any rights arising out of or relating to this Agreement, the prevailing party shall be entitled to recover its reasonable attorneys’ fees, costs and other expenses. . (c) Entire Agreement. This Agreement shall constitute the entire agreement between the parties with respect to the subject matter hereof. It shall not be modified except by a written agreement signed by an authorized representative of Microchip. . (d) Severability. If any provision of this Agreement shall be held by a court of competent jurisdiction to be illegal, invalid or unenforceable, that provision shall be limited or eliminated to the minimum extent necessary so that this Agreement shall otherwise remain in full force and effect and enforceable. . (e) Waiver. No waiver of any breach of any provision of this Agreement shall constitute a waiver of any prior, concurrent or subsequent breach of the same or any other provisions hereof, and no waiver shall be effective unless made in writing and signed by an authorized representative of the waiving party. . (f) Export Regulation. Licensee agrees to comply with all export laws and restrictions and regulations of the Department of Commerce or other United States or foreign agency or authority. . (g) Survival. The indemnities, obligations of confidentiality, and limitations on liability described herein, and any right of action for breach of this Agreement prior to termination shall survive any termination of this Agreement. . (h) Assignment. Neither this Agreement nor any rights, licenses or obligations hereunder, may be assigned by Licensee without the prior written approval of Microchip except pursuant to a merger, sale of all assets of Licensee or other corporate reorganization, provided that assignee agrees in writing to be bound by the Agreement. . (i) Restricted Rights. Use, duplication or disclosure by the United States Government is subject to restrictions set forth in subparagraphs (a) through (d) of the Commercial Computer-Restricted Rights clause of FAR 52.227-19 when applicable, or in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013, and in similar clauses in the NASA FAR Supplement. Contractor/manufacturer is Microchip Technology Inc., 2355 W. Chandler Blvd., Chandler, AZ 85225-6199. . | If Licensee has any questions about this Agreement, please write to Microchip Technology Inc., 2355 W. Chandler Blvd., Chandler, AZ 85224-6199 USA, ATTN: Marketing. . Microchip MPLAB Harmony Integrated Software Framework. Copyright © 2015 Microchip Technology Inc. All rights reserved. . License Rev. 11/2015 . Copyright © 2015 Qualcomm Atheros, Inc. All Rights Reserved. . Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. . THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .",
    "url": "http://localhost:4000/bootloader_apps_sdcard/mplab_harmony_license.html",
    "relUrl": "/mplab_harmony_license.html"
  }
  ,"1": {
    "title": "SDCARD Bootloader",
    "content": ". To clone or download these application from Github,go to the main page of this repository and then click Clone button to clone this repo or download as zip file. This content can also be download using content manager by following these instructions . SDCARD Bootloader . This example application shows how to use the Bootloader Library to bootload an application using SDCARD protocol. . Bootloader Application . This is a bootloader application which resides from The starting location of the flash memory region for SAM devices | The starting location of the Boot flash memory region for PIC32MZ devices | The starting location of Program Flash memory for PIC32MK and PIC32MX devices | . | It uses the Harmony 3 File System Framework to receive the application binary from a sdcard | It calls the bootloader_Tasks() function which receives application to be programmed into flash memory from a sdcard | It glows an LED once bootloader firmware is running | Trigger Methods It uses the On board Switch as bootloader trigger pin to force enter the bootloader at reset of device | It checks for bootloader request pattern (0x5048434D) from the starting 16 Bytes of RAM to force enter bootloader at reset of device | . | . Test Application . This is a test application which resides from The end of bootloader size in device flash memory for SAM devices | The end of bootloader size in Program Flash memory for PIC32MK and PIC32MX devices | The start of Program Flash memory for PIC32MZ devices | . | It will be loaded into flash memory by bootloader application | It blinks an LED and provides console output | It uses the On board Switch to trigger the bootloader from firmware Once the switch is pressed it loads first 16 bytes of RAM with bootloader request pattern (0x5048434D) and resets the device | . | . Development Kits . The following table provides links to documentation on how to build and run SDCARD bootloader on different development kits . Development Kit . PIC32MZ Embedded Graphics with Stacked DRAM (DA) Starter Kit (Crypto) | . SAM E54 Xplained Pro Evaluation Kit | . SAM E70 Xplained Ultra Evaluation Kit | . SAM L22 Xplained Pro Evaluation Kit | .",
    "url": "http://localhost:4000/bootloader_apps_sdcard/apps/sdcard_bootloader/readme.html",
    "relUrl": "/apps/sdcard_bootloader/readme.html"
  }
  ,"2": {
    "title": "Application Configurations",
    "content": ". Configuring an Application to be bootloaded . To bootload a SAM based application refer to SAM Application Configuration . | To bootload a PIC32M based application refer to PIC32M Application Configuration . | .",
    "url": "http://localhost:4000/bootloader_apps_sdcard/apps/docs/readme_configure_application.html",
    "relUrl": "/apps/docs/readme_configure_application.html"
  }
  ,"3": {
    "title": "PIC32M Application Configurations",
    "content": ". Configuring a PIC32M based Application to be bootloaded . For PIC32M devices custom linker script has to be created and added to application project. | All the Application code including the reset handler and IVT’s has to be placed in Program flash memory as bootloader is residing in boot flash memory | Below mentioned configuration may vary from device to device and based on the application being configured | . Setting Up the Application linker script . For Quck start, Refer to pre developed application linker scripts placed in bootloader_apps_sdcard/apps/sdcard_bootloader/test_app/firmware/src/&lt;config&gt;/app_XX.ld . | The vector address of a given interrupt is calculated using Exception Base (EBASE) CPU register, which provides a 4 KB page-aligned base address value located in the kernel segment (kseg) address space. | The MIPS32 core requires that Interrupt Vector Tables (IVTs) be placed on a 4 KB boundary | The address is calculated by using EBASE and VS values. The VS bits provide the vector spacing between adjacent vector addresses | Each vector in the table is created as an output section located at an absolute address based on values of the _ebase_address and _vector_spacing symbols | . For PIC32MZ Device . Reset Address for the application to be loaded through bootloader should match the Application start address mention in bootloader project. | For devices with larger boot flash memory where the bootloader resides completely in boot flash memory the application start address by default will be start of program flash memory 0x9D000000 | The Initial 4KB are used by Reset Handler and cache_init section | Below are few configurations to be taken care in the linker script | . PROVIDE(_vector_spacing = 0x0001); PROVIDE(_ebase_address = 0x9D001000); _RESET_ADDR = 0x9D000000; kseg0_program_mem (rx) : ORIGIN = 0x9D001000, LENGTH = 0x200000 - 0x1000 kseg1_boot_mem : ORIGIN = 0x9D000000, LENGTH = 0x480 kseg1_boot_mem_4B0 : ORIGIN = 0x9D0004B0, LENGTH = 0x1000 - 0x4B0 /* Boot Sections */ .reset _RESET_ADDR : { KEEP(*(.reset)) KEEP(*(.reset.startup)) } &gt; kseg1_boot_mem .cache_init : { *(.cache_init) *(.cache_init.*) } &gt; kseg1_boot_mem_4B0 ... /* Interrupt vector table with vector offsets */ .vectors _ebase_address + 0x200 : { /* Symbol __vector_offset_n points to .vector_n if it exists, * otherwise points to the default handler. The * vector_offset_init.o module then provides a .data section * containing values used to initialize the vector-offset SFRs * in the crt0 startup code. */ . = ALIGN(4) ; __vector_offset_0 = (DEFINED(__vector_dispatch_0) ? (. - _ebase_address) : __vector_offset_default); KEEP(*(.vector_0)) ... ... /* Default interrupt handler */ . = ALIGN(4) ; __vector_offset_default = . - _ebase_address; KEEP(*(.vector_default)) } &gt; kseg0_program_mem . For PIC32MX Devices . The bootloader code resides in from start of Program flash memory, hence the application start address has to be after the end of bootloader. | Change _ebase_address to the new boundary, plus enough pages to get the exceptions to start at an address on a 4K (0x1000) boundary. This is to align it on the boundary required by the MIPS core. | Below are few configurations to be taken care in the linker script | . PROVIDE(_vector_spacing = 0x0001); PROVIDE(_ebase_address = 0x9D00E000); _RESET_ADDR = 0x9D000000 + 0xD000; /* Size of Bootloader is 0xD000 */ kseg0_program_mem (rx) : 0x9D00E000, LENGTH = 0x80000 - 0x490 - 0x1000 - 0xD000 /* Size of Bootloader is 0xD000 */ kseg1_boot_mem : ORIGIN = 0x9D00D000, LENGTH = 0x490 /* Boot Sections */ .reset _RESET_ADDR : { KEEP(*(.reset)) KEEP(*(.reset.startup)) } &gt; kseg1_boot_mem ... .vector_0 _ebase_address + 0x200 + ((_vector_spacing &lt;&lt; 5) * 0) : { KEEP(*(.vector_0)) } &gt; kseg0_program_mem ASSERT (_vector_spacing == 0 || SIZEOF(.vector_0) &lt;= (_vector_spacing &lt;&lt; 5), &quot;function at exception vector 0 too large&quot;) .vector_1 _ebase_address + 0x200 + ((_vector_spacing &lt;&lt; 5) * 1) : { KEEP(*(.vector_1)) } &gt; kseg0_program_mem ASSERT (_vector_spacing == 0 || SIZEOF(.vector_1) &lt;= (_vector_spacing &lt;&lt; 5), &quot;function at exception vector 1 too large&quot;) ... ... . Note . As the Device configuration bits should be updated by bootloader only, the application linker script should not have any device configuration settings | Device configurations need to discarded from final hex file for the application project. | . /DISCARD/ : { *(.config_*) } . MPLAB X Settings . Specifying post build option to automatically generate the binary file from hex file once the build is complete . \${MP_CC_DIR}/xc32-objcopy -I ihex -O binary \${DISTDIR}/\${PROJECTNAME}.\${IMAGE_TYPE}.hex \${DISTDIR}/\${PROJECTNAME}.\${IMAGE_TYPE}.bin . . | .",
    "url": "http://localhost:4000/bootloader_apps_sdcard/apps/docs/readme_configure_application_pic32m.html",
    "relUrl": "/apps/docs/readme_configure_application_pic32m.html"
  }
  ,"4": {
    "title": "SAM Application Configurations",
    "content": ". Configuring a SAM based Application to be bootloaded . Application Settings in MHC System Configuration . Launch MHC for the application project to be configured | Select system component from the project graph and configure the below highlighted settings . . | Disable Fuse Settings: Fuse settings needs to be disabled for the application which will be boot-loaded as the fuse settings are supposed to be programmed through programming tool from bootloader code | Also the fuse settings are not programmable through firmware | Enabling the fuse settings also increases the size of the binary when generated through the hex file | . | Specify the Application Start Address: Specify the Start address from where the application will run under the Application Start Address (Hex) option in System block in MHC. | This value should be equal to or greater than the bootloader size and must be aligned to the erase unit size on that device. | As this value will be used by bootloader to Jump to application at device reset it should match the value provided to bootloader code | The Application Start Address (Hex) will be used to generate XC32 compiler settings to place the code at intended address | After the project is regenerated, the ROM_ORIGIN and ROM_LENGTH are the XC32 linker variables which will be overridden with value provided for Application Start Address (Hex) and can be verified under Options for xc32-ld in Project Properties in MPLABX IDE as shown below. | . . | MPLAB X Settings . Specifying post build option to automatically generate the binary file from hex file once the build is complete . \${MP_CC_DIR}/xc32-objcopy -I ihex -O binary \${DISTDIR}/\${PROJECTNAME}.\${IMAGE_TYPE}.hex \${DISTDIR}/\${PROJECTNAME}.\${IMAGE_TYPE}.bin . . | . Additional settings (Optional) . RAM_ORIGIN and RAM_LENGTH values should be provided for reserving configured bytes of start of RAM to trigger bootloader from firmware | Under Project Properties, expand options for xc32-ld and define the values for RAM_ORIGIN and RAM_LENGTH under Additional options | This is optional and can be ignored if not required . . | .",
    "url": "http://localhost:4000/bootloader_apps_sdcard/apps/docs/readme_configure_application_sam.html",
    "relUrl": "/apps/docs/readme_configure_application_sam.html"
  }
  ,"5": {
    "title": "Building and Running on PIC32MZ Embedded Graphics with Stacked DRAM (DA) Starter Kit (Crypto)",
    "content": ". Building and Running the SDCARD Bootloader applications . Downloading and building the application . To clone or download this application from Github,go to the main page of this repository and then click Clone button to clone this repo or download as zip file. This content can also be download using content manager by following these instructions . Path of the application within the repository is apps/sdcard_bootloader/ . To build the application, refer to the following table and open the project using its IDE. . Bootloader Application . Project Name Description . bootloader/firmware/pic32mz_das_sk.X | MPLABX Project for PIC32MZ Embedded Graphics with Stacked DRAM (DA) Starter Kit (Crypto) | . Test Application . Project Name Description . test_app/firmware/pic32mz_das_sk.X | MPLABX Project for PIC32MZ Embedded Graphics with Stacked DRAM (DA) Starter Kit (Crypto) | . Setting up PIC32MZ Embedded Graphics with Stacked DRAM (DA) Starter Kit (Crypto) . Connect a micro USB cable to the UART-USB port J5 | For programming, connect a micro USB cable to the USB Debug port J19 | Use the micro sdcard slot J10 of the device to insert a micro sdcard | . Running the Application . Open the test application project test_app/firmware/pic32mz_das_sk.X in the IDE | Build the project to generate the binary (Do not program the binary) | Open the bootloader project bootloader/firmware/pic32mz_das_sk.X in the IDE | Build and program the application using the IDE . | LED1 will be Turned On once programming is completed and bootloader starts running . | Open the Terminal application (Ex.:Tera Term) on the computer to get test application messages through UART once bootloaded | Configure the serial port settings as follows: Baud : 115200 | Data : 8 Bits | Parity : None | Stop : 1 Bit | Flow Control : None | . | Copy the generated application binary file to a micro sdcard from the Host PC &lt;harmony3_path&gt; bootloader_apps_sdcard apps sdcard_bootloader test_app firmware pic32mz_das_sk.X dist pic32mz_das_sk production pic32mz_das_sk.X.production.bin | . | Rename the copied application binary file to image.bin . | Insert the micro sdcard with the application binary image.bin to the micro sdcard slot on the device . | Once the application is successfully programmed LED3 should start blinking and you should see below output on the console . . | Remove the micro sdcard from the sdcard slot . | Press and hold the Switch SW1 to trigger Bootloader from test application and you should see below output . . | Repeat Steps 10-12 once and jump to Step-15 This step is to verify that bootloader is running after triggering bootloader from test application in Step 13 | . | Press and hold the Switch SW1 and then press Reset button or Power cycle the device to force trigger bootloader at startup | Repeat Steps 10-12 once This step is to verify whether bootloader is triggered by switch press at reset | . | Additional Steps (Optional) . To bootload any other application refer to Application Configurations . | Once done repeat the applicable steps mentioned in Running The Application . | .",
    "url": "http://localhost:4000/bootloader_apps_sdcard/apps/sdcard_bootloader/docs/readme_pic32mz_das_sk.html",
    "relUrl": "/apps/sdcard_bootloader/docs/readme_pic32mz_das_sk.html"
  }
  ,"6": {
    "title": "Building and Running on SAM E54 Xplained Pro Evaluation Kit",
    "content": ". Building and Running the SDCARD Bootloader applications . Downloading and building the application . To clone or download this application from Github,go to the main page of this repository and then click Clone button to clone this repo or download as zip file. This content can also be download using content manager by following these instructions . Path of the application within the repository is apps/sdcard_bootloader/ . To build the application, refer to the following table and open the project using its IDE. . Bootloader Application . Project Name Description . bootloader/firmware/sam_e54_xpro.X | MPLABX Project for SAM E54 Xplained Pro Evaluation Kit | . Test Application . Project Name Description . test_app/firmware/sam_e54_xpro.X | MPLABX Project for SAM E54 Xplained Pro Evaluation Kit | . Setting up SAM E54 Xplained Pro Evaluation Kit . Connect the Debug USB port on the board to the computer using a micro USB cable | Use the sdcard slot at the bottom of the device to insert a sdcard | . Running the Application . Open the test application project test_app/firmware/sam_e54_xpro.X in the IDE | Build the project to generate the binary (Do not program the binary) | Open the bootloader project bootloader/firmware/sam_e54_xpro.X in the IDE | Build and program the application using the IDE . | LED0 will be Turned On once programming is completed and bootloader starts running . | Open the Terminal application (Ex.:Tera Term) on the computer to get test application messages through UART once bootloaded | Configure the serial port settings as follows: Baud : 115200 | Data : 8 Bits | Parity : None | Stop : 1 Bit | Flow Control : None | . | Copy the generated application binary file to a sdcard from the Host PC &lt;harmony3_path&gt; bootloader_apps_sdcard apps sdcard_bootloader test_app firmware sam_e54_xpro.X dist sam_e54_xpro production sam_e54_xpro.X.production.bin | . | Rename the copied application binary file to image.bin . | Insert the sdcard with the application binary image.bin to the sdcard slot on the device . | Once the application is successfully programmed LED1 should start blinking and you should see below output on the console . . | Remove the sdcard from the sdcard slot . | Press and hold the Switch SW0 to trigger Bootloader from test application and you should see below output . . | Repeat Steps 10-12 once and jump to Step-15 This step is to verify that bootloader is running after triggering bootloader from test application in Step 13 | . | Press and hold the Switch SW0 and then press Reset button or Power cycle the device to force trigger bootloader at startup | Repeat Steps 10-12 once This step is to verify whether bootloader is triggered by switch press at reset | . | Additional Steps (Optional) . To bootload any other application refer to Application Configurations . | Once done repeat the applicable steps mentioned in Running The Application . | .",
    "url": "http://localhost:4000/bootloader_apps_sdcard/apps/sdcard_bootloader/docs/readme_sam_e54_xpro.html",
    "relUrl": "/apps/sdcard_bootloader/docs/readme_sam_e54_xpro.html"
  }
  ,"7": {
    "title": "Building and Running on SAM E70 Xplained Ultra Evaluation Kit",
    "content": ". Building and Running the SDCARD Bootloader applications . Downloading and building the application . To clone or download this application from Github,go to the main page of this repository and then click Clone button to clone this repo or download as zip file. This content can also be download using content manager by following these instructions . Path of the application within the repository is apps/sdcard_bootloader/ . To build the application, refer to the following table and open the project using its IDE. . Bootloader Application . Project Name Description . bootloader/firmware/sam_e70_xult.X | MPLABX Project for SAM E70 Xplained Ultra Evaluation Kit | . Test Application . Project Name Description . test_app/firmware/sam_e70_xult.X | MPLABX Project for SAM E70 Xplained Ultra Evaluation Kit | . Setting up SAM E70 Xplained Ultra Evaluation Kit . Connect the Debug USB port on the board to the computer using a micro USB cable | Use the micro sdcard slot at the bottom of the device to insert a micro sdcard | . Running the Application . Open the test application project test_app/firmware/sam_e70_xult.X in the IDE | Build the project to generate the binary (Do not program the binary) | Open the bootloader project bootloader/firmware/sam_e70_xult.X in the IDE | Build and program the application using the IDE . | LED1 will be Turned On once programming is completed and bootloader starts running . | Open the Terminal application (Ex.:Tera Term) on the computer to get test application messages through UART once bootloaded | Configure the serial port settings as follows: Baud : 115200 | Data : 8 Bits | Parity : None | Stop : 1 Bit | Flow Control : None | . | Copy the generated application binary file to a micro sdcard from the Host PC &lt;harmony3_path&gt; bootloader_apps_sdcard apps sdcard_bootloader test_app firmware sam_e70_xult.X dist sam_e70_xult production sam_e70_xult.X.production.bin | . | Rename the copied application binary file to image.bin . | Insert the micro sdcard with the application binary image.bin to the micro sdcard slot on the device . | Once the application is successfully programmed LED1 should start blinking and you should see below output on the console . . | Remove the micro sdcard from the sdcard slot . | Press and hold the Switch SW0 to trigger Bootloader from test application and you should see below output . . | Repeat Steps 10-12 once and jump to Step-15 This step is to verify that bootloader is running after triggering bootloader from test application in Step 13 | . | Press and hold the Switch SW0 and then press Reset button or Power cycle the device to force trigger bootloader at startup | Repeat Steps 10-12 once This step is to verify whether bootloader is triggered by switch press at reset | . | Additional Steps (Optional) . To bootload any other application refer to Application Configurations . | Once done repeat the applicable steps mentioned in Running The Application . | .",
    "url": "http://localhost:4000/bootloader_apps_sdcard/apps/sdcard_bootloader/docs/readme_sam_e70_xult.html",
    "relUrl": "/apps/sdcard_bootloader/docs/readme_sam_e70_xult.html"
  }
  ,"8": {
    "title": "Building and Running on SAM L22 Xplained Pro Evaluation Kit",
    "content": ". Building and Running the SDCARD Bootloader applications . Downloading and building the application . To clone or download this application from Github,go to the main page of this repository and then click Clone button to clone this repo or download as zip file. This content can also be download using content manager by following these instructions . Path of the application within the repository is apps/sdcard_bootloader/ . To build the application, refer to the following table and open the project using its IDE. . Bootloader Application . Project Name Description . bootloader/firmware/sam_l22_xpro.X | MPLABX Project for SAM L22 Xplained Pro Evaluation Kit | . Test Application . Project Name Description . test_app/firmware/sam_l22_xpro.X | MPLABX Project for SAM L22 Xplained Pro Evaluation Kit | . Setting up SAM L22 Xplained Pro Evaluation Kit . Connect the Debug USB port on the board to the computer using a micro USB cable | Connect a IO1 Xplained Pro Extension Kit to the EXT1 connector of SAM L22 Xplained Pro Evaluation Kit | Use the micro sdcard slot of the IO1 Xplained Pro Extension Kit to insert a micro sdcard | . Running the Application . Open the test application project test_app/firmware/sam_l22_xpro.X in the IDE | Build the project to generate the binary (Do not program the binary) | Open the bootloader project bootloader/firmware/sam_l22_xpro.X in the IDE | Build and program the application using the IDE . | LED0 will be Turned On once programming is completed and bootloader starts running . | Open the Terminal application (Ex.:Tera Term) on the computer to get test application messages through UART once bootloaded | Configure the serial port settings as follows: Baud : 115200 | Data : 8 Bits | Parity : None | Stop : 1 Bit | Flow Control : None | . | Copy the generated application binary file to a micro sdcard from the Host PC &lt;harmony3_path&gt; bootloader_apps_sdcard apps sdcard_bootloader test_app firmware sam_l22_xpro.X dist sam_l22_xpro production sam_l22_xpro.X.production.bin | . | Rename the copied application binary file to image.bin . | Insert the micro sdcard with the application binary image.bin to the micro sdcard slot of the IO1 Xplained Pro Extension Kit . | Once the application is successfully programmed LED1 should start blinking and you should see below output on the console . . | Remove the micro sdcard from the sdcard slot . | Press and hold the Switch SW0 to trigger Bootloader from test application and you should see below output . . | Repeat Steps 10-12 once and jump to Step-15 This step is to verify that bootloader is running after triggering bootloader from test application in Step 13 | . | Press and hold the Switch SW0 and then press Reset button or Power cycle the device to force trigger bootloader at startup | Repeat Steps 10-12 once This step is to verify whether bootloader is triggered by switch press at reset | . | Additional Steps (Optional) . To bootload any other application refer to Application Configurations . | Once done repeat the applicable steps mentioned in Running The Application . | .",
    "url": "http://localhost:4000/bootloader_apps_sdcard/apps/sdcard_bootloader/docs/readme_sam_l22_xpro.html",
    "relUrl": "/apps/sdcard_bootloader/docs/readme_sam_l22_xpro.html"
  }
  ,"9": {
    "title": "Release notes",
    "content": ". Microchip MPLAB® Harmony 3 Release Notes . SD Card Bootloader Applications Release v3.0.1 . Updated test application projects to disable default linker file generation added in csp v3.8.0 as it requires custom linker file | . Known Issues . No changes from v3.0.0 | . Development Tools . No changes from v3.0.0 | . SD Card Bootloader Applications Release v3.0.0 . New Features . This release introduces support of SD Card Bootloader Applications for SAM and PIC32M family of 32-bit microcontrollers. | . | . Development kit and demo application support . The following table provides bootloader demo applications available for different development kits. . Product Family Development Kits SDCARD . SAM L22 | SAM L22 Xplained Pro Evaluation Kit | Yes | . SAM D5x/E5x | SAM E54 Xplained Pro Evaluation Kit | Yes | . SAM E70/S70/V70/V71 | SAM E70 Xplained Ultra Evaluation Kit | Yes | . PIC32MZ DA | PIC32MZ Embedded Graphics with Stacked DRAM (DA) Starter Kit (Crypto) | Yes | . | . Known Issues . N/A | . Development Tools . MPLAB® X IDE v5.40 | MPLAB® XC32 C/C++ Compiler v2.41 | MPLAB® X IDE plug-ins: MPLAB® Harmony Configurator (MHC) v3.5.0 and above. | . | .",
    "url": "http://localhost:4000/bootloader_apps_sdcard/release_notes.html",
    "relUrl": "/release_notes.html"
  }
  ,"10": {
    "title": "SDCARD Bootloader Applications",
    "content": ". MPLAB® Harmony 3 SDCARD Bootloader Application Examples . MPLAB® Harmony 3 is an extension of the MPLAB® ecosystem for creating embedded firmware solutions for Microchip 32-bit SAM and PIC® microcontroller and microprocessor devices. Refer to the following links for more information. . Microchip 32-bit MCUs | Microchip 32-bit MPUs | Microchip MPLAB X IDE | Microchip MPLAB Harmony | Microchip MPLAB Harmony Pages | . This repository contains the MPLAB® Harmony 3 SDCARD Bootloader application examples . Release Notes | MPLAB® Harmony License | . To clone or download these application from Github,go to the main page of this repository and then click Clone button to clone this repo or download as zip file. This content can also be download using content manager by following these instructions . Contents Summary . Folder Description . apps | SDCARD Bootloader example applications | . docs | Applications help documentation | . Bootloader Examples . The following applications are provided to demonstrate the SDCARD bootloader . Name Description . SDCARD Bootloader | This example application shows how to use the Bootloader Library to bootload an application using SDCARD protocol | . Bootloader Library . Refer to Bootloader Library Help for understanding . Bootloader framework | How the Bootloader library works | Bootloader library configurations | Bootloader memory layout | . . . . . .",
    "url": "http://localhost:4000/bootloader_apps_sdcard/",
    "relUrl": "/"
  }
  
}`;
var data_for_search

var repo_name = "bootloader_apps_sdcard";
var doc_folder_name = "docs";
var localhost_path = "http://localhost:4000/";
var home_index_string = "SDCARD Bootloader Applications";

(function (jtd, undefined) {

// Event handling

jtd.addEvent = function(el, type, handler) {
  if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler);
}
jtd.removeEvent = function(el, type, handler) {
  if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler);
}
jtd.onReady = function(ready) {
  // in case the document is already rendered
  if (document.readyState!='loading') ready();
  // modern browsers
  else if (document.addEventListener) document.addEventListener('DOMContentLoaded', ready);
  // IE <= 8
  else document.attachEvent('onreadystatechange', function(){
      if (document.readyState=='complete') ready();
  });
}

// Show/hide mobile menu

function initNav() {
  const mainNav = document.querySelector('.js-main-nav');
  const pageHeader = document.querySelector('.js-page-header');
  const navTrigger = document.querySelector('.js-main-nav-trigger');

  jtd.addEvent(navTrigger, 'click', function(e){
    e.preventDefault();
    var text = navTrigger.innerText;
    var textToggle = navTrigger.getAttribute('data-text-toggle');

    mainNav.classList.toggle('nav-open');
    pageHeader.classList.toggle('nav-open');
    navTrigger.classList.toggle('nav-open');
    navTrigger.innerText = textToggle;
    navTrigger.setAttribute('data-text-toggle', text);
    textToggle = text;
  })
}

// Site search

function initSearch() {

    data_for_search = JSON.parse(myVariable);
    lunr.tokenizer.separator = /[\s/]+/

    var index = lunr(function () {
        this.ref('id');
        this.field('title', { boost: 200 });
        this.field('content', { boost: 2 });
        this.field('url');
        this.metadataWhitelist = ['position']

        var location = document.location.pathname;
        var path = location.substring(0, location.lastIndexOf("/"));
        var directoryName = path.substring(path.lastIndexOf("/")+1);

        var cur_path_from_repo = path.substring(path.lastIndexOf(repo_name));

        // Decrement depth by 2 as HTML files are placed in repo_name/doc_folder_name
        var cur_depth_from_doc_folder = (cur_path_from_repo.split("/").length - 2);

        var rel_path_to_doc_folder = "";

        if (cur_depth_from_doc_folder == 0) {
            rel_path_to_doc_folder = "./"
        }
        else {
            for (var i = 0; i < cur_depth_from_doc_folder; i++)
            {
                rel_path_to_doc_folder = rel_path_to_doc_folder + "../"
            }
        }

        for (var i in data_for_search) {

            data_for_search[i].url = data_for_search[i].url.replace(localhost_path + repo_name, rel_path_to_doc_folder);

            if (data_for_search[i].title == home_index_string)
            {
                data_for_search[i].url = data_for_search[i].url + "index.html"
            }

            this.add({
                id: i,
                title: data_for_search[i].title,
                content: data_for_search[i].content,
                url: data_for_search[i].url
            });
        }
    });

    searchResults(index, data_for_search);

function searchResults(index, data) {
    var index = index;
    var docs = data;
    var searchInput = document.querySelector('.js-search-input');
    var searchResults = document.querySelector('.js-search-results');

    function hideResults() {
      searchResults.innerHTML = '';
      searchResults.classList.remove('active');
    }

    jtd.addEvent(searchInput, 'keydown', function(e){
      switch (e.keyCode) {
        case 38: // arrow up
          e.preventDefault();
          var active = document.querySelector('.search-result.active');
          if (active) {
            active.classList.remove('active');
            if (active.parentElement.previousSibling) {
              var previous = active.parentElement.previousSibling.querySelector('.search-result');
              previous.classList.add('active');
            }
          }
          return;
        case 40: // arrow down
          e.preventDefault();
          var active = document.querySelector('.search-result.active');
          if (active) {
            if (active.parentElement.nextSibling) {
              var next = active.parentElement.nextSibling.querySelector('.search-result');
              active.classList.remove('active');
              next.classList.add('active');
            }
          } else {
            var next = document.querySelector('.search-result');
            if (next) {
              next.classList.add('active');
            }
          }
          return;
        case 13: // enter
          e.preventDefault();
          var active = document.querySelector('.search-result.active');
          if (active) {
            active.click();
          } else {
            var first = document.querySelector('.search-result');
            if (first) {
              first.click();
            }
          }
          return;
      }
    });

    jtd.addEvent(searchInput, 'keyup', function(e){
      switch (e.keyCode) {
        case 27: // When esc key is pressed, hide the results and clear the field
          hideResults();
          searchInput.value = '';
          return;
        case 38: // arrow up
        case 40: // arrow down
        case 13: // enter
          e.preventDefault();
          return;
      }

      hideResults();

      var input = this.value;
      if (input === '') {
        return;
      }

      var results = index.query(function (query) {
        var tokens = lunr.tokenizer(input)
        query.term(tokens, {
          boost: 10
        });
        query.term(tokens, {
          wildcard: lunr.Query.wildcard.TRAILING
        });
      });

      if (results.length > 0) {
        searchResults.classList.add('active');
        var resultsList = document.createElement('ul');
        resultsList.classList.add('search-results-list');
        searchResults.appendChild(resultsList);

        for (var i in results) {
          var result = results[i];
          var doc = docs[result.ref];

          var resultsListItem = document.createElement('li');
          resultsListItem.classList.add('search-results-list-item');
          resultsList.appendChild(resultsListItem);

          var resultLink = document.createElement('a');
          resultLink.classList.add('search-result');
          resultLink.setAttribute('href', doc.url);
          resultsListItem.appendChild(resultLink);

          var resultTitle = document.createElement('div');
          resultTitle.classList.add('search-result-title');
          resultTitle.innerText = doc.title;
          resultLink.appendChild(resultTitle);

          var resultRelUrl = document.createElement('span');
          resultRelUrl.classList.add('search-result-rel-url');
          resultRelUrl.innerText = doc.relUrl;
          resultTitle.appendChild(resultRelUrl);

          var metadata = result.matchData.metadata;
          var contentFound = false;
          for (var j in metadata) {
            if (metadata[j].title) {
              var position = metadata[j].title.position[0];
              var start = position[0];
              var end = position[0] + position[1];
              resultTitle.innerHTML = doc.title.substring(0, start) + '<span class="search-result-highlight">' + doc.title.substring(start, end) + '</span>' + doc.title.substring(end, doc.title.length)+'<span class="search-result-rel-url">'+doc.relUrl+'</span>';

            } else if (metadata[j].content && !contentFound) {
              contentFound = true;

              var position = metadata[j].content.position[0];
              var start = position[0];
              var end = position[0] + position[1];
              var previewStart = start;
              var previewEnd = end;
              var ellipsesBefore = true;
              var ellipsesAfter = true;
              for (var k = 0; k < 3; k++) {
                var nextSpace = doc.content.lastIndexOf(' ', previewStart - 2);
                var nextDot = doc.content.lastIndexOf('.', previewStart - 2);
                if ((nextDot > 0) && (nextDot > nextSpace)) {
                  previewStart = nextDot + 1;
                  ellipsesBefore = false;
                  break;
                }
                if (nextSpace < 0) {
                  previewStart = 0;
                  ellipsesBefore = false;
                  break;
                }
                previewStart = nextSpace + 1;
              }
              for (var k = 0; k < 10; k++) {
                var nextSpace = doc.content.indexOf(' ', previewEnd + 1);
                var nextDot = doc.content.indexOf('.', previewEnd + 1);
                if ((nextDot > 0) && (nextDot < nextSpace)) {
                  previewEnd = nextDot;
                  ellipsesAfter = false;
                  break;
                }
                if (nextSpace < 0) {
                  previewEnd = doc.content.length;
                  ellipsesAfter = false;
                  break;
                }
                previewEnd = nextSpace;
              }
              var preview = doc.content.substring(previewStart, start);
              if (ellipsesBefore) {
                preview = '... ' + preview;
              }
              preview += '<span class="search-result-highlight">' + doc.content.substring(start, end) + '</span>';
              preview += doc.content.substring(end, previewEnd);
              if (ellipsesAfter) {
                preview += ' ...';
              }

              var resultPreview = document.createElement('div');
              resultPreview.classList.add('search-result-preview');
              resultPreview.innerHTML = preview;
              resultLink.appendChild(resultPreview);
            }
          }
        }
      }
    });

    jtd.addEvent(searchInput, 'blur', function(){
      setTimeout(function(){ hideResults() }, 300);
    });
  }
}

function pageFocus() {
  var mainContent = document.querySelector('.js-main-content');
  mainContent.focus();
}

// Document ready

jtd.onReady(function(){
  initNav();
  pageFocus();
  if (typeof lunr !== 'undefined') {
    initSearch();
  }
});

})(window.jtd = window.jtd || {});


