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-F28377S: DELAY_US() leads to illegal ISR while running from flash

Part Number: LAUNCHXL-F28377S

hello,

I have developed an application in F28377s launchpad which includes data acquisition using an ADC. The program runs fine while running from RAM but when I tried to run it from flash the program is trapped into "illegal ISR" function. I tried to step through the program and this problem occurs when the DELAY_US(1000) runs inside the ConfigureADC() function. 

Can someone suggest a solution, please?

Thanks.

  • Lijo,

    DELAY_US() function is allocated to .TI.ramfunc section.
    Did you do a "memcpy" to copy this function from Flash to RAM before executing this function?

    Thanks and regards,
    Vamsi
  • hi Vamsi,

    Thanks for the quick response. I have added the following lines of code in the beginning of the main function:

    #ifdef _FLASH
    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
    #endif

    I thought this would suffice. I am not sure how to specifically "memcpy" the DELAY_US() function. If I am wrong, please correct me.

    Kind regards,

    Lijo
  • Lijo,

    As long as you do a memcpy before executing any of the functions that are allocated to .TI.ramfunc section, you should be fine.

    When you step in, do you see valid code in RAM in disassembly window for this function?

    Thanks and regards,
    Vamsi
  •  hi Vamsi,

    Please find attached the file. It is a snippet of my code with the disassembly window. I am not sure how to check if the code is loaded into the RAM. Could you verify if the DELAY_US() is loaded into the ram, please?

    Thanks.

    Kind regards,

    LIjo

  • Lijo,

    You sent screenshot before entering in to RAM. Step in to that function and it should go to RAM. Send a snapshot at that RAM location.

    Thanks and regards,
    Vamsi
  •  hi Vamsi,

    I did step into the DELAY_US() function but it goes into the illegal ISR function. Please find the attached screenshot.

  • Solved it! The problem was I did not have any "Predefined Symbols" (Properties--->CCS Build--->C2000 Compiler--->Advanced Options--->Predefined Symbols) for the #ifdef to check. This means that the "memcpy" inside the

    #ifdef _FLASH
    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
    #endif

    will never run and ultimately do not copy the DELAY_US to the RAM from FLASH. So I added "_FLASH" to the Predefined Symbols and solved the problem. Thanks again for your suggestions.