Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Size of bool changed in ARM platform.: (12 Items)
   
Size of bool changed in ARM platform.  
Previously we have been using QNX 6.5.0 on an i.MX31 and i.MX35 platform that both use the armle target with ARM11 cores
.  The size of a bool has been 4 bytes in this configuration.

Recently we are experimenting with a newer processors with a Cortex-A8 core that uses the armv7le target and it seems 
the bool size has changed to 1 byte.

The code we have written is not a problem, however, we are using some 3rd party libraries that specifically need the 
precise size of a bool value.  When I set the 3rd party code to use a bool size of 1 byte, I get bus errors due to the 
unaligned access on the ARM.  So I really need to find a way to set (qcc / gcc) to compile this code using a 4-byte bool
 value.

Does anyone have any input or advice on how this might be accomplished?

Thanks,
--john
Re: Size of bool changed in ARM platform.  
On 11-09-27 12:35 PM, John Edwards wrote:
> Previously we have been using QNX 6.5.0 on an i.MX31 and i.MX35 platform that both use the armle target with ARM11 
cores.  The size of a bool has been 4 bytes in this configuration.
>
> Recently we are experimenting with a newer processors with a Cortex-A8 core that uses the armv7le target and it seems 
the bool size has changed to 1 byte.
>
> The code we have written is not a problem, however, we are using some 3rd party libraries that specifically need the 
precise size of a bool value.  When I set the 3rd party code to use a bool size of 1 byte, I get bus errors due to the 
unaligned access on the ARM.  So I really need to find a way to set (qcc / gcc) to compile this code using a 4-byte bool
 value.
>
> Does anyone have any input or advice on how this might be accomplished?

The ARM EABI [1] that the armv7le variant follows requires a bool be an 
unsigned byte. Changing the ABI to use 4 byte bools would be creating an 
incompatible ABI.

[1] 
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf 


Regards,

Ryan Mansfield
Re: Size of bool changed in ARM platform.  
Thanks for the information.  I don't mind using a single byte bool, however, do you have any ideas how to get the ARM to
 allow unaligned access and not bus fault when I switch this 3rd party code to use 1 byte boolean values?

I'm trying to figure out what to do to not rewrite this library we are using.

I appreciate the advice.

--john
Re: Size of bool changed in ARM platform.  
add -ae to the procnto command-line in your image?

On 11-09-27 2:16 PM, John Edwards wrote:
> Thanks for the information.  I don't mind using a single byte bool, however, do you have any ideas how to get the ARM 
to allow unaligned access and not bus fault when I switch this 3rd party code to use 1 byte boolean values?
>
> I'm trying to figure out what to do to not rewrite this library we are using.
>
> I appreciate the advice.
>
> --john
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post89100
>

-- 
cburgess@qnx.com
Re: Size of bool changed in ARM platform.  
Colin,

Thanks for the help.  That worked and alleviated the problem.  I know that flag is the kernel emulation of unaligned 
memory access, but I thought one of the features of the new ARMs (the A8s) were hardware unaligned access.  That's why I
 was expecting it would work without the kernel flag.

Again, thanks for the help.  I'll move forward that way for now.

--john
Re: Size of bool changed in ARM platform.  
For ARMv6/v7 the -ae option enables the hardware support (SCTLR U bit).
Otherwise we default to strict alignment checking.

John Edwards wrote:
> Colin,
> 
> Thanks for the help.  That worked and alleviated the problem.  I know that flag is the kernel emulation of unaligned 
memory access, but I thought one of the features of the new ARMs (the A8s) were hardware unaligned access.  That's why I
 was expecting it would work without the kernel flag.
> 
> Again, thanks for the help.  I'll move forward that way for now.
> 
> --john
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post89102
> 
Re: Size of bool changed in ARM platform.  
Thanks for the information.  I didn't realize that the kernel always used strict alignment without that option.

I have a new problem now, that is a bit of a different topic I could open a new thread for, but I'll go ahead and pose 
it.  It's probably very simple.

I'm compiling libpng in a 6.5.0 QNX VM to get the libraries that I then include in our main code base on Windows.  When 
linking against my generated libpng libraries from the QNX VM, I get "XXX has EABI version 0, but target XXX has EABI 
version 5".  Is there a flag that I need to set in my CFLAGS to for which EABI my libpng compiles against.

Here is how I am building libpng that has always worked well in the past with the regular armle target:
1) Untar library
2) export CFLAGS="-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -mtune=cortex-a8 -O3"
3) ./configure --build=i486-pc-nto-qnx-6.5.0 --host=arm-unknown-nto-qnx6.5.0
4) make

I'm sure I'm missing a flag or option somewhere to specify the EABI to use.  I've looked all though the "QNX Neutrino 
for ARMv7 Cortex A-8 and A-9 Processors" article and can't seem to find the right combination to get this library 
compiled with.

If this needs to go in a new thread, I can move it.

Thanks again,
--john
Re: Size of bool changed in ARM platform.  
Use --host=arm-unknown-nto-qnx6.5.0eabi instead

Regards,

Ryan Mansfield
Re: Size of bool changed in ARM platform.  
Thanks, worked perfectly.  I figured it was something simple.
Re: Size of bool changed in ARM platform.  
procnto -ae would enable unaligned accesses for most things other than
ldrex/strex and ldm/stm.

John Edwards wrote:
> Thanks for the information.  I don't mind using a single byte bool, however, do you have any ideas how to get the ARM 
to allow unaligned access and not bus fault when I switch this 3rd party code to use 1 byte boolean values?
> 
> I'm trying to figure out what to do to not rewrite this library we are using.
> 
> I appreciate the advice.
> 
> --john
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post89100
> 
Re: Size of bool changed in ARM platform.  
procnto -ae would enable unaligned accesses for most things other than
ldrex/strex and ldm/stm.

Are those libraries that use 4-byte bools compiled to use the EABI?
If not, there are other ABI differences that could cause you problems...

John Edwards wrote:
> Thanks for the information.  I don't mind using a single byte bool, however, do you have any ideas how to get the ARM 
to allow unaligned access and not bus fault when I switch this 3rd party code to use 1 byte boolean values?
> 
> I'm trying to figure out what to do to not rewrite this library we are using.
> 
> I appreciate the advice.
> 
> --john
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post89100
> 
Re: Size of bool changed in ARM platform.  
Well, I've almost got my ducks in a row, but there must still be one missing.

Now, I've got code compiling, running, etc, except when I hit floating point instructions, which I would imagine is 
trying to run the VFP, but not able to.

I was reading through the help and it seemed to imply that all armv7le code was compiled using the VFP already and no 
other libraries are needed, such as the libm-vfp lib that we used to use on the armle (v6) platforms.

When I run this section of code that has a floating point instruction in it I get this output: ldd:FATAL: Unresolved 
symbol "__aeabi_ul2f" called from Executable

I've tried to use every different -m option I can find to compile the code and can't seem to get anything to work where 
the symbol will be resolved.

Hopefully someone has an idea on what else is needed to get the v7 code working.

Thanks again,
--john