I resolved a "Bus error" recently in one of the Codec Engine examples (examples/apps/speech/linuxonly).  I can tell you what I was doing wrong and my solution - perhaps it's similar to your situation and can be solved similarly.
 
The example had declared data buffers as static global arrays of UInt8's, like this:
 
static XDAS_Int8 inBuf[IFRAMESIZE];
When constructing a pointer to those buffers, it was mis-aligned, and when these pointers were dereferenced, I got the "Bus Error" crash.
 
I changed my code to malloc() the buffers rather than create them statically; malloc() returns buffers appropriately aligned.
 
[ For extra credit, I actually used Codec Engine's Memory_contigAlloc() rather than malloc().  This provided buffers which were not only aligned, but also non-cached and physically contiguous.  In this way, I could pass these buffers to "remote", DSP-side codecs. ]
 
I think you'll have to provide more details for us to assist you further.  I don't know what your particular use case is.
 
Chris


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jp_liu
Sent: Saturday, November 04, 2006 10:52 PM
To: davinci-linux-open-source; Yiu, Henry
Subject: how to fix "bus error"?

davinci-linux-open-source,hyiu, Hello
 
when I run my program on dvevm, it will be crashed, and prompt "Bus error", I know it due to my program try to access odd memory address.
I want to know what compiling option can fix this error?
 
2006-11-05
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to