LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 08-27-2015, 08:41 AM   #1
ashokspeedy
LQ Newbie
 
Registered: Aug 2015
Posts: 1

Rep: Reputation: Disabled
cross compiling for ARM mini2440


I am using linux version 14.04. I used the below program for real time clock in ARM mini2440.


#include<sys/ioctl.h>
#include<stdio.h>
#include<fcntl.h>
#include<stdlib.h>
#include<linux/rtc.h>

int main(void)
{
int fd,ret ;
struct rtc_time time;

time.tm_sec=10;
time.tm_min=50;
time.tm_hour=11;
time.tm_mday=1;
time.tm_mon=2;
time.tm_year=104;
time.tm_wday=4;
time.tm_yday=5;
time.tm_isdst=6;

fd = open("/dev/rtc0",O_RDWR);
if(fd<0)
{
printf("open failed\n");
exit(1);
}

ret = ioctl(fd, RTC_SET_TIME, &time);

if(ret==-1)
{
perror("ioctl failed ret");
}
close(fd);
return 0;

}



After writing the program I cross compiled using the command
$ arm-linux-gnueabi-gcc-static -o newwrite newwrite.c

After this I copied the newwrite file into pendrive and used the pendrive in ARM mini2440. I created new directory "newdir", and mount the files in pendrive to new directory "newdir" using the command
$ mount /dev/udisk ./newdir

when I compile the file
./newwrite
It shows error illegal instruction
please help me as I am new to this field

Last edited by ashokspeedy; 08-27-2015 at 08:44 AM.
 
Old 08-28-2015, 05:43 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Start with something simple, like a hello world program. Once you know how to cross-compile for your processor properly, then you can step it up to a program you care about.

You may need to add some flags to your compilation, like march, mmcu, etc.

Also it looks like the mini2440 has ethernet. Your turn around time will be much faster if you just scp the file over instead of passing a thumb drive back and forth, not to mention the havoc fat32 thumb drives can wreak on your file permissions.

Last edited by suicidaleggroll; 08-28-2015 at 05:45 PM.
 
Old 08-30-2015, 09:39 AM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member response

Hi,

Welcome to LQ!
If you scroll down within this thread you will find some links to similar threads that may be of some help. Plus a LQ Search may provide some useful information.

Please consider reading; http://www.linuxquestions.org/questi...#faq_lqwelcome

Hope this helps.
Have fun & enjoy!
 
Old 08-31-2015, 06:54 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by suicidaleggroll View Post
Start with something simple, like a hello world program. Once you know how to cross-compile for your processor properly, then you can step it up to a program you care about.

You may need to add some flags to your compilation, like march, mmcu, etc.

Also it looks like the mini2440 has ethernet. Your turn around time will be much faster if you just scp the file over instead of passing a thumb drive back and forth, not to mention the havoc fat32 thumb drives can wreak on your file permissions.
If possible, it is even faster if you can do an NFS mount of the work space... Then you can just run it without having to copy it...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cross compiling php-5.6.9 for arm MagicPhoton Linux - Newbie 0 06-08-2015 11:45 PM
cross compiling apache-2.4.12 for arm MagicPhoton Linux - Newbie 5 06-07-2015 04:23 PM
Cross Compiling For ARM ExternalUse Linux - Software 1 06-27-2014 01:39 AM
Getting printer drivers (hpijs) on Mini2440 ARM9 (cross compiling) PJvG Linux - Software 9 04-23-2010 04:20 AM
Cross compiling for ARM Hachaso Programming 1 06-26-2009 06:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 05:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration