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.

TM4C1230E6PM: Programming problem

Part Number: TM4C1230E6PM

Hi Sir

we use TM4C1230E6PM meet above questions,need you help check it and give some suggestions,tks!

The chip encountered a programming problem, that is, how to jump from the startup code to the address of the application layer program 2000, the jump code is written in C language, without assembly. How to write jump instructions written in C language? We tried to use the common C language program jump instruction in Keil C, and the simulation will have a hardware error interrupt.

  • Hi Darren,

      I think you can such code in the TivaWare bootloader examples. The boot_demo1 example is an application that will jump back to the bootloader. Below is the code that is used to jump to the SVC vector at 0x2C  in the vector table. 

    void
    JumpToBootLoader(void)
    {
        //
        // We must make sure we turn off SysTick and its interrupt before entering 
        // the boot loader!
        //
        ROM_SysTickIntDisable(); 
        ROM_SysTickDisable(); 
    
        //
        // Disable all processor interrupts.  Instead of disabling them
        // one at a time, a direct write to NVIC is done to disable all
        // peripheral interrupts.
        //
        HWREG(NVIC_DIS0) = 0xffffffff;
        HWREG(NVIC_DIS1) = 0xffffffff;
        HWREG(NVIC_DIS2) = 0xffffffff;
        HWREG(NVIC_DIS3) = 0xffffffff;
    
        //
        // Return control to the boot loader.  This is a call to the SVC
        // handler in the boot loader.
        //
        (*((void (*)(void))(*(uint32_t *)0x2c)))(); 
    }

    If you application starts at 0x2000, below is the assembly code to jump to the application

    // Set the vector table to the beginning of the app in flash. 
      HWREG(NVIC_VTABLE) = ui32StartAddr; 
       
      // 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");