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.

TM4C123GH6ZRB: Fault when jumping from bootloader to app

Part Number: TM4C123GH6ZRB

I am trying to update code that jumps from a custom bootloader to TI-RTOS. The code gets to the remapped vector table and starts executing code but fails when it starts up tasks. I have read people having issues with the stack pointer on FreeRtos but cannot find much issue for jumping into TI-RTOS. 

I have added to the .cfg

m3Hwi.resetVectorAddress = 0x2800;
m3Hwi.vectorTableAddress = 0x2800;

and adjusted my .cmd file to this, and added a startup.c file to make the jump. 

I tried jumping with this

#pragma CODE_SECTION (ResetISR, ".blcode")
void
ResetISR(void)
{
#if 0
// Set the vector table to the beginning of the app in flash.
HWREG(NVIC_VTABLE) = APP_START_ADDRESS;

// Load the stack pointer from the application's vector table.
//
__asm(" ldr r1, [r0]\n"
" mov sp, r1");


// Load the initial PC from the application's vector table and branch to
// the application's entry point.
//
__asm(" ldr r0, [r0, #4]\n"
" bx r0\n");

#else
//
// Jump to the CCS C initialization routine. This will enable the
// floating-point unit as well, so that does not need to be done here.
//
__asm(" .global _c_int00\n"
" b.w _c_int00");
#endif
}

--retain=g_pfnVectors

#define HAS_BOOTLOAD 1

//#define APP_BASE 0x00000000


MEMORY
{
#if HAS_BOOTLOAD

#define APP_BASE 0x00002800
#define FLASH_SIZE 0x00040000
#define RAM_BASE 0x20000000


#define CODE_HEADER_BASE 0x0003FFA0
#define CODE_HEADER_SIZE (FLASH_SIZE - CODE_HEADER_BASE)
#define APP_LENGTH (CODE_HEADER_BASE - APP_BASE)

FLASH_BL (RX) : origin = 0, length = APP_BASE
FLASH (RX) : origin = APP_BASE, length = APP_LENGTH
CODE_HDR (RX) : origin = CODE_HEADER_BASE, length = CODE_HEADER_SIZE
SRAM (RWX) : origin = 0x20000000, length = 0x00008000
#else
FLASH (RX) : origin = 0x00000000, length = 0x00040000
SRAM (RWX) : origin = 0x20000000, length = 0x00008000
#endif
}

/* 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
{
#if HAS_BOOTLOAD

.blvecs : > FLASH_BL
.blcode : > FLASH_BL
.intvecs: > APP_BASE
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH
.codeHdr : > CODE_HDR

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

#else

.intvecs: > 0x00000000
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH

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

#endif
}

__STACK_TOP = __stack + 1024;

Any

  • Found the problem, I was trying to use the remapped vectors in const memory. Once I switched this to ram it worked ok. It worked fine with just sysbios like that in the previous code I was porting but I am guessing TI-RTOS needs to remap the vectors dynamically.