Hi All,
I'm using ndk r5 to build my own video decoder projects and met failures
calling "Bus Error".
The code is as below.
m_uiNextBits = *m_pulStreamPacket++;
m_uiNextBits is unsigned int, and m_ pulStreamPacket point to unsigned int
array.
I print the addr of the pointer and it's unaligned (0xb2ff09). I think the
error is caused by unaligned memory access, in the pipeline the pointer address
is changed before arm getting the right value so caused bus crash.
There are two ways to work around.
1. Force to be aligned memory access. Using memcpy to copy the data to an
aligned address before accessing.
2. Add some nops before changing the address.
m_uiNextBits = *m_pulStreamPacket;
__asm("nop");
__asm("nop");
...//no less than 8 loops would be ok.
__asm("nop");
__asm("nop");
m_pulStreamPacket ++;
However, I wonder if there is a better way to solve this problem without
introducing any extra CPU mips. Thanks.
BTW: I'm using the default toolchain arm-eabi-gcc with gcc 4.4.0 version.
Best Regards,
Ray
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en