Problems when creating a develop Virtual Machine

Firmware/software/electronics/mechanics
Post Reply
scrat75
Beginner
Posts: 4
Joined: Tue Aug 25, 2015 8:03 pm

Problems when creating a develop Virtual Machine

Post by scrat75 »

Hi,
I'm new to this forum. I'm very interesting about the creation of a virtual machine, specially for developing
firmware projects. So I read and followed the instructions present at the
https://wiki.bitcraze.io/projects:virtu ... :create_vm.
I intentionally only followed the instructions that spoken about the firmware things.
So I downloaded and installed a virtual box package (version 4.3.30 r101610).
Instead of Xubuntu 14.10 I prefered a debian Jessy (64bit version) and I created the
related VM (30GB dynamically allocated disk, 1024 MB RAM plus the Guest additions),
choosing as user me ($HOME=/home/me instead of /home/bitcraze).
Then starting a root login session (su -) and make sure that the system is up to date by running:
  • apt-get update
    apt-get dist-upgrade
    reboot
Next steps (starting again a root login session):
apt-get -y install git build-essential checkinstall openocd
apt-get -y install openjdk-7-jdk
apt-get -y install gitg meld

Once exited from the root shell login, I returned back in the me terminal session
and then I downloaded and installed the GNU ARM toolchain:
wget https://launchpad.net/gcc-arm-embedded/ ... ux.tar.bz2
tar xjf gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2
mkdir ~/bin
mv gcc-arm-none-eabi-4_9-2014q4 ~/bin/gcc-arm-none-eabi

Finally I set in the PATH environment:
echo -e "\nPATH=\$PATH:$HOME/bin/gcc-arm-none-eabi/bin" >> ~/.bashrc
source ~/.bashrc

At this point I cloned only the firmware repository, executing:
[mkdir ~/projects
cd ~/projects
git clone git://github.com/bitcraze/crazyflie-firmware.git

After that, it was the turn of Eclipse installation. From
http://www.eclipse.org/downloads/downlo ... _64.tar.gz, I downloaded the 64-bit Linux version of the Eclipse IDE for C/C++ Developers and
unpacked it into ~/bin/ directory with the command:
tar -xf eclipse-cpp-luna-SR2-linux-gtk-x86_64..tar.gz -C ~/bin/

After starting Eclipse I imported the cloned firmware project selecting from file menu
the option New->C Project. When the C Project dialog box appeared I chosen as
Project type the option Make project->Empty project, as toolchains -- Other toolchain --
As Project name I chosen the directory name of the firmware project (crazyflie-firmware),
unchecking the option Use default location.

Next step was to install the CDT GDB chosing from Eclipse the menu Help-->Install new software…
and selecting in the Work with option the voice "Luna - http://download.eclipse.org/releases/luna"
and in the Type filter text the text GDB.
After waiting a while, I selected and installed the C/C++ GDB Hardware debugging.
Finally I added the toolchain to the PATH of Eclipse, chosing the
Menu Window-->Preferences from the menu and in the option C-C++-->Build-->Environment
of the related diaolog box I added a new variable named PATH with a value equal
to ${PATH}:/home/me/bin/gcc-arm-none-eabi/bin.

A this point when I try to build the firmware project (selecting the crazyflie-firmware
and choosing the voice Building project from the right click menu), I get the following
error in the Console Panel:

Code: Select all

**** Build of configuration Default for project crazyflie-firmware ****
make all 
  CLEAN_VERSION
  CC    list.o
[make: arm-none-eabi-gcc: Command not found
scripts/targets.mk:26: recipe for target 'list.o' failed
make: *** [list.o] Error 127
The same also if I open a terminal and in the /home/me/projects/crazyflie-firmware
I type

Code: Select all

make all
.

I also followed an advice of Tobias (viewtopic.php?f=6&t=1423&p=8489&hilit=m ... ound#p8490), adding the line

Code: Select all

CROSS_COMPILE = /home/bitcraze/bin/gcc-arm-none-eabi/bin/arm-none-eabi-
in the makefile project, but with no success.

So, where am I wrong? Thanks in advance for any advice and help.
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Problems when creating a develop Virtual Machine

Post by marcus »

Hi,

Does it work running the compiler outside the Makefile? Just try by executing the compiler at the command line using this:

Code: Select all

$ arm-none-eabi-gcc
I'm not really sure about the "bitcraze" user and the "me" user. Is everything installed under the "me" user, or is part of it installed using the "bitcraze" user (like the compiler)?
scrat75
Beginner
Posts: 4
Joined: Tue Aug 25, 2015 8:03 pm

Re: Problems when creating a develop Virtual Machine

Post by scrat75 »

Hi marcus,

I hope that posting these command outputs I can answer your questions:

Code: Select all

me@pc-deb:~$ echo $HOME
/home/me
me@pc-deb:~$

Code: Select all

me@pc-deb:~$ arm-none-eabi-gcc
bash: /home/me/bin/gcc-arm-none-eabi/bin/arm-none-eabi-gcc: No such file or directory
me@pc-deb:~$
But,

Code: Select all

me@pc-deb:~$ which arm-none-eabi-gcc
/home/me/bin/gcc-arm-none-eabi/bin/arm-none-eabi-gcc
me@pc-deb:~
And,

Code: Select all

me@pc-deb:~$ ls -la /home/me/bin/gcc-arm-none-eabi/bin/arm-none-eabi-gcc
-rwxr-xr-x 2 me me 731280 Dec  2  2014 /home/me/bin/gcc-arm-none-eabi/bin/arm-none-eabi-gcc
me@pc-deb:~$
Really as you can see running the arm-none-eabi-gcc does not produce the expected results..
I do not explain myself as this is possible keeping into account the result of which command
and those of echo one.

To answer to your last question, I installed GNU toolchain under the me user.
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Problems when creating a develop Virtual Machine

Post by marcus »

Hi again,

I'm pretty sure the issue is that you are running a 64-bit distribution but the GCC binary you downloaded is 32-bit. Either install the 32-bit libs or switch to a 64-bit build of GCC.

Code: Select all

$ file arm-none-eabi-gcc
arm-none-eabi-gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
scrat75
Beginner
Posts: 4
Joined: Tue Aug 25, 2015 8:03 pm

Re: Problems when creating a develop Virtual Machine

Post by scrat75 »

Thanks Marcus,

so I think I can follow one of these two ways to fix the problem:
1. Creating a VM in Virtualbox using a 32-bit Jessie Debian version and installing
again the packages the Wiki suggests OR;
2. Keeping the actual 64-bit Jessie Debian and installing the 32-bit version of all the
packages need to set up the virtual development environment.

Am I right?

Thaks for the support..
scrat75
Beginner
Posts: 4
Joined: Tue Aug 25, 2015 8:03 pm

Re: Problems when creating a develop Virtual Machine

Post by scrat75 »

Hi guys,

So, at the end of this working week finally I found the time to continue to find a solution to my problem.

I taken into account the advice of Marcus according to which the issue was that I was running a 64-bit
distribution but the GCC binary I downloaded was 32-bit.
So I installed the 32-bit version of debian (I done the same steps again also for a Xubuntu 14.04);
If someone else want to do the same (a 32-bit Linux distro on a 64-bit host Windows machine)
remember to select in Setting menu of your VM, the voice "Enable PAE/Nx" in the "Processor"
tab (Settings->System->Processor) otherwise your 32-bit distro will not start.

Repeating the steps I wrote in my first post, now I can successfully compile the crazyflie-firmware
project but only from command line using the "make clean" and the "make" commands.

Infact when I tried to do the same from within the Eclipse Luna, I always
encountered a message error similar to the below (I do not remember the exact
text message because of I am no longer able to reproduce the original error)

Code: Select all

make: command not found
[PATH=/home/me/bin/gcc-arm-none-eabi/bin]
To fix the problem when I added the PATH environment in the menu Window->Preferences
I made the follwing steps:
1. In the menu C/C++->Build->Environment menu I created a new PATH variable clicking on the
"Add" button but leaving a blank in the value field;
2. Next I selected again the fresh PATH variable and then I clicked on the "Select" button: a new
dialog box "Select variables" appeared showing all the environment variables Eclipse can see;
From that list I selected the item corresponding to the PATH; finally I clicked on the OK button;
3. Last step was to select again the PATH variable and press "Edit" button; at the end of the string
listing all the directories corresponding to the search path I added /home/me/bin/gcc-arm-none-eabi.

With the steps above now I can successfully compile also in the Eclipse IDE the crazyflie-firmware project.

I hope these infos can be usefull to anyone.
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Problems when creating a develop Virtual Machine

Post by marcus »

Glad to hear that you got it working and thanks for the instructions :)
Post Reply