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.

CCS/EK-TM4C1294XL: boot_demo1 with uart interrupt handler function aren't working as expected

Part Number: EK-TM4C1294XL

Tool/software: Code Composer Studio


i have cloned "boot_demo1" example and made the following changes:
1. removed the usage of SW1 button
2. added UART interrupt handler which receives and responds to commands from UART
3. added led blinking

the purpose is to make a program that blinks and waits for UART commands and executed them. these are the major commands i want to support:
1. led blink on
2. led blink off
3. enter boot loader mode

the way i'm testing this is by using LM Flasher to program the device with my "boot_demo1" to address 0x4000 right after programming "boot_serial" example through USB connection.

i have the following problem:
in order for the original boot_demo1 to work for me, i had to change "boot_demo1_ccs.cmd" and have the following:
        #define APP_BASE 0x00004000
        FLASH (RX) : origin = APP_BASE, length = 0x000fc000
    instead of these lines:
        #define APP_BASE 0x00000000
        FLASH (RX) : origin = APP_BASE, length = 0x00100000

but by using the first two lines, the UART interrupt handler and the LED blink are not working - the LED doesn't blink and UART commands are not processed.
by using the second two lines, they're both working fine, but the boot loader code triggered by a UART command "boot" is not working (the call to "JumpToBootLoader" function) and i am not able to upload a bin after this command.

see my uart interrupt handler function below - what is the correct way to make both uart listener and boot loading work?

-----
void UARTIntHandler(void)
{
    uint32_t ui32Status;
    ui32Status = ROM_UARTIntStatus(UART0_BASE, true);
    ROM_UARTIntClear(UART0_BASE, ui32Status);
    char b[5];
    int i = 0;

    while(ROM_UARTCharsAvail(UART0_BASE))
    {
        b[i] = ROM_UARTCharGetNonBlocking(UART0_BASE);
        i++;
    }
     if (strstr(b, "boot"))
    {
        char* response = "OK";
        UARTSend(response, strlen(response));
        JumpToBootLoader();
    }
    else if (strstr(b, "blinkon"))
    {
        shouldBlink = true;
        char* response = "OK";
        UARTSend(response, strlen(response));
    }
    else if (strstr(b, "blinkoff"))
    {
        shouldBlink = false;
        GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0);
        char* response = "OK";
        UARTSend(response, strlen(response));
    }
    else
    {
        char* response = "OK";
        UARTSend(response, strlen(response));
    }
}
-----
   

  • Hi,

    The cmd file for boot_demo1 should not start at 0x0. the boot_demo1 example as shipped should start at 0x00004000. Of course, you can change the APP_BASE address. The boot_serial is the bootloader that needs to reside at the 0x0.

    Please reference the below cmd file.  Note the .vtable section allocation which should remap the vector table to 0x20000000.

    /******************************************************************************
     *
     * boot_demo1_ccs.cmd - CCS linker configuration file for boot_demo1.
     *
     * Copyright (c) 2015-2017 Texas Instruments Incorporated.  All rights reserved.
     * Software License Agreement
     * 
     * Texas Instruments (TI) is supplying this software for use solely and
     * exclusively on TI's microcontroller products. The software is owned by
     * TI and/or its suppliers, and is protected under applicable copyright
     * laws. You may not combine this software with "viral" open-source
     * software in order to form a larger program.
     * 
     * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
     * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
     * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
     * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
     * DAMAGES, FOR ANY REASON WHATSOEVER.
     * 
     * This is part of revision 2.1.4.178 of the EK-TM4C1294XL Firmware Package.
     *
     *****************************************************************************/
    
    --retain=g_pfnVectors
    
    /* 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.                      */
    #define APP_BASE 0x00004000
    #define RAM_BASE 0x20000000
    
    /* System memory map */
    
    MEMORY
    {
        /* Application stored in and executes from internal flash */
        FLASH (RX) : origin = APP_BASE, length = 0x000fc000
        /* Application uses internal RAM for data */
        SRAM (RWX) : origin = 0x20000000, length = 0x00040000
    }
    
    /* Section allocation in memory */
    
    SECTIONS
    {
        .intvecs:   > APP_BASE
        .text   :   > FLASH
        .const  :   > FLASH
        .cinit  :   > FLASH
        .pinit  :   > FLASH
        .init_array : > FLASH
    
        .vtable :   > RAM_BASE
        .data   :   > SRAM
        .bss    :   > SRAM
        .sysmem :   > SRAM
        .stack  :   > SRAM
    }
    
    __STACK_TOP = __stack + 1024;

  • Hi - thanks - i've found the problem - i used a serial writer which was holding the COM port (the application i used in order to send the "boot" command) that's why the UART configuration failed.
  • Glad your problem is solved.