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.

LAUNCHXL-F28379D: Custom Bootloader works for simple code like Blinky, while the app crashes as soon as some complex RTOS etc... code is flashed.

Part Number: LAUNCHXL-F28379D

I built my custom bootloader, and It works for simple codes like blinky, and it doesn't crashes, While when I am trying to flash the Bigger data with a logic containing RTOS just crashes, the logic of how I am shifting to app is given below for reference, the CRC check matches with the data, So is the issue in jumping to app logic? JumptoApp function.c or is the binary generated by C2000 Hex Utilities itself the issue?

  • Hello,

    This thread just got assigned to me, please expect another day delay in assistance.

    Best,
    Matt 

  • Hello,

    Noted, Will be waiting for the reply.

    Best Reards,
    Smeet

  • Hello,

    What address does APP_START_ADDRESS point to? Is the bootloader executing at 200MHz? Can you also provide your application's linker command file for additional context? 

    We have also seen issues when customers use a function pointer implementation for branching. Can you try using inline assembly with the LB instruction directly to the app's codestart?

    Source: SPRU430

    Best,
    Matt

  • Hello Matt,

    Thank you for replying, I have tried the asm code 
    void JumpToApp(void)
    {
        /* 1. Disable watchdog */
        EALLOW;
        WdRegs.WDCR.all = 0x0068;
        EDIS;
       
        /* 2. Disable global interrupts */
        DINT;
       
        /* 3. Clear interrupt flags and enables */
        IER = 0x0000;
        IFR = 0x0000;
       
        /* 4. Disable PIE */
        EALLOW;
        PieCtrlRegs.PIECTRL.bit.ENPIE = 0;
        EDIS;
       
        /* 5. Clear all PIE interrupt enables */
        PieCtrlRegs.PIEIER1.all = 0;
        PieCtrlRegs.PIEIER2.all = 0;
        PieCtrlRegs.PIEIER3.all = 0;
        PieCtrlRegs.PIEIER4.all = 0;
        PieCtrlRegs.PIEIER5.all = 0;
        PieCtrlRegs.PIEIER6.all = 0;
        PieCtrlRegs.PIEIER7.all = 0;
        PieCtrlRegs.PIEIER8.all = 0;
        PieCtrlRegs.PIEIER9.all = 0;
        PieCtrlRegs.PIEIER10.all = 0;
        PieCtrlRegs.PIEIER11.all = 0;
        PieCtrlRegs.PIEIER12.all = 0;
       
        /* 6. Clear all PIE interrupt flags */
        PieCtrlRegs.PIEIFR1.all = 0;
        PieCtrlRegs.PIEIFR2.all = 0;
        PieCtrlRegs.PIEIFR3.all = 0;
        PieCtrlRegs.PIEIFR4.all = 0;
        PieCtrlRegs.PIEIFR5.all = 0;
        PieCtrlRegs.PIEIFR6.all = 0;
        PieCtrlRegs.PIEIFR7.all = 0;
        PieCtrlRegs.PIEIFR8.all = 0;
        PieCtrlRegs.PIEIFR9.all = 0;
        PieCtrlRegs.PIEIFR10.all = 0;
        PieCtrlRegs.PIEIFR11.all = 0;
        PieCtrlRegs.PIEIFR12.all = 0;
       
        /* 7. Acknowledge all PIE groups */
        PieCtrlRegs.PIEACK.all = 0xFFFF;
       
        /* 8. TI Recommended: Indirect branch through XAR7 */
        // __asm(" MOVL XAR7, #0x084000");  /* Load app address */
        __asm(" NOP");
        __asm(" NOP");
        __asm(" NOP");
        __asm(" NOP");
        __asm(" LB 0x084000");               /* Indirect branch */
       
        /* Should never reach here */
        while(1);
    }
     for jumping to application instead of the Function pointer, I have given you the code below, Which is still crashing and didn't now work. Also I have given the linker scripts of my bootloader and app are

    attached for better understanding.
    --------------------------------------------- LINKERS BELOW ----------------------------------------------------
    
    
    /*
    //###########################################################################
    //
    // FILE:    2837x_FLASH_Bootloader.cmd
    // TITLE:   Linker Command File for F28379D Bootloader (SECTORS A + B)
    //
    //###########################################################################
    */
    
    MEMORY
    {
    PAGE 0 :
       BEGIN           : origin = 0x080000, length = 0x000002
       FLASH_BOOT      : origin = 0x080002, length = 0x003FFE
    
       /* Bootloader gets LS0 and LS1 for running Flash API */
       RAMLS0          : origin = 0x008000, length = 0x000800
       RAMLS1          : origin = 0x008800, length = 0x000800
       
       RESET           : origin = 0x3FFFC0, length = 0x000002
    
    PAGE 1 :
       BOOT_RSVD       : origin = 0x000002, length = 0x000121
       
       /* Bootloader gets M1 for its Stack */
       RAMM1           : origin = 0x000400, length = 0x0003F8
       
       /* Bootloader gets LS2 and G01 for its massive Global Variables buffers */
       RAMLS2          : origin = 0x009000, length = 0x000800
       G01             : origin = 0x00C000, length = 0x002000
    }
    
    SECTIONS
    {
       codestart       : > BEGIN,       PAGE = 0, ALIGN(4)
       .text           : > FLASH_BOOT,  PAGE = 0, ALIGN(4)
       .cinit          : > FLASH_BOOT,  PAGE = 0, ALIGN(4)
       .pinit          : > FLASH_BOOT,  PAGE = 0, ALIGN(4)
       .switch         : > FLASH_BOOT,  PAGE = 0, ALIGN(4)
       .reset          : > RESET,       PAGE = 0, TYPE = DSECT
    
       #if defined(__TI_EABI__)
           .const      : > FLASH_BOOT,  PAGE = 0, ALIGN(4)
           .init_array : > FLASH_BOOT,  PAGE = 0, ALIGN(4)
           .bss        : >> RAMLS2 | G01, PAGE = 1
           .data       : >> RAMLS2 | G01, PAGE = 1
           .sysmem     : >> RAMLS2 | G01, PAGE = 1
       #else
           .econst     : > FLASH_BOOT,  PAGE = 0, ALIGN(4)
           .ebss       : >> RAMLS2 | G01, PAGE = 1
           .esysmem    : >> RAMLS2 | G01, PAGE = 1
           .cio        : >> RAMLS2 | G01, PAGE = 1
       #endif
    
       .stack          : > RAMM1,       PAGE = 1
    
       /* Bootloader Flash Functions run in LS0 and LS1 */
       .TI.ramfunc : {} LOAD = FLASH_BOOT,
                        RUN = RAMLS0 | RAMLS1,
                        LOAD_START(RamfuncsLoadStart),
                        LOAD_SIZE(RamfuncsLoadSize),
                        LOAD_END(RamfuncsLoadEnd),
                        RUN_START(RamfuncsRunStart),
                        RUN_SIZE(RamfuncsRunSize),
                        RUN_END(RamfuncsRunEnd),
                        PAGE = 0, ALIGN(4)
    
       Flash28_API:
       {
          ../F021_API_F2837xD_FPU32_EABI.lib(.text)
       }
                        LOAD = FLASH_BOOT,
                        RUN = RAMLS0 | RAMLS1,
                        LOAD_START(Flash28_API_LoadStart),
                        LOAD_SIZE(Flash28_API_LoadSize),
                        RUN_START(Flash28_API_RunStart),
                        PAGE = 0, ALIGN(4)
    }
    
    
    
    /******************************************************************************
     *
     * 2837x_FLASH_Application.cmd - Application Linker for FOTA Bootloader
     *
     * APPLICATION STARTS AT 0x084000 (Sectors C-N)
     * BOOTLOADER USES 0x080000-0x083FFF (Sectors A-B)
     *
     ******************************************************************************/
    
    MEMORY
    {
    PAGE 0 :  /* Program Memory */
    
        /* ═══════════════════════════════════════════════════════════════════════
         *  APPLICATION FLASH - Starts at 0x084000
         * ═══════════════════════════════════════════════════════════════════════ */
       
        BEGIN           : origin = 0x084000, length = 0x000002  /* codestart */
       
        /* Combined application flash: Sectors C through N */
        /* C=0x84000(8K), D=0x86000(8K), E=0x88000(32K), F=0x90000(32K), */
        /* G=0x98000(32K), H=0xA0000(32K), I=0xA8000(32K), J=0xB0000(32K), */
        /* K=0xB8000(8K), L=0xBA000(8K), M=0xBC000(8K), N=0xBE000(8K) */
       
        FLASH_APP       : origin = 0x084002, length = 0x03BFFE  /* ~240KB for app */
       
        /* ═══════════════════════════════════════════════════════════════════════
         *  RAM for Program Execution
         * ═══════════════════════════════════════════════════════════════════════ */
       
        /* Stack - use RAMM0 (safe area after boot reserved) */
        RAMM0           : origin = 0x000123, length = 0x0002DD
       
        /* RAM functions - use RAMLS3 and RAMLS4 (bootloader uses RAMLS0) */
        RAMLS3          : origin = 0x009800, length = 0x000800
        RAMLS4          : origin = 0x00A000, length = 0x000800
       
        RESET           : origin = 0x3FFFC0, length = 0x000002
    
    PAGE 1 : /* Data Memory */
    
        BOOT_RSVD       : origin = 0x000002, length = 0x000121  /* Boot ROM stack */
        RAMM1           : origin = 0x000400, length = 0x0003F8
       
        RAMD0           : origin = 0x00B000, length = 0x000800
        RAMD1           : origin = 0x00B800, length = 0x000800
       
        /* Local shared RAM for data */
        RAMLS0          : origin = 0x008000, length = 0x000800  /* Available for app */
        RAMLS1          : origin = 0x008800, length = 0x000800
        RAMLS2          : origin = 0x009000, length = 0x000800
        RAMLS5          : origin = 0x00A800, length = 0x000800
       
        /* Global shared RAM - combined regions */
        G01             : origin = 0x00C000, length = 0x002000  /* GS0 + GS1 */
        G234            : origin = 0x00E000, length = 0x003000  /* GS2 + GS3 + GS4 */
        G510            : origin = 0x011000, length = 0x006000  /* GS5 - GS10 */
        RAMGS11         : origin = 0x017000, length = 0x000FF8
    }
    
    SECTIONS
    {
        /* ═══════════════════════════════════════════════════════════════════════
         *  Code Sections - All in FLASH_APP
         * ═══════════════════════════════════════════════════════════════════════ */
       
        codestart       : > BEGIN,      PAGE = 0, ALIGN(8)
        .text           : > FLASH_APP,  PAGE = 0, ALIGN(8)
        .cinit          : > FLASH_APP,  PAGE = 0, ALIGN(8)
        .pinit          : > FLASH_APP,  PAGE = 0, ALIGN(8)
        .switch         : > FLASH_APP,  PAGE = 0, ALIGN(8)
       
        .reset          : > RESET,      PAGE = 0, TYPE = DSECT  /* Not used */
    
    #if defined(__TI_EABI__)
        .init_array     : > FLASH_APP,  PAGE = 0, ALIGN(8)
        .const          : > FLASH_APP,  PAGE = 0, ALIGN(8)
    #else
        .econst         : > FLASH_APP,  PAGE = 0, ALIGN(8)
    #endif
    
        /* ═══════════════════════════════════════════════════════════════════════
         *  Stack - CRITICAL: Must be in lower 64K for C28x
         * ═══════════════════════════════════════════════════════════════════════ */
       
        .stack          : > RAMM0,      PAGE = 0
    
        /* ═══════════════════════════════════════════════════════════════════════
         *  RAM Functions - Run from RAMLS3/LS4 (Bootloader uses LS0)
         * ═══════════════════════════════════════════════════════════════════════ */
    
    #ifdef __TI_COMPILER_VERSION__
        #if __TI_COMPILER_VERSION__ >= 15009000
            #if defined(__TI_EABI__)
                .TI.ramfunc : {} LOAD = FLASH_APP,
                                 RUN = RAMLS3 | RAMLS4,
                                 LOAD_START(RamfuncsLoadStart),
                                 LOAD_SIZE(RamfuncsLoadSize),
                                 LOAD_END(RamfuncsLoadEnd),
                                 RUN_START(RamfuncsRunStart),
                                 RUN_SIZE(RamfuncsRunSize),
                                 RUN_END(RamfuncsRunEnd),
                                 PAGE = 0, ALIGN(8)
            #else
                .TI.ramfunc : {} LOAD = FLASH_APP,
                                 RUN = RAMLS3 | RAMLS4,
                                 LOAD_START(_RamfuncsLoadStart),
                                 LOAD_SIZE(_RamfuncsLoadSize),
                                 LOAD_END(_RamfuncsLoadEnd),
                                 RUN_START(_RamfuncsRunStart),
                                 RUN_SIZE(_RamfuncsRunSize),
                                 RUN_END(_RamfuncsRunEnd),
                                 PAGE = 0, ALIGN(8)
            #endif
        #else
            ramfuncs        : LOAD = FLASH_APP,
                                 RUN = RAMLS3 | RAMLS4,
                                 LOAD_START(_RamfuncsLoadStart),
                                 LOAD_SIZE(_RamfuncsLoadSize),
                                 LOAD_END(_RamfuncsLoadEnd),
                                 RUN_START(_RamfuncsRunStart),
                                 RUN_SIZE(_RamfuncsRunSize),
                                 RUN_END(_RamfuncsRunEnd),
                                 PAGE = 0, ALIGN(8)
        #endif
    #endif
    
        /* ═══════════════════════════════════════════════════════════════════════
         *  Data Sections
         * ═══════════════════════════════════════════════════════════════════════ */
    
    #if defined(__TI_EABI__)
        .bss            : >> RAMLS5 | RAMLS1 | RAMLS2 | G510,  PAGE = 1
        .bss:output     : > RAMLS0,     PAGE = 1
        .bss:cio        : > RAMLS5,     PAGE = 1
        .data           : >> G510,      PAGE = 1
        .sysmem         : > RAMLS1,     PAGE = 1
    #else
        .ebss           : >> RAMLS5 | G01,  PAGE = 1
        .esysmem        : > RAMLS5,     PAGE = 1
        .cio            : > RAMLS5,     PAGE = 1
    #endif
    
        /* ═══════════════════════════════════════════════════════════════════════
         *  FreeRTOS Sections
         * ═══════════════════════════════════════════════════════════════════════ */
       
        .freertosStaticStack  : >> G01 | G234,  PAGE = 1
        .freertosHeap         : >> G234 | G510, PAGE = 1
    }
    
    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */
     Also I have define the macro as follows, #define APP_START_ADDRESS 0x084000UL. And yes I have confirmed that the bootloader is working at 200 MHz.

    I hope the provided data helps you understand the problem better and I will be looking forward to listen from you.

    Thank you,
    Warm Regards,
    Smeet Brijesh Bathani

  • Respected Matt,

    Just a follow up, Its been 2 days since we connected, Is this chat still on?

    Thank you,
    Smeet Brijesh Bathani

  • Hello,

    Note that TI only provides support on E2E on business days (Monday - Friday).

    Thank you for trying that, the linker command file / jumping mechanism generally looks okay to me. I will note if there any timers/peripherals used by the bootloader (like SCI or CAN), it is best practice to reset or de-initialize them before jumping to avoid unexpected state behavior in the application. Can you also confirm there is enough space allocated for the stack?

    Best,
    Matt

  • Hello Matt,

    I have already done the below iterations :-
    1. Reset/deinit all the peripherals used.
    2. Function pointers, assembly code, software reset, watchdog reset to go to the new app but It didn't work.
    3. I have given almost all the memory available to the App project which can be seen in the linker I sent you.
    4. I have also tried hardware power reset instead of software or function pointers to execute the app. but it crashes. 

    will C2000 Hex utilities be generating the .bin file correctly, right?

    I would strongly like to suggest us to meet on a Teams call or Gmeet or something which can help solve the problem faster.

    Warm Regards,
    Thank you,
    Smeet

  • Hi Smeet,

    For the linker allocation in the RTOS application

    The stack sections must be in the lower 64Kb since the stack pointer is limited to this range. If there are any dynamic tasks, the heap will also have the same restriction. You can define configAPPLICATION_ALLOCATED_HEAP and manually place the heap object in this range.

    Apart from this, I don't see any reason why the RTOS app should behave differently from the baremetal app after loading, provided it runs fine standalone. Let me know if you see any changes.

    Regards,

    Arnav 

  • Hello Arnav, 

    The issue I faced is not just with the RTOS project, Below given simple code crashed too.

    void main(void)
    {
        // FIRST thing - blink BEFORE any stack usage
        EALLOW;
        GpioCtrlRegs.GPADIR.bit.GPIO31 = 1;  // Set as output
        EDIS;
       
        volatile uint32_t i;
        for (i = 0; i < 10; i++) {
            GpioDataRegs.GPADAT.bit.GPIO31 = 0;  // LED ON
            volatile uint32_t j;
            for (j = 0; j < 500000; j++) { asm(" NOP"); }
            GpioDataRegs.GPADAT.bit.GPIO31 = 1;  // LED OFF
            for (j = 0; j < 500000; j++) { asm(" NOP"); }
        }
        InitSysCtrl();
        InitGpio();

        memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
       
        EALLOW;
        WdRegs.WDCR.all = 0x0068;  /* Disable watchdog */
        EDIS;

        // --- GPIO Setup ---
        GPIO_SetupPinMux(31, GPIO_MUX_CPU1, 0);
        GPIO_SetupPinOptions(31, GPIO_OUTPUT, GPIO_PUSHPULL);

        GPIO_SetupPinMux(34, GPIO_MUX_CPU1, 0);
        GPIO_SetupPinOptions(34, GPIO_OUTPUT, GPIO_PUSHPULL);

        GPIO_SetupPinMux(1, GPIO_MUX_CPU1, 0);
        GPIO_SetupPinOptions(1, GPIO_OUTPUT, GPIO_PUSHPULL);

        GPIO_SetupPinMux(2, GPIO_MUX_CPU1, 0);
        GPIO_SetupPinOptions(2, GPIO_OUTPUT, GPIO_PUSHPULL);

        GPIO_SetupPinMux(11, GPIO_MUX_CPU1, 0);
        GPIO_SetupPinOptions(11, GPIO_OUTPUT, GPIO_PUSHPULL);

        GPIO_SetupPinMux(14, GPIO_MUX_CPU1, 0);
        GPIO_SetupPinOptions(14, GPIO_OUTPUT, GPIO_PUSHPULL);

        uint16_t arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
        uint16_t data = arr[5];

        uint16_t a = 1;
        uint16_t b = 1;
        uint16_t c = a + b;

        if (c == 2){
         
        while(1)
        {
            // Toggle First Group
            GpioDataRegs.GPATOGGLE.bit.GPIO31 = 1;
            GpioDataRegs.GPATOGGLE.bit.GPIO1 = 1;
            GpioDataRegs.GPATOGGLE.bit.GPIO2 = 1;
           
            // Slow Delay (approx 500ms)
            DELAY_US(500000);

            // Toggle Second Group
            GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1;
            GpioDataRegs.GPATOGGLE.bit.GPIO11 = 1;
            GpioDataRegs.GPATOGGLE.bit.GPIO14 = 1;
           
            // Slow Delay (approx 500ms)
            DELAY_US(500000);
        }
        }
    }
    --------------------------------------------------------------------------------------------------------------


    This above code doesnt work when I use FOTA but the simplest blinky code given below works fine with the FOTA.


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

    #include "F28x_Project.h"

    // Red LED is on GPIO 34 (Port B)
    void main(void)
    {
        InitSysCtrl();
        InitGpio();
        EALLOW;
        WdRegs.WDCR.all = 0x0068;  /* Disable watchdog */
        EDIS;

        // Setup Red LED (GPIO 34)
        GPIO_SetupPinMux(34, GPIO_MUX_CPU1, 0);
        GPIO_SetupPinOptions(34, GPIO_OUTPUT, GPIO_PUSHPULL);

        while(1)
        {
            // Toggle GPIO 34 (Port B uses GPBTOGGLE)
            GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1;
           
            // Slow Delay (approx 500ms)
            DELAY_US(500000);
        }
    }


    Also the solution you gave didn't work too.
    Can you think of something else, or we can always meet over a Gmeet or Teams call to solve it faster.

    Warm Regards,
    Thank you,
    Smeet
  • Hello,

    Thank you for the additional details.

    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);

    InitSysCtrl() already performs a memcpy() for the ramfuncs, so that extra copy wouldn't be necessary. I don't think this would cause any fatal errors though.

    A few things to also check:

    • Are you using the same linker command file for both application versions (simple vs simplest LED blink)? 
    • Are you re-initializing the PIE control registers and PIE vector table to default in the next application? See general flow for main() below.
    • Can you double check that your flash programming data buffer is 128-bit aligned? 

    void main(void)
    {
    
    //
    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the F2837xD_SysCtrl.c file.
    //
        InitSysCtrl();
    
    //
    // Step 2. Initialize GPIO:
    // This example function is found in the F2837xD_Gpio.c file and
    // illustrates how to set the GPIO to it's default state.
    //
        InitGpio();
    
    //
    // Step 3. Clear all interrupts and initialize PIE vector table:
    // Disable CPU interrupts
    //
        DINT;
    
    //
    // Initialize the PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    // This function is found in the F2837xD_PieCtrl.c file.
    //
        InitPieCtrl();
    
    //
    // Disable CPU interrupts and clear all CPU interrupt flags:
    //
        IER = 0x0000;
        IFR = 0x0000;
    
    //
    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    // This will populate the entire table, even if the interrupt
    // is not used in this example.  This is useful for debug purposes.
    // The shell ISR routines are found in F2837xD_DefaultIsr.c.
    // This function is found in F2837xD_PieVect.c.
    //
        InitPieVectTable();
    
    
    //
    // Step 4. User specific code, enable interrupts:
    //
    
    
    //
    // Step 5. Enable global Interrupts and higher priority real-time debug events:
    //
        EINT;  // Enable Global interrupt INTM
        ERTM;  // Enable Global realtime interrupt DBGM
        
    }

    is the binary generated by C2000 Hex Utilities itself the issue

    What arguments are you passing to the hex utility?

    Best,
    Matt

  • Hello Matt,

    Apologies for the delay, We were busy trying other ways to solve the issue.

    To answer your questions, 

    1. Yes, both the projects have the same linker script.
    2. For the blinky project I have just disabled the interrupts.
    3. Yes, my flash buffer is 128-bits aligned.

    Thank you,
    Best Regards,
    Smeet

  • Hello,

    No worries, thank you for checking on that.

    I discussed this issue with the PIE expert, and they mentioned that the order of configuring PIE/CPU interrupts can be troublesome. Can you try the following jump code? I move the IER/IFR clearing until after the PIEACK bits are cleared to match TI example code.

    void JumpToApp(void)
    {
        /* 1. Disable watchdog */
        EALLOW;
        WdRegs.WDCR.all = 0x0068;
        EDIS;
       
        /* 2. Disable global interrupts */
        DINT;
       
        /* 4. Disable PIE */
        EALLOW;
        PieCtrlRegs.PIECTRL.bit.ENPIE = 0;
        EDIS;
       
        /* 5. Clear all PIE interrupt enables */
        PieCtrlRegs.PIEIER1.all = 0;
        PieCtrlRegs.PIEIER2.all = 0;
        PieCtrlRegs.PIEIER3.all = 0;
        PieCtrlRegs.PIEIER4.all = 0;
        PieCtrlRegs.PIEIER5.all = 0;
        PieCtrlRegs.PIEIER6.all = 0;
        PieCtrlRegs.PIEIER7.all = 0;
        PieCtrlRegs.PIEIER8.all = 0;
        PieCtrlRegs.PIEIER9.all = 0;
        PieCtrlRegs.PIEIER10.all = 0;
        PieCtrlRegs.PIEIER11.all = 0;
        PieCtrlRegs.PIEIER12.all = 0;
       
        /* 6. Clear all PIE interrupt flags */
        PieCtrlRegs.PIEIFR1.all = 0;
        PieCtrlRegs.PIEIFR2.all = 0;
        PieCtrlRegs.PIEIFR3.all = 0;
        PieCtrlRegs.PIEIFR4.all = 0;
        PieCtrlRegs.PIEIFR5.all = 0;
        PieCtrlRegs.PIEIFR6.all = 0;
        PieCtrlRegs.PIEIFR7.all = 0;
        PieCtrlRegs.PIEIFR8.all = 0;
        PieCtrlRegs.PIEIFR9.all = 0;
        PieCtrlRegs.PIEIFR10.all = 0;
        PieCtrlRegs.PIEIFR11.all = 0;
        PieCtrlRegs.PIEIFR12.all = 0;
        
        /* 7. Acknowledge all PIE groups */
        PieCtrlRegs.PIEACK.all = 0xFFFF;
       
        /* 3. Clear interrupt flags and enables */
        IER = 0x0000;
        IFR = 0x0000;
        
        /* 8. TI Recommended: Indirect branch through XAR7 */
        // __asm(" MOVL XAR7, #0x084000");  /* Load app address */
        __asm(" NOP");
        __asm(" NOP");
        __asm(" NOP");
        __asm(" NOP");
        __asm(" LB 0x084000");               /* Indirect branch */
       
        /* Should never reach here */
        while(1);
    }

    Best,
    Matt

  • Hello Matt,

    The above code you provided, Didn't work.
    But I have another observation which might help us understand the problem better.

    The simplest blinky works, but when the write to toggle led logic is in the function and then calling it in the while(1), it crashes. Does it has anything to do with Stack initialisation or something? Or maybe if something with _cinit ?

    #include "F28x_Project.h"
    
    void led(void)
    {
        // Toggle GPIO 34 (Port B uses GPBTOGGLE)
            GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1;
            
            // Slow Delay (approx 500ms)
            DELAY_US(500000); 
    }
    
    // Red LED is on GPIO 34 (Port B)
    void main(void)
    {
        InitSysCtrl();
        InitGpio();
        EALLOW;
        WdRegs.WDCR.all = 0x0068;  /* Disable watchdog */
        EDIS;
    
        // Setup Red LED (GPIO 34)
        GPIO_SetupPinMux(34, GPIO_MUX_CPU1, 0);
        GPIO_SetupPinOptions(34, GPIO_OUTPUT, GPIO_PUSHPULL);
    
        volatile uint16_t x = 0;
    
        while(1)
        {
            led();
        }
    }


    Thank you,
    Best Regards,
    Smeet

  • Hello,

    That is unusual. Can we check the following:

    1. Do you have the symbol "_LAUNCHXL_F28379D" defined for your project? This is important for the clock settings used by InitSysCtrl()
    2. When you call DELAY_US(), the argument '500000' may overflow depending on how the macro evaluates it. Use the 'UL' suffix to force unsigned long arithmetic
    3. Please also try increasing the stack size in the project properties:

    Best,
    Matt

  • Hello Matt,

    Sorry for the delayed reply, we were trying to solve the issue and found out the TI Hex utility tool was unable to generate the proper binary file. We generated the Hex file from the Hex utilities and then a python script converted it to the binary and this works properly without crashing.

    I think this information will help you as well. You can close the thread as the problem is resolved. 

    Thank you for you help and efforts.
    Warm Regards
    Smeet Brijesh Bathani

  • Hello,

    Thank you for providing the resolution to help others, I appreciate it a lot!

    Best,
    Matt