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.

MSP430FR5994: Memory violation upon a valid CALLA

Part Number: MSP430FR5994

Tool/software:

Hello,

I have (had...) a project working flawlessly with DSPLib (using LEA for FFT calculations).

I decided to move DSPLib to a static library project and link to it.

Now, during execution, at different locations into the DSPLib code now linked into my application, a memory violation is generated. 

It is a violation on a segment protected from execution.

I can always trace to the exact line that causes the violation.  It is a CALLA to a valid address (0x39xxx) well outside the protected segment where the violation occurs (0x10000-0x16000).

Weird enough, the violation is not triggered on the same CALLA everytime but always on a CALLA.  Always.

Each and everytime, the call address shown in the disassembly window, just before the violation occurs, is perfectly legal and valid.  It is actually very close to the PC since that's a call from somewhere in the lib to elsewhere into the lib.

In the NMI, I have some code that inspects the stack to retrieve the called address and the expected return address upon an execution violation. This code has been working very well for a some time so I tend to trust the retrieved data.  The called adress is 0x10000 which is the exact start of the protected segment being violated.  So, that definitely looks like a real violation.  However, the return address is absolutely invalid, way outside valid memory range.

Searching the binary file, I can find a the whole bunch of CALLA, perfectly valid, that apparently generate the violation.  However, there is no CALLA to 0x10000.  So it ought to be some indirect call ending at 0x10000...  But tracing the code always show a valid CALLA as the last instruction being executed before the NMI.  Always.

What is going on here???

It is very likely related to linking with a library but I realy can't explain nor fix it.

Regards,

Frederic

  • Since this problem cropped up after you fiddled with the DSPlib, that is your first clue. You did something that the CPU didn't like.

    Another way for execution to get to 0x10000 is an uninitialized interrupt vector. That would tell the CPU that the ISR starts at 0xfffe. 

    An actual dump of the stack frame might be more helpful than it being interpreted by your code. Which could get thrown off by something unexpected.

  • M.Schultz, you got it.  It's the uninitialized vector.  Congratulations!!

    Since I turned DSPLib into a static library, the LEA ISR was not built into my code anymore. 

    I fixed it by adding a LEA ISR in my code that calls the LEA ISR that is in DSPLib (making sure to turn the ISR from DSPLib into a normal function for the specific case of a static lib build).

    It works!

    So many thanks to you!

**Attention** This is a public forum