compiling examples from software pack

Discussions about all user software around SAM Series.

Moderator: nferre

hasanijaz
Posts: 16
Joined: Fri Nov 08, 2013 10:29 am

compiling examples from software pack

Sat Nov 09, 2013 12:23 am

Hi, I have a sam9g25ek board. I have downloaded the softpack from at91 website: http://www.atmel.com/tools/SAM9G25SOFTWAREPACKAGE.aspx

I was trying to compile it. By default the makefiles contain
CROSS_COMPILE=arm-none-eabi
The example gets compiled but when I try to run the elf file it gives Segmentation fault.

Motivated from this post:
forum/viewtopic.php/t,20616/
I also tried to set
CROSS_COMPILE=arm-none-linux-gnueabi-

Now it does not compile and gives the following error:
/opt/arm-2009q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: error: no memory region specified for loadable section `.plt'
collect2: ld returned 1 exit status
make: *** [ddram] Error 1


what am I missing?
blue_z
Location: USA
Posts: 1560
Joined: Thu Apr 19, 2007 10:15 pm

Re: compiling examples from software pack

Sat Nov 09, 2013 1:21 am

hasanijaz wrote:The example gets compiled but when I try to run the elf file it gives Segmentation fault.
If you're getting a "Segmentation fault", then you're probably running with virtual memory, i.e. a Linux environment.
As I already responded to you in that other thread:

> Those are bare-metal (i.e. standalone, does not use an operating system) programs.
> Look at the code you are trying to compile. Are there direct accesses to peripheral registers/locations?
> You cannot do that from userland in Linux, so that would not be a Linux app.
hasanijaz wrote: Now it does not compile and gives the following error:
/opt/arm-2009q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: error: no memory region specified for loadable section `.plt'
collect2: ld returned 1 exit status
make: *** [ddram] Error 1
You cannot use the makefile of a standalone program with a compiler that links with Linux libraries.
hasanijaz wrote:what am I missing?
A standalone program simply cannot be compiled for execution under an OS.
The standalone program would have to be rewritten (aka ported) for that OS.
You need to compile and execute these standalone programs from the softpack as intended and no other way (unless you know what you are doing).

Regards
CptTitanic
Posts: 877
Joined: Sat Oct 30, 2010 6:04 pm

Re: compiling examples from software pack

Sat Nov 09, 2013 4:34 pm

As bluez indicates, bare-metal targeted code isn't a good place to start for Linux apps.

Try experimenting with a simple "Hello World" app, you should be able to compile and link that, and test it under Linux.

Consider if gcc would be better than ld for linking in makefile examples.

For hardware level code, start by examining the board/chip level code within the kernel, and drivers.
hasanijaz
Posts: 16
Joined: Fri Nov 08, 2013 10:29 am

Re: compiling examples from software pack

Wed Nov 13, 2013 12:10 pm

Thanks! I dint know what bare metal meant so now I just compiled a simple hello world and it worked.

Return to “Software”

Who is online

Users browsing this forum: No registered users and 1 guest