I have a trap being hit. I assume since I can't track the PC back to any code listed in my map file that I'm going off into the weeds. But I'm not sure where. With no smarttraps enabled, I get this output in the MTTY:
When I enable smarttraps Using the following include and calls in my main.cpp, I get absolutely no indication in the MTTY that we crashed besides the fact that the unit rebooted.
Look up the status register values you see. I believe 2004 means you are in irq 4. Access Error means your program is off in the weeds and is trying to access a memory address that is not mapped to any chip select.
I'm not so much worried about the trap... That I'm sure I can track down. I'm more worried that the smarttrap stuff isn't working as I would expect, or that the documentation shows. Since I only added a small chunk of code, I know that is the root of my issue. But I figured I'd use this to try out the smarttrap stuff.
So, I'm more worried about why, when the smarttrap code is enabled, why there is no indication that a trap occurred?
Adding to Paul's idea, if you're a C++ guy you also have to be careful about non-local static objects (NLSOs). They're really just another form of a global but it's easy not to think of them that way, plus I was surprised (because I hadn't really thought about it) when I learned their constructors get called before UserMain. I described the issue in a little more detail on the wiki a while back.
No, based on the messages printing out in the MTTY, I can tell that UserMain runs, my tasks get started and we run for at least a minimal amount of time before the trap.
So, is there some magic order that things have to be done in for the smartrap code to work?