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.

Adding 2 c++ string objects

Other Parts Discussed in Thread: SYSBIOS, EK-TM4C1294XL

Hello

I am adding 2 c++ string objects and I get an exception error.  The add operation is as follows,

string SOAPpayload = deviceObject.deviceHeader(PayloadLength) + deviceObject.getDeviceData();

Both deviceHeader and getDeviceData return string objects.  Both methods work because I use the data earlier in the program with no issues.  deviceHeader is approximatly 250 characters long.  getDeviceData() is 814 characters long.  Below is the error message,

ti.sysbios.heaps.HeapMem: line 307: out of memory: handle=0x20004634, size=868
ti.sysbios.family.arm.m3.Hwi: line 1036: E_hardFault: FORCED
ti.sysbios.family.arm.m3.Hwi: line 1113: E_busFault: PRECISERR: Immediate Bus Fault, exact addr known, address: 00000000
Exception occurred in background thread at PC = 0x00015dfa.
Core 0: Exception occurred in ThreadType_Main.
Main name: main(), handle: 0x0.
Main stack base: 0x20003230.
Main stack size: 0x1000.
R0 = 0x00000000  R8  = 0x00000000
R1 = 0x200010d8  R9  = 0x00000000
R2 = 0x00000223  R10 = 0xa4420001
R3 = 0x453a733c  R11 = 0x400fd108
R4 = 0x6c65766e  R12 = 0x00000000
R5 = 0x2065706f  SP(R13) = 0x20003ef8
R6 = 0x6e6c6d78  LR(R14) = 0x0001d4fb
R7 = 0x20004230  PC(R15) = 0x00015dfa
PSR = 0x21000200
ICSR = 0x00000803
MMFSR = 0x00
BFSR = 0x82
UFSR = 0x0000
HFSR = 0x40000000
DFSR = 0x0000000b
MMAR = 0x00000000
BFAR = 0x00000000
AFSR = 0x00000000
Terminating execution...


I am running using CCS 6.0 and running on a Tiva EK-TM4C1294XL Launchpad.  The compiler version is v5.1.6. The program is c++.  I have a heartbeat timer clock task flashing the led every second.  Any help is much welcomed.


Best Regards,

Steve Mansfield

  • If the error messages mean what I think them to mean, HeapMem is only 868 bytes, not nearly big enough to handle the string you are trying to create.  Indeed, the first line of the exception suggests that the problem is that the program is out of memory.  Try increasing HeapMem to 4k and see if that helps.

  • Stephen Mansfield said:
    ti.sysbios.heaps.HeapMem: line 307: out of memory: handle=0x20004634, size=868

    From that part of the exception message guess that there is insufficient heap space to allocate a std::string object to contain the complete string.

    Can you try increasing the heap space allocated by SYS/BIOS?

  • Hello Chester,


    Increasing the heap space allocated by SYS/BIOS worked!  I had allocated 4096 so I just doubled it to 8192.  I just started using TI's RTOS last week so I am still new to setting up the system configurations.  I need to spend some time understanding just how RTOS allocates its memory.  Thanks for your insight and help.

    Best Regards,

    Steve Mansfield