This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2L: Updateable firmware does not start

Part Number: CC2640R2L
Other Parts Discussed in Thread: BLE-STACK, UNIFLASH

Hello!

I made a supportrequest but they told me that I have to post my request in this forum. In the original request I uploaded my workspace to make sure that any important information is provided. Here I don't want to do that, but I tried to put everything important under this text. --> If you need more information please tell me.

In order to provide scanning for ble beacons for one of our products we use the cc2640R2L. To program the firmware I started from the simple_observer example and implented a uart protocol to communicate with another microcontroller which is master. So far it works very well but when it comes to firmwareupdates problems start.

We want to use two images to achieve firmwareupdates. 1)The bootloader image, located at the start of the flash and 2)the updateable programm which I mentioned above, located behind the bootloader. 
As the simple_observer example comes in “Stack Library configuration” additional flash sections for for the icall- or ble-stack are not necessary as far as I know.

The updateimage will be provided by the master microcontroller via uart and the whole updateprocess will be managed by the bootloader.

In order to get this done the first thing I want to achhieve is that the bootloader jumps to the updateable programm. In this case both images are flashed by the uniflashtool. The config bytes(end of flash)
I flashed separately. To see if this is successfull I commented out most code and added some debugcode so that the bootloader does not much more than outputting “Hallo” via uart and after a few seconds 
it is supposed to jump to the updateable image and the updateable image is supposed to do not much more than outputting “Tschoe” via uart.

After flashing the bootloader image to address zero and the updateimage address 0x8000 I reseted the µC by connecting the reset pin to ground. 
In the terminal I use to see the uart output I see a lot of “Hallo” which indicates that bootloader is running until the point where it jumps or should jump to the updateable image. 
Then uart óutput ends which indicates that the updateable image is not running.

I also used the uniflashtool to check the content of the flash afterwards but I was not able to notice something strange. 

It would be very nice if you could help me solving that issue.

Best regards!

mainloop (updateable program):

mainloop(bootloader):

 

/*
 * Copyright (c) 2017, Texas Instruments Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  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.
 *
 * *  Neither the name of Texas Instruments Incorporated 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 OWNER 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.
 */

/*
 *  ======== CC2640R2_LAUNCHXL_NoRTOS.cmd ========
 */

--retain=g_pfnVectors

--stack_size=1024   /* C stack is also used for ISR stack */

--heap_size=256

/* Override default entry point.                                             */
--entry_point resetISR
/* Allow main() to take args                                                 */
--args 0x8
/* Suppress warnings and errors:                                             */
/* - 10063: Warning about entry point not being _c_int00                     */
/* - 16011, 16012: 8-byte alignment errors. Observed when linking in object  */
/*   files compiled using Keil (ARM compiler)                                */
--diag_suppress=10063,16011,16012

/* The starting address of the application.  Normally the interrupt vectors  */
/* must be located at the beginning of the application.                      */
#define FLASH_BASE              0x0
#define FLASH_SIZE              0x20000
#define RAM_BASE                0x20000000
#define RAM_SIZE                0x5000
#define BOOTLOADER_SIZE			0x8000

/* System memory map */

MEMORY
{
    /* Application stored in and executes from internal flash */
    //FLASH (RX) : origin = FLASH_BASE, length = FLASH_SIZE
    FLASH (RX) : origin = FLASH_BASE, length = BOOTLOADER_SIZE
    /* Application uses internal RAM for data */
    SRAM (RWX) : origin = RAM_BASE, length = RAM_SIZE
}

/* Section allocation in memory */

SECTIONS
{
    .intvecs        :   > FLASH_BASE
    .text           :   > FLASH
    .TI.ramfunc     : {} load=FLASH, run=SRAM, table(BINIT)
    .const          :   > FLASH
    .constdata      :   > FLASH
    .rodata         :   > FLASH
    .cinit          :   > FLASH
    .pinit          :   > FLASH
    .init_array     :   > FLASH
    .emb_text       :   > FLASH
    .ccfg           :   > FLASH (HIGH)

    .vtable_ram     :   > SRAM
    .data           :   > SRAM
    .bss            :   > SRAM
    .sysmem         :   > SRAM
    .nonretenvar    :   > SRAM

    .stack          :   > SRAM (HIGH)
}

/******************************************************************************

 @file  cc26xx_app.cmd

 @brief CC2650F128 linker configuration file for TI-RTOS with Code Composer
        Studio.

        Imported Symbols
        Note: Linker defines are located in the CCS IDE project by placing them
        in
        Properties->Build->Linker->Advanced Options->Command File Preprocessing.

        CACHE_AS_RAM:       Disable system cache to be used as GPRAM for
                            additional volatile memory storage.
        CCxxxxROM:          Device Name (e.g. CC2650). In order to define this
                            symbol, the tool chain requires that it be set to
                            a specific value, but in fact, the actual value does
                            not matter as it is not used in the linker control
                            file. The only way this symbol is used is based on
                            whether it is defined or not, not its actual value.
                            There are other linker symbols that do specifically
                            set their value to 1 to indicate R1, and 2 to
                            indicate R2, and these values are checked and do make
                            a difference. However, it would appear confusing if
                            the device name's value did not correspond to the
                            value set in other linker symbols. In order to avoid
                            this confusion, when the symbol is defined, it should
                            be set to the value of the device's ROM that it
                            corresponds so as to look and feel consistent. Please
                            note that a device name symbol should always be
                            defined to avoid side effects from default values
                            that may not be correct for the device being used.
        ICALL_RAM0_START:   RAM start of BLE stack.
        ICALL_STACK0_START: Flash start of BLE stack.
        PAGE_AlIGN:         Align BLE stack boundary to a page boundary.
                            Aligns to Flash word boundary by default.

 Group: WCS, BTS
 Target Device: cc2640r2

 ******************************************************************************
 
 Copyright (c) 2013-2021, Texas Instruments Incorporated
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:

 *  Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

 *  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.

 *  Neither the name of Texas Instruments Incorporated 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 OWNER 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.

 ******************************************************************************
 
 
 *****************************************************************************/

/*******************************************************************************
 * CCS Linker configuration
 */

/* Retain interrupt vector table variable                                    */
--retain=g_pfnVectors
/* Override default entry point.                                             */
--entry_point ResetISR
/* Suppress warnings and errors:                                             */
/* - 10063: Warning about entry point not being _c_int00                     */
/* - 16011, 16012: 8-byte alignment errors. Observed when linking in object  */
/*   files compiled using Keil (ARM compiler)                                */
--diag_suppress=10063,16011,16012

/* The following command line options are set as part of the CCS project.    */
/* If you are building using the command line, or for some reason want to    */
/* define them here, you can uncomment and modify these lines as needed.     */
/* If you are using CCS for building, it is probably better to make any such */
/* modifications in your CCS project and leave this file alone.              */
/*                                                                           */
/* --heap_size=0                                                             */
/* --stack_size=256                                                          */
/* --library=rtsv7M3_T_le_eabi.lib                                           */

/* The starting address of the application.  Normally the interrupt vectors  */
/* must be located at the beginning of the application. Flash is 128KB, with */
/* sector length of 4KB                                                      */

/*******************************************************************************
 * Memory Sizes
 */
#define ENTRY_SIZE	 0x40
#define IMAGE_B_START 0x8000
//#define IMAGE_B_END  0x1D000
#define IMAGE_B_END  0x1F000
#define FLASH_BASE   0x00000000
#define GPRAM_BASE   0x11000000
#define RAM_BASE     0x20000000
#define ROM_BASE     0x10000000

#ifdef CC26X0ROM
  #define FLASH_SIZE 0x00020000
  #define GPRAM_SIZE 0x00002000
  #define RAM_SIZE   0x00005000
  #define ROM_SIZE   0x0001C000
#endif /* CC26X0ROM */

/*******************************************************************************
 * Memory Definitions
 ******************************************************************************/

/*******************************************************************************
 * RAM
 */

#ifdef CC26X0ROM
  #if CC26X0ROM == 2
    #define RESERVED_RAM_SIZE 0x00000C00
  #elif CC26X0ROM == 1
    #define RESERVED_RAM_SIZE 0x00000718
  #endif /* CC26X0ROM */
#endif /* CC26X0ROM */

#define RAM_START             RAM_BASE

#ifdef ICALL_RAM0_START
  #define RAM_END             (ICALL_RAM0_START - 1)
#else
  #define RAM_END             (RAM_START + RAM_SIZE - RESERVED_RAM_SIZE - 1)
#endif /* ICALL_RAM0_START */

/*******************************************************************************
 * Flash
 */

#define FLASH_START                FLASH_BASE
#define WORD_SIZE                  4

#ifdef CC26X0ROM
  #define PAGE_SIZE                0x1000
#endif /* CC26X0ROM */

#ifdef PAGE_ALIGN
  #define FLASH_MEM_ALIGN          PAGE_SIZE
#else
  #define FLASH_MEM_ALIGN          WORD_SIZE
#endif /* PAGE_ALIGN */

#ifdef CC26X0ROM
  #define PAGE_MASK                0xFFFFF000
#endif /* CC26X0ROM */

/* The last Flash page is reserved for the application. */
#define NUM_RESERVED_FLASH_PAGES   1
#define RESERVED_FLASH_SIZE        (NUM_RESERVED_FLASH_PAGES * PAGE_SIZE)

/* Check if page alingment with the Stack image is required.  If so, do not link
 * into a page shared by the Stack.
 */
#ifdef ICALL_STACK0_START
  #ifdef PAGE_ALIGN
    #define ADJ_ICALL_STACK0_START (ICALL_STACK0_START * PAGE_MASK)
  #else
    #define ADJ_ICALL_STACK0_START ICALL_STACK0_START
  #endif /* PAGE_ALIGN */

  #define FLASH_END                (ADJ_ICALL_STACK0_START - 1)
#else
  #define FLASH_END                (FLASH_START + FLASH_SIZE - RESERVED_FLASH_SIZE - 1)
#endif /* ICALL_STACK0_START */

#define FLASH_LAST_PAGE_START      (FLASH_SIZE - PAGE_SIZE)

/*******************************************************************************
 * Stack
 */

/* Create global constant that points to top of stack */
/* CCS: Change stack size under Project Properties    */
__STACK_TOP = __stack + __STACK_SIZE;

/*******************************************************************************
 * GPRAM
 */

#ifdef CACHE_AS_RAM
  #define GPRAM_START GPRAM_BASE
  #define GPRAM_END   (GPRAM_START + GPRAM_SIZE - 1)
#endif /* CACHE_AS_RAM */

/*******************************************************************************
 * Main arguments
 */

/* Allow main() to take args */
/* --args 0x8 */

/*******************************************************************************
 * ROV
 * These symbols are used by ROV2 to extend the valid memory regions on device.
 * Without these defines, ROV will encounter a Java exception when using an
 * autosized heap. This is a posted workaround for a known limitation of
 * RTSC/rta. See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=487894
 *
 * Note: these do not affect placement in RAM or FLASH, they are only used
 * by ROV2, see the BLE Stack User's Guide for more info on a workaround
 * for ROV Classic
 *
 */
__UNUSED_SRAM_start__ = 0x20000000;
__UNUSED_SRAM_end__ = 0x20005000;

__UNUSED_FLASH_start__ = 0;
__UNUSED_FLASH_end__ = 0x1FFFF;

/*******************************************************************************
 * System Memory Map
 ******************************************************************************/
MEMORY
{
  /* EDITOR'S NOTE:
   * the FLASH and SRAM lengths can be changed by defining
   * ICALL_STACK0_START or ICALL_RAM0_START in
   * Properties->ARM Linker->Advanced Options->Command File Preprocessing.
   */

  /* Application stored in and executes from internal flash */
  /*FLASH (RX) : origin = FLASH_START, length = (FLASH_END - FLASH_START + 1)*/



  ENTRY (RX) : origin = IMAGE_B_START, length = ENTRY_SIZE



  FLASH (RX) : origin = IMAGE_B_START + ENTRY_SIZE, length = (IMAGE_B_END - IMAGE_B_START - ENTRY_SIZE)
  //FLASH (RX) : origin = IMAGE_B_START, length = (IMAGE_B_END - IMAGE_B_START)

  /* CCFG Page, contains .ccfg code section and some application code. */
  FLASH_LAST_PAGE (RX) :  origin = FLASH_LAST_PAGE_START, length = PAGE_SIZE

  /* Application uses internal RAM for data */
  SRAM (RWX) : origin = RAM_START, length = (RAM_END - RAM_START + 1)

  #ifdef CACHE_AS_RAM
      GPRAM(RWX) : origin = GPRAM_START, length = GPRAM_SIZE
  #endif /* CACHE_AS_RAM */
}

/*******************************************************************************
 * Section Allocation in Memory
 ******************************************************************************/
SECTIONS
{
  //.intvecs        :   >  FLASH_START
  .text           :   >> FLASH //| FLASH_LAST_PAGE
  .const          :   >> FLASH //| FLASH_LAST_PAGE
  .constdata      :   >> FLASH //| FLASH_LAST_PAGE
  .rodata         :   >> FLASH //| FLASH_LAST_PAGE
  .cinit          :   >  FLASH //| FLASH_LAST_PAGE
  .pinit          :   >> FLASH //| FLASH_LAST_PAGE
  .init_array     :   >  FLASH //| FLASH_LAST_PAGE
  .emb_text       :   >> FLASH //| FLASH_LAST_PAGE
  .snvSectors     :   > FLASH (HIGH)
  //.ccfg           :   >  FLASH_LAST_PAGE (HIGH)


  GROUP : > ENTRY
  {
    .resetVecs
    .intvecs
    //EntrySection  LOAD_START(prgEntryAddr)
  }


  GROUP > SRAM
  {
    .data
#ifndef CACHE_AS_RAM
    .bss
#endif /* CACHE_AS_RAM */
    .vtable
    .vtable_ram
    vtable_ram
    .sysmem
    .nonretenvar
    /*This keeps ll.o objects out of GPRAM, if no ll.o would be placed here
      the warning #10068 is supressed.*/
    #ifdef CACHE_AS_RAM
    ll_bss
    {
      --library=cc2640_ctrlll*.a<ll.o> (.bss)
    }
    #endif /* CACHE_AS_RAM */
  } LOAD_END(heapStart)

  .stack        :   > SRAM (HIGH) LOAD_START(heapEnd)
  .noinit       :   > SRAM (HIGH) TYPE=NOINIT

#ifdef CACHE_AS_RAM
    .bss :
    {
      *(.bss)
    } > GPRAM
#endif /* CACHE_AS_RAM */
}

 /******************************************************************************

 @file  cc2640_r2_csdk.cfg

 @brief TI RTOS Configuration file for CC26xx

        Imported Symbols
        Note: These symbols are defined following the --cfgArgs option.
        In IAR this is done at the end of the pre-build step.  In CCS, this
        is done in Properties->build->XDCtools-Advanced options->Configuration
        script arguments.  Multiple symbols can be used separating them by a
        comma (",").

        By default, TI RTOS builds with RTOS in ROM, interrupt vectors starting
        at address 0x0 and uses ROM only kernel modules.

        NO_ROM:     When set to a non-zero value, RTOS builds in Flash instead
                    of ROM
        OAD_IMG_A:  When set to a non-zero value, interrupt vectors are set to
                    their expected location for on-chip OAD Image A.
        OAD_IMG_B:  When set to a non-zero value, interrupt vectors are set to
                    their expected location for on-chip OAD Image B.
        OAD_IMG_E:  When set to a non-zero value, interrupt vectors are set to
                    their expected location for external flash OAD.
        USE_EVENTS: Build the RTOS Kernel Event module.
		SECURE_FW_IMG: When set to a non-zero value, interrupt vectors are set to
                       their expected location for secure firmware image.

 Group: WCS, BTS
 Target Device: cc2640r2

 ******************************************************************************
 
 Copyright (c) 2013-2021, Texas Instruments Incorporated
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:

 *  Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

 *  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.

 *  Neither the name of Texas Instruments Incorporated 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 OWNER 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.

 ******************************************************************************
 
 
 *****************************************************************************/

var RTOS_IN_ROM;
var OAD_IMG_TYPE;
var USE_SECURE_FW_IMG;

if(Program.build.cfgArgs != null)
{
  if (typeof Program.build.cfgArgs.NO_ROM == 'undefined' ||
      (typeof Program.build.cfgArgs.NO_ROM != 'undefined' &&
        Program.build.cfgArgs.NO_ROM == 0))
  {
    RTOS_IN_ROM = true;
  }
  else
  {
    RTOS_IN_ROM = false;
  }

  if(typeof Program.build.cfgArgs.OAD_IMG_A != 'undefined' &&
      Program.build.cfgArgs.OAD_IMG_A == 1)
  {
    OAD_IMG_TYPE = "A";
  }
  else if (typeof Program.build.cfgArgs.OAD_IMG_B != 'undefined' &&
      Program.build.cfgArgs.OAD_IMG_B == 1)
  {
    OAD_IMG_TYPE = "B";
  }
  else if (typeof Program.build.cfgArgs.OAD_IMG_E != 'undefined' &&
      Program.build.cfgArgs.OAD_IMG_E == 1)
  {
    OAD_IMG_TYPE = "E";
  }

  if(typeof Program.build.cfgArgs.SECURE_FW_IMG != 'undefined' &&
      Program.build.cfgArgs.SECURE_FW_IMG == 1)
  {
    USE_SECURE_FW_IMG = true;
  }
}
else
{
  RTOS_IN_ROM = true;
  USE_SECURE_FW_IMG = false;
}

/* ================ ROM configuration ================ */
/*
 * To use BIOS in flash, comment out the code block below.
 */
if (RTOS_IN_ROM)
{
  //var ROM = xdc.useModule('ti.sysbios.rom.ROM'); Daniel Wardin
  if (Program.cpu.deviceName.match(/CC26/)) {
    //  ROM.romName = ROM.CC2640R2F; Daniel Wardin
  }
  else if (Program.cpu.deviceName.match(/CC13/)) {
      ROM.romName = ROM.CC1350;
  }
}



/* ================ Boot configuration ================ */
if (RTOS_IN_ROM)
{
  var Boot = xdc.useModule('ti.sysbios.family.arm.cc26xx.Boot');
}
/*
 * This module contains family specific Boot APIs and configuration settings.
 * See the SYS/BIOS API guide for more information.
 */
if (RTOS_IN_ROM)
{
  Boot.driverlibVersion = 2;
  Boot.customerConfig = false;
}

/* ================ Clock configuration ================ */
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
/*
 * When using Power and calibrateRCOSC is set to true, this should be set to 10.
 * The timer used by the Clock module supports TickMode_DYNAMIC. This enables us
 * to set the tick period to 10 us without generating the overhead of additional
 * interrupts.
 *
 * Note: The calibrateRCOSC parameter is set within the Power configuration
 *     structure in the "Board.c" file.
 */
Clock.tickPeriod = 10;
Clock.swiPriority = 5;


/* ================ Types configuration ================ */
var Types = xdc.useModule('xdc.runtime.Types');
/*
 * This module defines basic constants and types used throughout the
 * xdc.runtime package.
 */



/* ================ Defaults (module) configuration ================ */
var Defaults = xdc.useModule('xdc.runtime.Defaults');
/*
 * A flag to allow module names to be loaded on the target. Module name
 * strings are placed in the .const section for debugging purposes.
 *
 * Pick one:
 *  - true (default)
 *      Setting this parameter to true will include name strings in the .const
 *      section so that Errors and Asserts are easier to debug.
 *  - false
 *      Setting this parameter to false will reduce footprint in the .const
 *      section. As a result, Error and Assert messages will contain an
 *      "unknown module" prefix instead of the actual module name.
 *
 *  When using BIOS in ROM:
 *      This option must be set to false.
 */
//Defaults.common$.namedModule = true;
Defaults.common$.namedModule = false;

/* Compile out all Assert's */
//Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;

/* Allow Mod_create() and Mod_construct() but not delete() or destruct() */
Defaults.common$.memoryPolicy = Types.CREATE_POLICY;



/* ================ Error configuration ================ */
var Error = xdc.useModule('xdc.runtime.Error');
/*
 * This function is called to handle all raised errors, but unlike
 * Error.raiseHook, this function is responsible for completely handling the
 * error with an appropriately initialized Error_Block.
 *
 * Pick one:
 *  - Error.policyDefault (default)
 *      Calls Error.raiseHook with an initialized Error_Block structure and logs
 *      the error using the module's logger.
 *  - Error.policySpin
 *      Simple alternative that traps on a while(1) loop for minimized target
 *      footprint.
 *      Using Error.policySpin, the Error.raiseHook will NOT called.
 */
//Error.policyFxn = Error.policyDefault;
Error.policyFxn = Error.policySpin;

/*
 * If Error.policyFxn is set to Error.policyDefault, this function is called
 * whenever an error is raised by the Error module.
 *
 * Pick one:
 *  - Error.print (default)
 *      Errors are formatted and output via System_printf() for easier
 *      debugging.
 *  - null
 *      Errors are trapped with a while(1) stub function. This option reduces
 *      code footprint.
 *  - non-null function
 *      Errors invoke custom user function. See the Error module documentation
 *      for more details.
 */
//Error.raiseHook = Error.print;
Error.raiseHook = null;
//Error.raiseHook = "&myErrorFxn";

/*
 * If Error.policyFxn is set to Error.policyDefault, this option applies to the
 * maximum number of times the Error.raiseHook function can be recursively
 * invoked. This option limits the possibility of an infinite recursion that
 * could lead to a stack overflow.
 * The default value is 16.
 */
Error.maxDepth = 2;



/* ================ Hwi configuration ================ */
var halHwi = xdc.useModule('ti.sysbios.hal.Hwi');
var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
/*
 * Checks for Hwi (system) stack overruns while in the Idle loop.
 *
 * Pick one:
 *  - true (default)
 *      Checks the top word for system stack overflows during the idle loop and
 *      raises an Error if one is detected.
 *  - false
 *      Disabling the runtime check improves runtime performance and yields a
 *      reduced flash footprint.
 */
//halHwi.checkStackFlag = true;
halHwi.checkStackFlag = false;

/*
 * The following options alter the system's behavior when a hardware exception
 * is detected.
 *
 * Pick one:
 *  - Hwi.enableException = true
 *      This option causes the default m3Hwi.excHandlerFunc function to fully
 *      decode an exception and dump the registers to the system console.
 *      This option raises errors in the Error module and displays the
 *      exception in ROV.
 *  - Hwi.enableException = false
 *      This option reduces code footprint by not decoding or printing the
 *      exception to the system console.
 *      It however still raises errors in the Error module and displays the
 *      exception in ROV.
 *  - Hwi.excHandlerFunc = null
 *      This is the most aggressive option for code footprint savings; but it
 *      can difficult to debug exceptions. It reduces flash footprint by
 *      plugging in a default while(1) trap when exception occur. This option
 *      does not raise an error with the Error module.
 */
//m3Hwi.enableException = true;
//m3Hwi.enableException = false;
m3Hwi.excHandlerFunc = null;

/*
 * Enable hardware exception generation when dividing by zero.
 *
 * Pick one:
 *  - 0 (default)
 *      Disables hardware exceptions when dividing by zero
 *  - 1
 *      Enables hardware exceptions when dividing by zero
 */
m3Hwi.nvicCCR.DIV_0_TRP = 0;
//m3Hwi.nvicCCR.DIV_0_TRP = 1;

/*
 * Enable hardware exception generation for invalid data alignment.
 *
 * Pick one:
 *  - 0 (default)
 *      Disables hardware exceptions for data alignment
 *  - 1
 *      Enables hardware exceptions for data alignment
 */
m3Hwi.nvicCCR.UNALIGN_TRP = 0;
//m3Hwi.nvicCCR.UNALIGN_TRP = 1;

/* Put reset vector at start of Flash */
if (OAD_IMG_TYPE == "A")
{
  m3Hwi.resetVectorAddress  = 0x0001dfc0;
}
else if (OAD_IMG_TYPE == "E" || OAD_IMG_TYPE == "B")
{
  //m3Hwi.resetVectorAddress  = 0x00A8;	
  m3Hwi.resetVectorAddress  = 0x8000;	//Daniel Wardin
}
else if (USE_SECURE_FW_IMG)
{
  m3Hwi.resetVectorAddress  = 0x0070;
}
else
{
  m3Hwi.resetVectorAddress  = 0x0;
}

/* Put interrupt vector at start of RAM so interrupts can be configured at runtime */
m3Hwi.vectorTableAddress  = 0x20000000;

/* CC2650 has 50 interrupts */
m3Hwi.NUM_INTERRUPTS = 50;



/* ================ Idle configuration ================ */
var Idle = xdc.useModule('ti.sysbios.knl.Idle');
/*
 * The Idle module is used to specify a list of functions to be called when no
 * other tasks are running in the system.
 *
 * Functions added here will be run continuously within the idle task.
 *
 * Function signature:
 *     Void func(Void);
 */
//Idle.addFunc("&myIdleFunc");
/* Allow power management */
Idle.addFunc('&Power_idleFunc');



/* ================ Kernel (SYS/BIOS) configuration ================ */
var BIOS = xdc.useModule('ti.sysbios.BIOS');
/*
 * Enable asserts in the BIOS library.
 *
 * Pick one:
 *  - true (default)
 *      Enables asserts for debugging purposes.
 *  - false
 *      Disables asserts for a reduced code footprint and better performance.
 *
 *  When using BIOS in ROM:
 *      This option must be set to false.
 */
//BIOS.assertsEnabled = true;
BIOS.assertsEnabled = false;

/*
 * A flag to determine if xdc.runtime sources are to be included in a custom
 * built BIOS library.
 *
 * Pick one:
 *  - false (default)
 *      The pre-built xdc.runtime library is provided by the respective target
 *      used to build the application.
 *  - true
 *      xdc.runtime library sources are to be included in the custom BIOS
 *      library. This option yields the most efficient library in both code
 *      footprint and runtime performance.
 */
//BIOS.includeXdcRuntime = false;
BIOS.includeXdcRuntime = true;

/*
 * The SYS/BIOS runtime is provided in the form of a library that is linked
 * with the application. Several forms of this library are provided with the
 * SYS/BIOS product.
 *
 * Pick one:
 *   - BIOS.LibType_Custom
 *      Custom built library that is highly optimized for code footprint and
 *      runtime performance.
 *   - BIOS.LibType_Debug
 *      Custom built library that is non-optimized that can be used to
 *      single-step through APIs with a debugger.
 *
 */
BIOS.libType = BIOS.LibType_Custom;
//BIOS.libType = BIOS.LibType_Debug;

/*
 * Runtime instance creation enable flag.
 *
 * Pick one:
 *   - true (default)
 *      Allows Mod_create() and Mod_delete() to be called at runtime which
 *      requires a default heap for dynamic memory allocation.
 *   - false
 *      Reduces code footprint by disallowing Mod_create() and Mod_delete() to
 *      be called at runtime. Object instances are constructed via
 *      Mod_construct() and destructed via Mod_destruct().
 *
 *  When using BIOS in ROM:
 *      This option must be set to true.
 */
BIOS.runtimeCreatesEnabled = true;
//BIOS.runtimeCreatesEnabled = false;

/*
 * Enable logs in the BIOS library.
 *
 * Pick one:
 *  - true (default)
 *      Enables logs for debugging purposes.
 *  - false
 *      Disables logging for reduced code footprint and improved runtime
 *      performance.
 *
 *  When using BIOS in ROM:
 *      This option must be set to false.
 */
//BIOS.logsEnabled = true;
BIOS.logsEnabled = false;

BIOS.swiEnabled = true;



/* ================ Program configuration ================ */
/*
 *  Program.stack is ignored with IAR. Use the project options in
 *  IAR Embedded Workbench to alter the system stack size.
 */
if (RTOS_IN_ROM)
{
  Program.stack = 1024;
  Program.argSize = 0;
}
else
{
  Program.stack = 512;
}



/* ================ Semaphore configuration ================ */
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
/*
 * Enables global support for Task priority pend queuing.
 *
 * Pick one:
 *  - true (default)
 *      This allows pending tasks to be serviced based on their task priority.
 *  - false
 *      Pending tasks are services based on first in, first out basis.
 *
 *  When using BIOS in ROM:
 *      This option must be set to false.
 */
//Semaphore.supportsPriority = true;
Semaphore.supportsPriority = false;

/*
 * Allows for the implicit posting of events through the semaphore,
 * disable for additional code saving.
 *
 * Pick one:
 *  - true
 *      This allows the Semaphore module to post semaphores and events
 *      simultaneously.
 *  - false (default)
 *      Events must be explicitly posted to unblock tasks.
 *
 *  When using BIOS in ROM:
 *      This option must be set to false.
 */
//Semaphore.supportsEvents = true;
Semaphore.supportsEvents = false;




/* ================ Events configuration ================ */
var Events = xdc.useModule('ti.sysbios.knl.Event');



/* ================ Swi configuration ================ */
var Swi = xdc.useModule('ti.sysbios.knl.Swi');
/*
 * A software interrupt is an object that encapsulates a function to be
 * executed and a priority. Software interrupts are prioritized, preempt tasks
 * and are preempted by hardware interrupt service routines.
 *
 * This module is included to allow Swi's in a users' application.
 */
Swi.numPriorities = 6;



/* ================ System configuration ================ */
var System = xdc.useModule('xdc.runtime.System');
/*
 * The Abort handler is called when the system exits abnormally.
 *
 * Pick one:
 *  - System.abortStd (default)
 *      Call the ANSI C Standard 'abort()' to terminate the application.
 *  - System.abortSpin
 *      A lightweight abort function that loops indefinitely in a while(1) trap
 *      function.
 *  - A custom abort handler
 *      A user-defined function. See the System module documentation for
 *      details.
 */
//System.abortFxn = System.abortStd;
System.abortFxn = System.abortSpin;
//System.abortFxn = "&myAbortSystem";

/*
 * The Exit handler is called when the system exits normally.
 *
 * Pick one:
 *  - System.exitStd (default)
 *      Call the ANSI C Standard 'exit()' to terminate the application.
 *  - System.exitSpin
 *      A lightweight exit function that loops indefinitely in a while(1) trap
 *      function.
 *  - A custom exit function
 *      A user-defined function. See the System module documentation for
 *      details.
 */
//System.exitFxn = System.exitStd;
System.exitFxn = System.exitSpin;
//System.exitFxn = "&myExitSystem";

/*
 * Minimize exit handler array in the System module. The System module includes
 * an array of functions that are registered with System_atexit() which is
 * called by System_exit(). The default value is 8.
 */
System.maxAtexitHandlers = 0;

/*
 * The System.SupportProxy defines a low-level implementation of System
 * functions such as System_printf(), System_flush(), etc.
 *
 * Pick one pair:
 *  - SysMin
 *      This module maintains an internal configurable circular buffer that
 *      stores the output until System_flush() is called.
 *      The size of the circular buffer is set via SysMin.bufSize.
 *  - SysCallback
 *      SysCallback allows for user-defined implementations for System APIs.
 *      The SysCallback support proxy has a smaller code footprint and can be
 *      used to supply custom System_printf services.
 *      The default SysCallback functions point to stub functions. See the
 *      SysCallback module's documentation.
 */
//var SysMin = xdc.useModule('xdc.runtime.SysMin');
//SysMin.bufSize = 128;
//System.SupportProxy = SysMin;
var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
System.SupportProxy = SysCallback;
//SysCallback.abortFxn = "&myUserAbort";
//SysCallback.exitFxn  = "&myUserExit";
//SysCallback.flushFxn = "&myUserFlush";
//SysCallback.putchFxn = "&myUserPutch";
//SysCallback.readyFxn = "&myUserReady";



/* ================ Task configuration ================ */
var Task = xdc.useModule('ti.sysbios.knl.Task');
/*
 * Check task stacks for overflow conditions.
 *
 * Pick one:
 *  - true (default)
 *      Enables runtime checks for task stack overflow conditions during
 *      context switching ("from" and "to")
 *  - false
 *      Disables runtime checks for task stack overflow conditions.
 *
 *  When using BIOS in ROM:
 *      This option must be set to false.
 */
//Task.checkStackFlag = true;
Task.checkStackFlag = false;

/*
 * Set the default task stack size when creating tasks.
 *
 * The default is dependent on the device being used. Reducing the default stack
 * size yields greater memory savings.
 */
Task.defaultStackSize = 512;

/*
 * Enables the idle task.
 *
 * Pick one:
 *  - true (default)
 *      Creates a task with priority of 0 which calls idle hook functions. This
 *      option must be set to true to gain power savings provided by the Power
 *      module.
 *  - false
 *      No idle task is created. This option consumes less memory as no
 *      additional default task stack is needed.
 *      To gain power savings by the Power module without having the idle task,
 *      add Idle.run as the Task.allBlockedFunc.
 */
Task.enableIdleTask = true;
//Task.enableIdleTask = false;
//Task.allBlockedFunc = Idle.run;

/*
 * If Task.enableIdleTask is set to true, this option sets the idle task's
 * stack size.
 *
 * Reducing the idle stack size yields greater memory savings.
 */
Task.idleTaskStackSize = 512;

/*
 * Reduce the number of task priorities.
 * The default is 16.
 * Decreasing the number of task priorities yield memory savings.
 */
Task.numPriorities = 6;



/* ================ Text configuration ================ */
var Text = xdc.useModule('xdc.runtime.Text');
/*
 * These strings are placed in the .const section. Setting this parameter to
 * false will save space in the .const section. Error, Assert and Log messages
 * will print raw ids and args instead of a formatted message.
 *
 * Pick one:
 *  - true (default)
 *      This option loads test string into the .const for easier debugging.
 *  - false
 *      This option reduces the .const footprint.
 */
//Text.isLoaded = true;
Text.isLoaded = false;




// Remaining Modules
var Diags = xdc.useModule('xdc.runtime.Diags');
var Main = xdc.useModule('xdc.runtime.Main');
var Reset = xdc.useModule('xdc.runtime.Reset');




P e:�:+2�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�7�H-��O%�L�I`���(�e�(�/��N(<�(@�\�Q�%���)���`�����IB(��@B�B&�O�W���Eh���0!O�B#�0F�G���Eh���!O��#�0F�G������pEh !O�@b
#0F��G%���P�Q�%��)�/F�'9F�O8h(�бF&	�	��,�>`	����� ������F��F;h+�������>`��	���@�������F��F;h+�������>`������ ������a���𜀔��h�������������p���p���0���0������0(T�"o���h�@�B�r�`������0)�)<����0�4)��9!���%�*)�����8 ������?(��@? �������(��ƿ���00������(Ŀ@���P%��ƿ���00������PO�W������00!O�BEh7H�#�G���!O�2#Eh2H��G���`���!O��#Eh,H��G��� !O�@b
#���`Eh&H��G���P@��P@E؀@E/� 0�Q�%OK�� HC
8h��@(�Hhh�G���6�1�HC��6���0�Hh �@6v���PH1`'A`M�`(x� � ����������F-@@,P@ �@�@�?P� 	@<`@m>-��OF{H$h��	�yHx�  ��-@��������(@�؀ ����l� ��_�� �����������F�gHhM����jh �G(�XF��� �bHbO���8h ����$ ����D� ����D� ��� �(hVNk0��G
 �� �(hSNk0��GRH&`(h�iD� �GOH`����@�(j�hJH�G�F����(jBhEH!�GDIh �`XF��+h8h�k�G�(�(jBh9H1F�G9Ih@�`/H`(hAi F�G �k� �(h,K�j��G
 �b� �(h(K�j��G'H`"��� &K���(hAk F�G(��8h ���FH`8hHh�	���(�0F�>��� ���F����`��H������W��O��8�o��o�@F�����F	@� @	@�"C, 	@B=>=( `�C@@$"@h> -��O���F��5���h����uHhh�G~I1���%O�)q_�R�
���>�
O��ؿ"�B��hK��|!��b*�� :h��C+�� ;�FR*��
��o�	�"]K]N�A��Q�1h��%�(�E��E�CF��A)ڙy�B���o���D�(��)�����O�(!�)��!�)��!^�!`$wF�<YO�����$���&1Do�$���F1Dn(��a�!O�o��^�$�_�\��$���&4D~$���F4Dn(��d�����&qC�1�$��)ؿ!4"	��JC��O��ryC����B8��(��������o�� �q�qHh)`O��@���B�I@�B���!��O9		@��G����&���o����
I
OCF `�p�����<Pnb@$"@8 �P 	@5	@礀0	@����?P-��O��$
���_Hx�M�^M$(�8�@�@	����(�!�ih�!$�!$i`RJh��P(�R�'��C�(��D
�"SF@@G(`�+���h&���+�����F3F���/иBӹB�"�@B� i�C��
�0\��[���/��	 �T��!�`�(�m�'O��F(F�F���B�B���A��A���Q� "H�"���O��1������ (`��-�B�����LJ x!������hF������jF`hI��d���IQ�
 ��P@�PA�
O����HF���	����5  �?P�g�>8Y/
0	@	@-��CaLZMZN��p�^O���F@(d����{,C#C#Cvd)�"
)E�!,�  �  E�! F��� E�9'������E�9,����)�	  '���7`u���p8= /��� !�!�` ��� E�1`0h�^Ҕ��3H')�hEh!`"#�@F�G���(�
  ��hEh!`"# �@F�G ����%H&O&%` =`�	� ������P���`���� 8`%x`$�O�Y���h  �G,= E�A�V��`���Fh!O��r#%@F��G����h!O��r#@F�G 8`���P�x�$�����9@@8`@��@,P@�@4`@ -��AFfh�h
F��1x)��^� ��!1p�X�(xpphx�phhp`�h�`�h�`(i0a(}0uh}pu�}�u�i�a(0whpw�O�CFF��(Q�w��)Q�� �3cubuc�b�c��,P��-Pxh��� F�`� F��`�8h��xh�n��b�5p��,FE�hF�.��8{"J��hkF�|�h�hF�u��I8ijF�����x0���)F���H0apx0���)F��H�`hF�����PI���p
"kF�t��i�i�<���
J�h!#F�/� F������F�y*_<W<.Q;-��O�F��`0h��Pl��0�Gd�kjl(l��oF��	4��	�x	tӱ���! XF��\`�B��d@F!F���k�ca��!��@FIF�%�W�)��@F�u���-�c�(L�� �c�!��C��
 �O�
TF�k[�c��@F!�X�0hDh������(k@(chk@hc�k��!�j��0hDh" )�B`̿O� 
�F@FQF�4��� �Eȿ�FIF@F����w@F��rj�@F!F�G�	өji�F@F�1��b8���  YF�\@F��B�����l=-��GFnh���7x��k�O��0����1c$�wtc��<	�J��FiFHF���(�PF�����1kp0ksk�0c�pc��pxrk1k(��1c��h(F�GrkFY�c��k@�pc���k@��`�cPF�����p�j�px��wh��
���-i�qkY��kI��c����p�F�pk������qh��(F��(�дc(F!F��(��8F�/�'qk0k�w@0c�������-a�qkQ��kA��c���!����� F������-��GHL���(v�>N'<H�|���psh���Ph��1�����hF��%��kF��P2I�*F���0I�0kF*F���.I�TkF�F*F����h8F�G����(H2}�x(Nh��Z"���ф��p��к�к�� ���Hhh �G(�0h2!����
���� ������O�zqB�q0h����HF�-�HF��@Fh��(F��� �����	@X>W0U&5 �� �?P -��G�
F@H���h�F�(3�h�HF��AB�Q�"@��Q)(�!��h'C���A@((� IFQ� @'��/�)
,�&IO�AC��0$I�Y�@G��Q���$��g������ �Y!�AC�Q��b*(�"IF(1Q�"C����O��C8h9�!F���p� ���),�O��!
I"F!�!���O��0��� ����=@����� �g�>-��OFF_���0$�:HF@���9LO���@Y�@��9@�C��c��!C���/�`��� C��� ��� �0�$�4D�$�$�4D��$$HO�

������g�IF#
m+p"jp!�p��LRF��
�� ��
B�_�	��
$���P�8
��D�14�!)�� �CC���������
$���P�H�������`�� `@ @-��C����ܐ�F���(c������F�(X��*���.MF(h�� F�x��B�(h�!����(I6�|LF��h�B8��1F�����E� ��j����-�8	)�L��  h�hH�GF.��Hy	�&�F
h"��F
hB�
`�1
hB�
`(h�i  �G
L/h h�k�G  ` h���@F�e����� � X>�@@�!@, 	@-��AFH�9N.4� ���B@��-'��l%B�$%1Hh�G0Hhs�.�.�.K!�`>`�#C`!`�Ch���� F˱�4�C�B���d���B��h:!�q�Bٛh+���+�@Fh�G ���F�D��B��h�<$� �`Y8�@� `F�s� F9F�)�@Fh�G����x t | H ���L
	�5I"��m�����u� !���� !��hF�d� �� �� �� ��O��0� iF�w�
�
����
��"��
��"��
��"�� �I��B��(�Ih@`
�"��|��@�I��B��Hhd(��O�@�L���Hallo0�Hallo1�Hallo2�Hallo�Fp>��� ��f�4Hh�G3J?F�B	�hF!�A��B���$h,I%�)D�4�!9R�B8�#&N�B?�h=�� h@(�$�h@(�#� F�j��F�f�|�+�9h!��8hh �!�	1<F� hC�9h �!�	1F�9hh �!�"�	�� ` F��0h�G���Ft H x -��GF}h�h�F�F�+��F0hk�q(x��HF���W���p���$�w�� �lb1hk@�pcHF����)�d�AF8F����)�b��8FAF����xй�h����豬b �w1F(F���)"����2h�kA� �c���x� F����h�����hj���8FAF�� �b1F�w(F�h�HF��O��0���pG-��O(F�FFN����F����������(!�DF& F�y�4v��%I %N`%K0`$`IphF�o�IFF� kFJ	h�����PFpXF�B��M�h���?�,� ����$8F�J�.����.|a����i&8bEF~b���`8F�����F� � 4 , ):�>( 0 , *J-��A�F$��0`#Hh/��'I"M� (`h��S�K@��p `H���1�hJ����p�@����O�6��`O�W���hh0F�G���Bh1F@F�G����h0F�G����h �G@ (`N4`����"C`@Vb@@	@8P1�@�?P�`B-�CF����F'H"���Iϲ/���p?�%I�J�x�F4���	�O�P��u����iF�G(hAk@F�G(������ �G�O�U���jF�G����j@F�G���k@F�G
I `	Ih����?(�����HF�Z� �调 ( `( @=��F��&MFq���B(��� >�"L�&x�?(�����d�6���	�O�P��u���Ai F�G(hAk F�G(������ �G�O�U����i F�G���Aj F�G����j F�GI `Ih���8F��� �� =( `( @-��AF
FF��6�$L�F x(�hF��� !kF J���=�g`�8�  p@F�����0x8pph�`O�3�`${aJ<a�h#F&0F��%F�x`1F��� ��0xh�(��xh�0����8F������F� �8@BH8�h���?�$�%�$H$KJ%!8`�\K`h`�l�GHh �Hh F��p�HI`L
ho�[BD�`Ih��0(�
hH@@�2
``Ih(��8�P"C��(C C�!@H @9	@����hB�`B`@-��G��&LF`<���!��O�	O��j���P�����j����Fi��B,�8F�'�GF�HF)F�H��F�B���d��F���(�@F)F�9�F���?������B8�)����A��������bWF����8F�������FX �� �M�E��4�"O9i�>a�������0F�
�8iO��1���8xh�����Ix`���"�   @�+��L�h&�!h�HY��IY������h�B�`h)X����v�h�B�� 8p8i������F� e3�>-��A���$M!N�F��xH�4F�h �GF ��w���g��	�H<8h�hH4!"#�G�����4F �h��� �GF ������h �G
�Hh2!�����!05(F��(F��@F�Y����X>�@�  �-��AF�. @�"LO��1�(�F�,�0x�(�"h!�(ЂB*�((�����P�I�!�(�� 8`x`�`0x�(�%�(�(
�{h������pC	Ix`2h8F����(���'@F�N�8F����F�g -��O"L����O�
&��x��/�!h��|� %B�@����5F��XF�1�FXF�� � h
��C ` xb8j�i���=b����i�h9i�G���xj(�~b h�@Fh(��Hp����0 ( , � 4 0�"L x��
(<�� �� �b%���P���������������PhF��O��0jFI��,��� f����`h�I��h�����������������`� iI%p����`�0�� ��;@B*J�_��у"�*�p�:x�x�:��p�28�*,�*�*$��������*В"�xpI@R"Ћ���у�����C���
��p
Cp
�p
�p���xpI@R��`FpG-��AF"IF#��(
:FhF�h�/����?�hF���E�L%�F  p
�@F���ph��G`x��M�ep�2��F�h8����?��hF��(���h%p(�O��5��h@�`@F���hF�E�(F
�����Fo-h ���hFh h�2�!h H�k@�c@��q hMAd�� )\��!@�yC!hHchF���1� h�ijq��iC��+kC����!h�j@��b!hk@�c�}'�(��}�(��k@�@@c���F
���`=��Eh�h#I`}�}��
@�@� }'�*A��O���}�*�?��}�}C�@�@� �!M� �TiF���(f(�8�a}"���(n!}"����}8F�)��}�*�@�(n"���(n�}"��� ������B��B�! pG+�*�! +�*��C�C�J��FFFF !���� .����� 6���� /����� 7��� '���%B�@>�%��<C�@�B��B�R�A@AIAmE��udv���-��AFth�h�$��F�jX�(h�i		�k@
�@F��������p���'@F�b����}8F�)��}�)�� F)F�����*h�k!� �c*hk!�qc���)�8�`j!j	!b#ibj0F�G���p�Fth�h n�G�)hH�k@�c  p0F����0F���)h�j ��b)hH
k@chh�����|�W�����x�������`x���������p����h���p�
���������F��LF���&(є������!�!��jC�j�����B�&�h�h.u	�`���	�B��hF����.�����h�` (u���)����8F����� 8�FF�]�"h�k!� �c�
�(n!}"���(n!}"���(n!}"��(n�}"���x(���O��1�����!h�i	��(n!}"���} �)��}�*��(n"��8�-��GL�F
F@< F���O��6O�	�FF!�<F F���F }(Ѹ���h�B�#i+������h��`�i�i�G }(��h@�B���E��0F����FX ��FFF+��hF��oFxh���(�� x`HAh�B�yh�)�u`��`8h
I�` F4`��9y F�]�8z0�Hhi F�G�&0F���4�, ��LF$ h'�Hhh�GI�� �B����o��q�B,�'���B�
h�����(�� @�@O��p��B8������F�8 0	@-��C�F�q�MLO&�F�`��`�jj �G����  `8hh#! �G	H`T� �� @�0D�@F.`�������� 	@�$C$CH�hh �G(!�(�(�Hh��P(�(�A�22"�O�zrI
L	hL4 F������� F��v���Q���N� ������?P�  p�F0hF �	)%�H9�!�3(�`�4� 8I@�B�(h@�(F���h)h �!�	1`F���4hD�4`p�H 8�O�U���h �G("�����hH4!"#�G(� �����������j�G
J	L�hh�`������B(�` 8��F�@@B ��L���'�Hx`������)�!���'�:�� �� ��� ����	JhH�	I@ �``'�a ����� ���F m>�@,P@(��'�Hhh �G( ���L!��p����	�Hh2"�����F<�0���09F���0�������� ���F��  H��h?�I�h�S�!�Jh��Hh��h	h�O�A����q
ѹB
�8�@��8�@��B� �`���F(P	@�?P	@-��AF�L h���B�-� ����(O��1�F������4 h`�yh �@'`2FCIx`8F�,�$�$@F��� F����F�g p�F���Fpj(�$qiHtb��1F�g�qiH�@h!C`L x(	�
Hh(�	Hh��  p(F�S�p��F� ( 4 , , ���F@��t�;"�H@�[�[�����R[*��X����[����/E���k0
$��`����B����>�@O�
�@�@����������F�hF�9� FM�"kF��I��x��J,!#F���M� F>��F�*� ��F���F�hhhyF���p�h�`k!k�h	!cbk(F�G���)�Z�1h�k � �c1hk �pc`j!j	!b#ibj(F�G��pGHJIx�
(�������h���Ph�����h�h�����c�h�����^�h�����Y��F� 4`@8`@8�F �Ah"�@B� 8��CA`H%����P�D	x�)��hP�!D� AH��� FO��1�k�(F8��F�g Fp�FFMh 8�@�@�o�ьh��F h������?��$ld(l@�d�d0F�c�7� Fp�!F�! ��-p���M,hF��o��&�)hzX"�"�)hzXB�"zP&�"x!�@"�"x!�@
FL#h
@�CC"`�����>� @��LF�xF
F(���L� �p��&�>F0F�Z��0x8pphx`0x(� �`� �`��`O��p�`8F���Fh p�@hFF��p���
Hjh(��i���DC
H��v`C����c0����I0F���0F��`�p��F� @BI(�(�(�(�I/(�08	"�@
�8��
hB�b�FhB�R�
hB�B
`pG�F������Flh�h���1hF�k ��`�c��p���k�8F�x��� �cak k@ c8F�n��h!kbk(F�G��pG��FF
F� �����H��qh9a�`�a�h#�a 0;u9F�J�0x�8F����8F���F� 8�
FIFd9
h�B������B� 8��z�K;h�@!�@�CC`�&� 8��Fd � @��FHh�h	h�i���I
h'��0!�)���O��q����+������!��t F�%� F������� 8�M��`Bh! �G��`h �G�(h�_����j�GL��l1<``h�G a8�� 8�
FF��ch�h�B����O��08��hI����ZC#h��T�`bi�hI�B�`8�aa���h8�8�F���F
H`
HhX�,	�L x(�Hh���  p(F��8�, ( 4 , ��HM�B�HL�B��T��U�! T��G�������FX?L?�?h?-��A�Z�M$'�Fd=�����V�$�h
�!F�G(hd䲄B�ٽ��d ����F
Hx)
�!	Op8x@�LF h�h F�G4��(F�:���� �>�>J�x#z�
Jx�B��I	KF����h�h�GFF��F� �>4>�>��
FF�W��h��!i"hQ\)pch!i�hI����ZC�!ay�`����h�����O��0��pGKp��h�Bمh
L�\$� 2!��� �� �pXhBY�B�AQp��F�>� F
H8����2h9����C� HC�aC� JC�@�#@8��P8�F���F�h�h�B��h@�`�,�@�L x(�`x(���`p(F��8�h H�0h�jF�G!��O�	���B���H0`��F� 	@|�O�V���MDh!O�@R# �(F�G���Dh!O�r	# �(F�G|��F�@8�Kh���B	�,�������0�B� 8�FF���� 8��F ��F
Jd:h�B����� �B� ��"�"H�8BT ���Fd � @p�F���
F!(F���� ��`-F�)0C��u�(4��`p���p��O�
MF���!������@$����B8�$0F��� Fp��F� ��L	K"hF�B
�"h�F2'h�L�k��#`E� ���F ���F��	K;���Iɲ���!��h!�@�C�`��� ��F 8�F��F F�`��h�V�0�aiJ �@h�C`(F��8��F( 	I� 	L` �a(4 `!hD�(H,0hj �G h�$C 	@���F
Hh��F�hB	��h:i F!�G(�O��0�?h/�� �� �	KX 0x�(
�"�@�hB�I		hQ� �G��F� �>
K�h�B�)�����0�B� �FF�M� ��F 8�F��J�h!�@�)C`���I����)� 8� ��FF��������FFG���*F��� 4��(F����Dh�hF�!kp kck@ cX`c/�(h�����?��8F����Dh�h�!j(h	x��H� jcj� b�`b��8F����HIh	����A�h�X�hIh�G����, 	HhK��	��O�h!���  pGO��0pG�FP�����I�9	hFO��0*���1	)� ��FP�FFF"FA�8��`�`Ha��� �o�� p�F�H�$�$N0h(�ШG 0`��A�p��@�Jh$���h!�h#��B�؁``�� ��Eh�hF��<��F���/� h������?�Ѱ�8���FH�0h!�� �F F�A�(F8�� p�LF`<���F)F������P���`p��FX 8�FF�o�!h�)FbhJ`ah�)F"h
`��8�K��S�"0h��� �@�@�CC`��<�O�T���Bh! �G����j�GI`� )H�!JR�h�?"�?C`pG�F@I�0�� ����)����?��O��0��~H�����������2��x� ����FP 8�FF��!!`iha`ih�)F`l`��8�p�FF
F�������I�	Bb��E�b�bp��F�a  a u�`H�a!F 0���� �i		���jK!��bk�cpG�F����8�F���FH)F��I� F�q�8��F 8�F��F x � ����  p(F�^�8�8�F��F x � ���  p(F�N�8��F��������� F����`h(���)O��(�O�zr�(�@��"FpG�FFhF�� FjF�� F�������FHhAi h�G h�����F�HhH`H�#��F� @� `d 8�FF�G�%`iha`ih`l`���8���;�I"h
`��� F��F, 8�FF�+�)jC,b���(F��_�8��HJh `�h�h�G��  	@��@���?�"@�+���?��pGJF��h��B�шh`pG� 8�F���,h!h)`!hM`�� F8��FhF�� iF��F�a������H���������F�>8�F���F(F�.� F�~�8�Hho�_ (�  pG�F��H�8h��@(��O��0pGPI���������G� I�����ɀ��4>I���?� h	�r��>0����DO���T!F(F0�8�FF �7�)F"F��(�8���������h�G�JIB� pG�F CI"������ pG�F ��Q�F��� F���Hh�x	���ͽpG� (�  I` pG`�����K���������0�!`O��3C`"rpG`B`!�`R�`aAapG������� ��������I1ɀ�pG� IA`!`pG�Fl���u�$�$ F�Hh�pG�FDP�����I`�@ H!�0ppG�F I	ɀ�pGh I�ɀ���>I1ɀ�pG� H�hk�G��(��F���� ������(�����iI	,�O��0hpG�i�	.� ` pGF
h �B� pGhBh`AhhA`pG�� �FF���Hh��ƾX ���r�pG pG���b�pG pG����P�pG(�`  pGHh��l�@ HhpG�F I�1\pG HhpG�F0 O�0H` `pG�h�i�G����l�����ĿpG@h!ppGF ����@h�0��9�@h�0��5�!upG@``pGO��0pGO��0pG0�pG}pG�`pG������#�hpGhpG��q� pG��� pGpG���� ������������������ ��$��(��,��0��4��������������Q???  @`��� �@�������� ��@�����	#�+G<i
s<%-iy<{"@����  ����������*echoing characters:
( X ��������@�����=� >���u� Q:�
(�<^"��"Ͻ
/ϱ���U
@�@Up��0Up40p��Eu9�*3G���8�)�;���> X?� `? �����X:�����������������������������������������������������������������

binary_updateable_firmware.txt

  • Hello,

    Let me make sure I understand your situation correctly:

    1. You are flashing mainthread as the "bootloader" and mainloop as the "updateable program" separately

    2. You are unable to jump from the mainthread to the mainloop, which you are trying to do with the call to jumpToPrgEntry(). You get to that function call and then nothing comes out of the uart.

    If this is accurate, I would recommend looking in memory to see if you have the correct code at the 0x8000 address you're branching to. Can you put a breakpoint there to see if that point is reached?

  • Hello Nathan! Thank you for your reply.

    1) Yes I flashed the bootloader and the updateable program seperately as .bin files using the Uniflash Tool provided by TI. The bootloader I flashed starting at address "0" and the updateable program at address 0x8000. They are two different projects. For developing the updateable program I started with the simple obeserver example and for developing the bootloader I started with the uartecho example. In the screenshot of the IDE showing my workspace you can see that, because I kept the names of the examples.

    mainThread() is the main function  of the bootloader (former uartecho example). This name "mainThread()" I also kept from the example. I don't know why it has "...Thread" in it, because as you can also see in the screenshot I took the no rtos example. So it's actually not a thread, but the mainloop of the updateable programm (let's call it the firmware) is located in a threadfunction the "simple_observer_taskFxn()" which I obviously also kept from the example.

    2)I am not jumping directly to the mainloop of the firmware but to it's start (at least I'm trying). But, if everything works fine, this should end up in it's mainloop.Yes after the the call of jumpToPrgEntry() there is nothing coming out of the uart which seems to indicate that we are not ending up in it's mainloop, because outputting on uart is what it's mainloop should do infinately in this case.

    recommendation)  here is a screenshot of the memory at 0x8000 and around it.

    At least there is something. If it is right is hard to say for me. As far as I know it is not possible to add a breakpoint there, because it is not possible to debug firmwareupdates like this in the IDE (CCS in my case), but I tested both images seperately in the IDE in debugmode before and they did what they are supposed to.

  • In addition here is the UART-output. I think that indicates that the function call is reached.

  • Additionally I have to say that this

    also doesn't work as it leads to this UART output

  • Hi Daniel,

    Is it possible you're initializing the UART twice? Once in the bootloader and once in the application? That may be the source of your problem. Additionally, you can debug your code if you follow the steps in section 4 of the OAD SimpleLink Academy Lab found here.

    Let me know if you're able to debug further with these tools/tips. If you can get the debugger working I think this should become much clearer.

    Best,

    Nate

  • Hi Nathan, Thank you for that trick. I didn't know that this is possible and I think it can be very useful. When I did so of cause I put a breakpoint at the "jumpToPrgEntry(uint32_t prgEntry)" function. After reaching it I stepped into the function  

    By single stepping I stepped to the last line of this function which is the actual jump.

    Then I did another single step and ended up with this screen.

    and when I click on the "View Disassambly" button I get this screen.

    Afterwards I was not able to track programm by breakpoints anymore. I have seen this kind of behaviour earlier in other projects for example in combination with runtime errors like writing at an not existing array index. In easy terms I would say that this  means that programm crashes at this point, but when I'm honest I can not say what this means in more precise terms. Maybe you can tell me what it exactly means and maybe you can even say what this assambler gibberish means. But I think that initializing the uart twice can not be the problem in this case, because what I interpret as a crash appears directly after jumping, but from now on I will initialize it only once to avoid having another issue.

    TYI: Like in latest test before I tried to jump to address zero, because I hope that jumping inside the bootloader image might be easier to achieve than jumping from one image to another.

  • Hi Daniel,

    Maybe you can tell me what it exactly means and maybe you can even say what this assambler gibberish means.

    As I understand it, the fault ISR is indicating to me that you're jumping to an invalid location. 

    Like in latest test before I tried to jump to address zero, because I hope that jumping inside the bootloader image might be easier to achieve than jumping from one image to another.

    Does this work? Or do you get the same fault?

    I would recommend trying to find the code you're trying to reach in the disassembly pane you've sent me, and checking to make sure it lines up with what you're expecting. You can also consult the project's .map file to see the memory contents and make sure you're jumping to where you expect.

    Best,

    Nate

  • Just jump like this:

    asm("MOV R0, #0x1234"); //Change addr
    asm("LDR R1, [R0, #0x4]");
    asm("LDR SP, [R0, #0x0]");
    asm("BX R1");

    You just have to change the address to your target firmware. JumpToPrgEntry is broken.