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.

TM4C123GH6PM: bootloader Problem

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL

I am currently using the TM4C123GH6PM microcontroller to develop a bootloader. During the bootloader development process, I need to modify the flash location in the 'tm4c123gh6pm.cmd' file so that when jumping from the bootloader to the application, the interrupt vector table can be correctly accessed. I referred to the method provided on the forum and made the following changes to the addresses in the 'tm4c123gh6pm.cmd' file:

--------------------------------------------------------------------------------------------------------------------------------------------------------

--retain=g_pfnVectors

#define APP_BASE 0x00008000
#define RAM_BASE 0x20000000

MEMORY
{
FLASH (RX) : origin = APP_BASE, length = 0x00040000 - APP_BASE
SRAM (RWX) : origin = 0x20000000, length = 0x00008000
}

/* 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=rtsv7M4_T_le_eabi.lib */

/* Section allocation in memory */

SECTIONS
{
.intvecs: > APP_BASE
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH

.vtable : > 0x20000000
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM
}

__STACK_TOP = __stack + 512;

-------------------------------------------------------------------------------------------------------------------------------------------------

After I changed the flash address in 'tm4c123gh6pm.cmd', I encountered an issue. When using ROM-based API functions like 'ROM_GPIOPinRead', 'ROM_TimerDisable', etc., and running the program in debug mode, the program jumps to an address filled with 'F's when it reaches the ROM-based API functions. However, if I don't use ROM-based API functions, the program can run normally in debug mode. When I revert the flash address in 'tm4c123gh6pm.cmd' to the original address and use ROM-based API functions, the program can still run normally in debug mode. Why does this happen? If using ROM-based API functions causes issues, then converting the .c file into a .bin file for the bootloader to burn may result in the program not being executable. Is this because the interrupt vector table offset doesn't include ROM-based API functions when I change the interrupt vector table position in tm4c123gh6pm.cmd?

  • Hi,

      Did you also modify the bootloader bl_config.h file for APP_START_ADDRESS and VTABLE_START_ADDRESS to match your .cmd file? There is a stock TM4C123 application example at C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c123gxl\boot_serial. This is a serial example that resides at 0x2800 and the bootloder will download the application firmware from the serial port and program the firmware image to 0x2800. I will suggest you first run the example as is. Once it is working, you can then change the address to another location like 0x8000. 

    //*****************************************************************************
    //
    // The starting address of the application. This must be a multiple of 1024
    // bytes (making it aligned to a page boundary). A vector table is expected at
    // this location, and the perceived validity of the vector table (stack located
    // in SRAM, reset vector located in flash) is used as an indication of the
    // validity of the application image.
    //
    // The flash image of the boot loader must not be larger than this value.
    //
    // Depends on: None
    // Exclusive of: None
    // Requires: None
    //
    //*****************************************************************************
    #define APP_START_ADDRESS 0x2800

    //*****************************************************************************
    //
    // The address at which the application locates its exception vector table.
    // This must be a multiple of 1024 bytes (making it aligned to a page
    // boundary). Typically, an application will start with its vector table and
    // this value should be set to APP_START_ADDRESS. This option is provided to
    // cater for applications which run from external memory which may not be
    // accessible by the NVIC (the vector table offset register is only 30 bits
    // long).
    //
    // Depends on: None
    // Exclusive of: None
    // Requires: None
    //
    //*****************************************************************************
    #define VTABLE_START_ADDRESS 0x2800