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.

RTOS/TDA2-17: Crashing when using simple OpenCV functions

Part Number: TDA2-17


Tool/software: TI-RTOS

Hello everyone!

I am trying to use some OpenCV functions from the precompiled libraries on A15 provided with the Vision SDK, version 3.04. These functions work within the given alg-plugin examples, such as in opencvcanny. I can even modify these plugins with other OpenCV calls successfully, as long as I keep everything contained within the "cannyThreadFunc()" in alg_plugins/opencvcanny/canny.cpp

However, as soon as I try to move the OpenCV code outside of this function, it crashes with output that looks like this:

[HOST  ]     51.719971 s: Unhandled Exception:
[HOST  ]     51.720002 s: Exception occurred in ThreadType_Task
[HOST  ]     51.720002 s: Exception occured in A15 with exception type 18 
[HOST  ]     51.720002 s: handle: 0x848ab5b8.
[HOST  ]     51.720002 s: stack base: 0x848adb60.
[HOST  ]     51.720032 s: stack size: 0x100000.
[HOST  ]     51.720032 s: R0 = 0x00000000  R8  = 0x849ac670
[HOST  ]     51.720032 s: R1 = 0x00000001  R9  = 0x849adc5c
[HOST  ]     51.720063 s: R2 = 0x00000098  R10 = 0x849adc34
[HOST  ]     51.720063 s: R3 = 0x048c0010  R11 = 0x849ac53c
[HOST  ]     51.720063 s: R4 = 0x849ac6c8  R12 = 0x2000015f
[HOST  ]     51.720093 s: R5 = 0x849ac660  SP(R13) = 0x8409c430
[HOST  ]     51.720093 s: R6 = 0x849ac670  LR(R14) = 0x8a7350e4
[HOST  ]     51.720093 s: R7 = 0x3ff00000  PC(R15) = 0x8409c430
[HOST  ]     51.720093 s: PSR = 0x849adc5c
[HOST  ]     51.720124 s: DFSR = 0x00000206
[HOST  ]     51.720124 s: IFSR = 0x00000000
[HOST  ]     51.720124 s: DFAR = 0x00000010
[HOST  ]     51.720124 s: IFAR = 0x00000000
[HOST  ]     51.720154 s: Terminating Execution...
[HOST  ]     51.720154 s: 
[HOST  ]     51.720154 s:  ### XDC ASSERT - ERROR CALLBACK START ### 
[HOST  ]     51.720185 s: 
[HOST  ]     51.720185 s: E_dataAbort: pc = 0x8409c430, lr = 0x8a7350e4.
[HOST  ]     51.720215 s: 
[HOST  ]     51.720215 s:  ### XDC ASSERT - ERROR CALLBACK END ### 

This particular output was caused by multiplying two cv::mat objects inside a .cpp function that was called directly from the "AlgorithmLink_xxxxProcess()" function of a custom-written plugin. Matrix addition and certain constructors were also demonstrated to fail in a similar manner.

It seems that there are certain restrictions on how the precompiled OpenCV libraries should be used... or else they will crash the application. Does anyone know what exactly these restrictions are?

Much appreciated,
Ying

  • Update!

    It looks like the application is crashing because I am calling functions from two different threads. This explains why any links using OpenCV dedicate an entire, isolated thread to its use (see opencvcanny or opencvopencldilation, for example).

    Lesson learned: You cannot use two links that utilize OpenCV in the same chain. You will have to combine their functionality into a single link, or somehow funnel the entire chain's OpenCV usage into a single thread.

  • Hi Ying,

    Thanks for sharing your findings.

    Regards,
    Yordan