Content originally posted in LPCWare by ArriaLive on Wed Aug 12 11:32:23 MST 2015
Quote:
I presume that you are testing a Debug build here? From what you are saying, it sound like your setup was working more by accident in LPCXpresso 7.4.0 than anything else. In LPCXpresso 7.4.0, the default optimisation level for Debug builds was -Og, but this was reverted back to -O0 as of LPCXpresso 7.5.0. This would explain why they are no longer being inlined.
The change from -Og to -O0 may be the culprit here. I changed all the projects in my workspace to -Og and everything compiled and ran just like the old days under 7.4.
However, I'm still troubled by that explanation. I understand the compiler looking at the code and optimizing to put some code inline where performance (or memory size) is being optimized. However, when an explicit compiler directive (such as "static inline") is included, the compiler should ALWAYS inline those functions--with any optimization level. Ignoring compiler directives is the opposite of optimization--it's unoptimizing (is that a word?). It is counter-intuitive. What's the point of the directive if it is removed by the optimization level of the compiler?
Still, if that's the issue, I'm happy to stick with -Og for now and move forward.
Quote:
I strongly recommend that you look at placing all the code from specific objects into RAM using the Freemarker linker script templates introduced in LPCXpresso 7.9.0, rather than the __RAMFUNC() macro.
I have to respectfully disagree. I've read the documentation on the Freemarker linker script (which I think is terrific, by the way--a great addition!), but in some cases it makes more sense to use the __RAMFUNC() macro. Even the documentation you reference says that when moving just certain functions, the best method is to use __RAMFUNC(). Moving that information to a linkscript somewhere creates visual separation between the function source and the RAM optimization. You have to look in two places to see what's actually going on. Seeing the __RAMFUNC() in front of the function gives you all the information in one place.
True, if I'm putting an entire file or library in RAM, the Freemarker script is a far easier way to do so, but in our case, we're trying to be very judicial about our use of RAM. In fact, we're putting these functions in RAM2, not RAM1 because we're trying to reserve RAM1 on the 4330 primarily for stack and heap, something our application uses extensively.
Quote:
Quote:
The most frustrating is that pressing the "step into" button when debugging in 7.9 actually operates exactly like the Resume button. It executes forward without stopping at the top of the highlighted function. This happens with ANY function I try to step into.
At what point do you see this? Is it whilst stepping into code that is in flash or in RAM? Does setting a breakpoint manually work?
I was seeing this problem consistently with every function regardless of whether it was in flash or in RAM. However, for some reason I cannot explain, after changing the optimization level to -Og, this problem has also gone away.
Quote:
This sounds like your code that is trying to access the SPIFI is leaving the device in a state that the flash driver cannot recover from (note that the flash drivers in 7.4.0 we based on a different SPIFI code base to 7.9.0). Does booting the board into ISP mode before starting the next debug session work?
Our target board (our own design) has pin P2_7 tied high specifically to eliminate the possibility of going into ISP mode, so that's not an option for us. But now that I'm able to actually debug some code, I have learned a little more about this issue.
Currently, if Vector Catch is turned on (which has been the normal mode for us under 7.4 to help us through the reset if clocks or memory are corrupted), I can get past any reset issues, but I get an error starting up:
Quote:
Error in final launch sequence
Failed to execute MI command:
-exec-continue
Error message from debugger back end:
Warning:\nCannot insert breakpoint 1.\nCannot access memory at address 0x14000948\n
Warning:\nCannot insert breakpoint 1.\nCannot access memory at address 0x14000948\n
This is tied to the "error reported by target":
Quote:
15: Target error from Set break/watch
Unable to set an execution break - no resource available.
This happens EVERY time vector catch is true. (Note, no breakpoints are set). When vector catch is false, I don't get the error, but I also can't get past the reset issue (should that come up) without using vector catch as true.
In 7.4, we just left vector catch on all the time to catch the reset error, but we didn't get the above errors. In 7.9, we apparently cannot leave vector catch as true.
The problem is, when we have a reset error, we must manually set vector catch to true, try to debug, get the error, power down the target, and back up again, then go change vector catch to false again, and re-debug. Those are very annoying and unnecessary extra steps in the process.
Vector Catch should not prevent the program from running. Is this vector-catch behavior unique to me as well?
Thank you again for sticking with me through this. We are, indeed, making great progress!
EdA