Attempting to compile for ARMv7 but stuck...
#1
How did you guys get PolarSSL to compile correctly on the Raspberry Pi? I'm attempting to get it to compile on an Odroid XU3 (A beast of an ARM board) but I always end up with the error:

bignum.c:1123:1: error: r7 cannot be used in asm here

I already tried to set compiler flags such as -O2 and -fomit-frame-pointer but nothing works.
Reply
Thanks given by:
#2
Not a long term fix. But as a hot fix, try commenting out the line "#define POLARSSL_HAVE_ASM" in lib/polarssl/include/polarssl/bn_mul.h

Also what is the output of gcc -dM -E - < /dev/null ?

Also how did you set -fomit-frame-pointer? we may overwrite the CFLAGS in cmake.
Reply
Thanks given by:
#3
I think I've found the difference between a pi and an Odroid XU3. The pi's use a ARM1176JZF-S processor that supports Thumb but not Thumb2. The Odroid however has a mixture of Cortex A series cores which support Thumb and Thumb2. PolarSSL has a special case asm for processors that support Thumb but not Thumb2. Which means the inline assembly is different on the Odroid. However why this should cause a build failure on the Odroid but not the pi is strange as the thumb special case code clobbers all the registers the thumb2/non-thumb one does and more. The only thing I can think of is that gcc on the pi handling the clobber and storing the frame pointer somewhere else temporally. So it would be useful to know the exact compiler version you are using.
Reply
Thanks given by: DiamondToaster
#4
I commented out that line but I'm still getting the same stupid error. Sad

I tried sticking compiler flags in the cmake and makefiles but it didn't do much.
I don't really know what that line does and just gives me "no input files". I'm using gcc 4.8.2.

Anyway could I use precompiled libs that I got from the Ubuntu repo instead of recompiling?
That would be much easier.
Reply
Thanks given by:
#5
The easiest way to add flags is to use the add_flags_cxx macro in SetFlags.cmake. The error that you get when commenting out the line is weird and suggests you've managed to break the makefiles.

The main problem we have with using precompiled libs is finding them on the platforms we support, particularly windows. So we haven't put in the development effort needed as the current system mostly works and finding precompiled files is a significant amount of work. However if anyone is willing to make the patch we'd accept it.
Reply
Thanks given by: DiamondToaster
#6
Wow, thanks!
The add_flags_cxx macro worked. Big Grin

How did I not notice that?!

Seems to build fine, I'll test if the binaries work on the XU3, all the precompiled ones either seg fault or spit an internal error.

EDIT: Binaries work amazingly. I feel like there should be a repo for ARMv7 binaries as that architecture is becoming more and more common.
Reply
Thanks given by:
#7
What were your changes? Perhaps we can integrate them into the main repo somehow?

The main reason for not having ARMv7 binaries is, in my opinion, that none of us have a device to test them on, so even if we managed to build something, there's no way to tell.

I was planning on getting an Odroid U3, but I made it into a christmas gift tip and noone seems to have taken notice.
Reply
Thanks given by:
#8
Xoft. I suspect we might have trouble integrating the changes. The problem is that we need to add the flag to debug builds, but it reduces our ability to debug so we don't want to add it to pi builds. However, as far as I can tell cmake does not have the capability to detect the architecture you're building against. So the best way to handle this would be yet another custom cmake flag.
Reply
Thanks given by:
#9
What I did to get it to work is at line 29 of the SetFlags.cmake in the root folder, I added add_flags_cxx("-O2"). For all I know, -O2 automatically uses the flag -fomit-frame-pointer during optimization. I could make a repo type thing for these binaries. Tongue

Also, if you want an awesome ARMv7 device, check out the recently released Odroid C1. Its a quad-core Cortex-A7 for the same price as a Raspberry Pi Model B.
Reply
Thanks given by:
#10
I'm liking this Hardkernel company more and more. They keep making awesomer and awesomer devices by the month Smile
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)