beagleboard / am335x_pru_package

331 stars 181 forks source link

cross compiling with pru package #40

Closed bremenpl closed 8 years ago

bremenpl commented 9 years ago

Hello there, I was introduced to you package when reading Derek Molloys book.using hes instructions I have downloaded it and installed on my bbb. I could then compile c userspace code with yoir library on bbb and connect to the pru. My problem is that I am using a remote system woth cross compiller and eclipse for app deployment and debugging. I havw copied the header and c filea to the eclipse project. I have also copied the 4 generated lib files tp my xcompiller lib folder. After that I was able to use lprussdrv linker flag. The problem is that when I run the crossconpiled code, i get segfault when trying to open the .bin file within the code. When compilled on pru, that part od code works.

Could you please tell me what did I do wrong? How can i use the package from eclipse? I would really be gratefull for your help!

bremenpl commented 9 years ago

Hello there, I still havent resolved the issue? Could you please help me?

jadonk commented 9 years ago

Your step by step is difficult to follow. Can you send a message to http://beagleboard.org/discuss? If you've already done so, can you provide a link?

bremenpl commented 9 years ago

Hello thank you for answer, Ill rephrase the question, maybe im doing it wrong. Could you please provide me a way to use your library to build code on a remote machine (cross compile) and deploy to target? So far i have used you code to build libs and compile on bbb itself, but the rest of my application I am building in eclipse and crosscompiling. How to use you code in eclipse with crosscompiller? I would apreciate all help really.

bremenpl commented 8 years ago

Hi there, Any chance you could answer me? I would just want to know either the package can be cross compiled, so one doesnt have to build the c programs on the BeagleBone Black. I would apreciate all help.

b2ag commented 8 years ago

Hi bremenpl, I see no reason why cross compiling shouldn't be possible. There is no detailed guide available for your particular application and you didn't serve enough information to help with your problem. You seem to lack knowledge of operating systems and cross compiling, but that's not an issue for the am335x_pru package. Maybe read following link for inspiration. https://landley.net/writing/docs/cross-compiling.html And close this issue!

jadonk commented 8 years ago

@bremenpl Please re-open if still having issues.

bremenpl commented 8 years ago

Hey, I havent resolved the issue yet but I was not able to test it in a while. As soon as I get the opportunity to tackle the problem again ill let you guys know, thanks. I am maybe a little suprised that noone is trying to crosscompile this package and everyone is fine with building on bbb.

b2ag commented 8 years ago

Out of curiosity I just cross-compiled pasm and prussdrv from the latest version of this repository. I tested them against natively compiled example applications, which all (but one) seemed to work. The one failing was using the IEP timer, which simply wasn't enabled properly I would guess. For compilation I used some modified version of the PKGBUILD provided in the AUR for Arch Linux ARM. https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=am335x-pru-git It had to be modified to not assume native compilation. Also I had to modify makepkg.conf for the same reason.

bremenpl commented 8 years ago

You made some steps I did not in the time I tested it. That time I didnt know how to do it and now I would probably not gues this as well, i am not experienced enough. Believe me when I say that i asked for help with this many times, over different forums and you are the first one to take this. I was suprised noone cares about crosscompiling regular c/c++ apps with pru usage and they all do native compiling.

b2ag commented 8 years ago

I'm not sure if you read the link I was mentioning in my first post. It gives some good overview over what can go wrong. E.g host compiler should be the same (or compatible enough) version as the target compiler. The libc implementation (glibc, uclibc,...) must not differ. Compiler flags should also match. On ARM you should look into hard floating point versus soft floating point (gnueabi vs gnueabihf).

I'm just giving more examples to things already mentioned in the article I had linked to. I also already said that you didn't provide enough information. For a segfault it usually helps to have a stack trace.

Following link should give you an overview on toolchains for cross compiling. http://elinux.org/Toolchains

Also, if you have never successfully cross compiled an application which was more than a simple "hello world", then you should stick to forums, chats or stackoverflow and not depict your problems as an issue with this package ;)

bremenpl commented 8 years ago

I read the link. I have succesfully crosscompiled more applications than hello world. I know the difference between fpu and no fpu. Also, I never said in this post that I assume there is a problem with this package. I asked for help in a place I thought would suite best for the problem I am having. Also I did that after I couldnt find solution elsewhere.