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.

Compiler/TMS320F28377S: Illegal interrupt when call a function by absolute address

Part Number: TMS320F28377S

Tool/software: TI C/C++ Compiler

Hi, 

Customer faced one illegal interrupt issue when calling a function by absolute address. Any comment for the issue? Thanks a lot.

Their codes A/B/C are saved into three different Flash addresses. 

A is the entry point, with C2000 peripheral drivers. 

B is the motor control code, with several functions.

C is the application code, with several functions. 

Two CCS projects are created, A+B as project 1, C as project 2. Or A+C as project 1, B as project 2. They are programmed to Flash separately. Compilers are both V6.2.4 and setting are the save, except optimization. 

After system reset, A will call the functions from B and C, by absolute address.  

The issue is like this: 

    Optimize      
Project 1 A+B O3 A calls B's function successfully
Project 2 C O3      
   
Project 1 A+C O3 A calls B's function, illegal interrupt happens
Project 2 B Disable      
   
Project 1 A+C Disable A calls B's function, illegal interrupt happens
Project 2 B Disable      
   
Project 1 A+B Disable A calls B's function successfully
Project 2 C Disable      

I'm thinking, if it is due to the long branch. 

They are using this kind of structure for 2 years. This is the first time to have the issue. Several new improvement are implemented in code B. 

Br, Jordan

  • Please show the source code, and other related details, on how calling a function at an absolute address is implemented.

    Thanks and regards,

    -George

  • George,

    After reset, code A works. It initializes the peripherals and calls two functions by absolute address. These two functions are in code B and C.

    The address of these functions are as below:

    Code A is located here:

    After reset, code A (FLASH_PUBLIC) calls M_INITFUNC_ADDR(), illegal interrupt happens. We stopped the code and PC stopped in illegal ISR.

    Resume again and few times, we found that PC will go to 3FE468, in boot rom.

    Thanks a lot.

    Br, Jordan

  • Illegal.docxAs the pictures are not seen, attached here.

    Br, Jordan

  • I considered the possibility that the absolute function call may be handled wrong.  I compiled a small test case, and I see this assembly code is generated ...

            MOVL      XAR7,#540928
            LCR       *XAR7

    This will work under all conditions.  Make sure your absolute functions calls use the LCR instruction.  

    Regarding how the problem comes and goes as you change optimization ... I suspect the problem is present all the time.  But it is sensitive to which memory locations are used in a particular order, or something like that.  Changing optimization causes memory to be used in a different way, and thus hides or exposes the problem.

    Thanks and regards,

    -George