Writing applications for linux on SAMA5D4 xplained Ultra

I am setting up a custom ubuntu kernel on the SAMA5D4 xPlained Ultra board. I have followed the instructions on the eewiki site, and now have the board up and running. I now want to write a very simple app to carry out an action when the button is pressed on the board. Unfortunately I am unable to find any documentation anywhere on how to do this. I have cross compiled a hello world app, but that’s it. Can you point me in the right direction? Thanks in advance!

Hi John,

Sorry for the delay.

One solution would be to use the gpio-keys binding:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/input/gpio-keys.txt

You’d have to have an application waiting for that keypress, to spawn your actual appilcation.

Regards,

Hi Robert,

Thanks for the suggestion. However, my question was more basic than
this! I am completely unable to compile anything beyond the very simple
helloworld. I should have been more specific in my original post. I need
to know:

  • What compiler version to use
  • What compiler options to use
  • which include files / directories to use
  • which object / library files to link to from the kernel and / or the
    toolchain.

At present, I just get endless errors caused by incompatibilities
between the application, included header files and the libraries - such
as hard or soft float, VFP registers or not, legacy constructs in the
header files. I am trying to use exactly the same compiler that was used
for the kernel for the application development, but even that seems
problematic.

Any hints or answers to this would be fantastic! I have spent many
frustrating hours and seem to be making no progress at all.

Thanks

John

John Frankham
cambridge•innovation•partnership
07803 035490

Hi John,

This is why you should run Debian or Ubuntu on your SAMA5D4, as the answer is. Use the version of gcc and libraries installed by apt provided by Debian/Ubuntu. The kernel is never built with floating point enabled, so you can use native or a x86 based cross compiler to build it. Just build your application on the SAMA5D4, all the binaries and libraries are already compiled for Debian/Ubuntu’s “ARMHF” based on this spec: https://wiki.debian.org/ArmHardFloatPort

Regards,

I was facing a similar issue while writing an application however I got it solved on using gpio-keys binding. Thanks a lot for the solution @RobertCNelson. Really appreciated :slight_smile:

1 Like