Title: Message
Does this version of ARM/Linux support the "/proc/cpu/alignment" pseudo-file?  If so, you may be able to make use of it to let the kernel 'fix' mis-aligned accesses (code will run slower with the 'fix', however).
 
Here's a link that has some info on it:  http://lecs.cs.ucla.edu/wiki/index.php/XScale_alignment
 
I hope this helps.
 
- Paul
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jp_liu
Sent: Monday, November 06, 2006 8:28 PM
To: Ring, Chris; davinci-linux-open-source; hyiu
Subject: Re: RE: how to fix "bus error"?

Ring, Chris, Hello
 
thanks for your information.
 
My case is like this:
char p[8];
p++;//now p 's address is odd.
short* i = (short*)p; //bus error at here!!!
 
And I use 3rd party library, and their codes cause the "bus error" crash, I cannot fix their codes. so I want to know if have any gcc compiling option can fix it.
 
2006-11-07
----- Receiving the following content -----
Time: 2006-11-07, 01:29:36
Subject: RE: how to fix "bus error"?

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