Tool/software:
I am trying to set up for the first time an ostrstream object, but it crashes the firmware to UTL_halt() when written to.
e.g. g_diagLog << "Hello World" << endl
class CDiagLog : public ostrstream { public: CDiagLog (char buffer[], unsigned int size); private: };
#pragma DATA_SECTION("ExtPgm3")
char m_logBuffer[1024] = { 0 }; #pragma DATA_SECTION("ExtPgm3") CDiagLog g_diagLog(m_logBuffer, sizeof(m_logBuffer)); CDiagLog::CDiagLog (char buffer[], unsigned int size) { memset(buffer, 0, size); }
When I trace the program execution it follows this path (with content of some of the CPU registers given at entry to the given function):
std::basic_ostream
sputn (ptr, count) -- XAR0: 0x04A044, T0: 0x0014
xsputn (ptr, count) -- XAR0: 0x04a044, T0: 0x0014
std::strstreambuf:overflow (int) -- T0:0x0046
operator new[] -- T0:0x0020
operator new -- T0:0x0020
malloc() -- T0: 0x0020
MEM_alloc() -- T0: 0x0001, T1: 0x0024, T2: 0x0024
lock2() -- XAR0: 0x040000, XAR1: 0x020000, T0: 0x0001, T1: 0x0024, T2: 0x0001, T3: 0x0000
SYS_abort() -- XAR0 : 0x40000, XAR1: 0x20001
UTL_halt()
Is there something that needs to be set up in my .tcf (main.tcf) to support strstream objects?
Thanks.