Cross compiling HDF5 for a ARM platform

Hi folks,

This article describes the procedures of cross-compiling a HDF5 software library used on Boundary Nitrogen6W development board from an Ubuntu desktop virtual machine. Hearted with a Quad-Core ARM® Cortex A9 i.MX6 processor, the development board is used to test our HDF5 programs and other Fusion programs. The special steps that are needed to go through to accomplish the cross-platform compilation are described in details in the following sections.

Compilation environment

  • Host system:

  • Virtual Machine: Ubuntu 12.04 64-bit on Windows 7

  • gcc: version 4.6.3-1ubuntu5

  • Target system:

  • Development board: Boundary Nitrogen 6W

  • Compilation toolchain: armv7l-timesys-linux-gnueabi

  • Assigned DeviceIP = Your.Device.IP.Address

Compilation procedures

  1. Download HDF5 source version 1.8.11 from HDF website. Note HDFPath = “/Your/Path/To/hdf5-1.8.11”.

  2. Install the Timesys Nitrogen6X toolchain as directed in Wiki page. Note TimesysToolChainPath = “/Your/Path/To/timesys/nitrogen6x/toolchain/bin/”.

  3. Save the following file CMakeCache.txtto the directory that HDFPath refers to and overwrite the existing file in the directory with the file to be saved.

  4. Create a folder named as “arm-bin” in the HDFPath folder.

  5. Start CMake-Gui and perform the following steps:

  6. In the CMake-Gui window, set both the “Where is the source code:” and “Where to build the binaries:” edits to HDFPath (the red circle);

  7. Change all the paths that contain “/home/precise/hdf5-1.8.11/arm-bin” to HDFPath/arm-bin (the yellow circle);

  8. Change all the paths that conatain “/home/precise/timesys/nitrogen6x/toolchain/bin/armv7l-timesys-linux-gnueabi-” to TimesysToolChainPath/armv7l-timesys-linux-gnueabi-" (the green circles).

  9. Repeat clicking on the Configure button until the configuring is done successfully.

  10. Click on the Generate button to generate Makefile.

  11. In the “/” directory of the minicom terminal, make sure there is a tmp directory; if there is none, create it.

  12. In an Ubuntu terminal, change to the HDFPath directory; then run make command TWICE from the directory.

  13. In the above directory, run command export DeviceIP=192.168.1.200.

  14. In the same directory, run the following three commands in sequence to transfer the corresponding files to the appropriate directories on the device system:

  15. sudo scp ./libhdf5.settings root@$DeviceIP:/libhdf5.settings

  16. sudo scp ./arm-bin/H5detect root@$DeviceIP:/tmp

  17. sudo scp ./arm-bin/H5make_libsettings root@$DeviceIP:/tmp

  18. In the “/” directory of the minicom terminal, run the following two commands to generate two special C files that are to be used for building the HDF5 library:

  19. ./tmp/H5make_libsettings > ./tmp/H5lib_settings.c

  20. ./tmp/H5detect> ./tmp/H5T_init.c

  21. In the HDFPath directory of the above Ubuntu terminal, run the following two commands to transfer the two C files back to the desktop system from the device system:

  22. sudo scp root@$DeviceIP:/tmp/H5T_init.c./H5Tinit.c

  23. sudo scp root@$DeviceIP:/tmp/H5lib_settings.c ./

  24. In the HDFPath directory of the above Ubuntu terminal, run make command again until the build operations finish successfully.

  25. So far the HDF5 shared library files and other created executable files are located in the “./arm-bin folder”. You can copy the library files to whichever destination places where you want to use the library from in your applications.

Any comments will be welcome.

Jason

Hi, Jason!

  This article is awesome! Thanks for sharing this.

  By the way, the links in step 2 and 3 seem broken. Would you please
give us the correct links?

  Also, why does step 9 require running make"twice"? I'm curious.

···

--
HDF: Software that Powers Science

On Wed, Sep 18, 2013 at 7:53 AM, <jzhang636@verizon.net> wrote:

Hi folks,

This article describes the procedures of cross-compiling a HDF5 software
library used on Boundary Nitrogen6W development board from an Ubuntu desktop
virtual machine. Hearted with a Quad-Core ARM® Cortex A9 i.MX6 processor,
the development board is used to test our HDF5 programs and other Fusion
programs. The special steps that are needed to go through to accomplish the
cross-platform compilation are described in details in the following
sections.

Compilation environment

Host system:

Virtual Machine: Ubuntu 12.04 64-bit on Windows 7
gcc: version 4.6.3-1ubuntu5

Target system:

Development board: Boundary Nitrogen 6W
Compilation toolchain: armv7l-timesys-linux-gnueabi
Assigned DeviceIP = Your.Device.IP.Address

Compilation procedures

Download HDF5 source version 1.8.11 from HDF website. Note HDFPath =
"/Your/Path/To/hdf5-1.8.11".
Install the Timesys Nitrogen6X toolchain as directed in Wiki page. Note
TimesysToolChainPath = "/Your/Path/To/timesys/nitrogen6x/toolchain/bin/".
Save the following file CMakeCache.txtto the directory that HDFPath refers
to and overwrite the existing file in the directory with the file to be
saved.
Create a folder named as "arm-bin" in the HDFPath folder.
Start CMake-Gui and perform the following steps:

In the CMake-Gui window, set both the "Where is the source code:" and "Where
to build the binaries:" edits to HDFPath (the red circle);
Change all the paths that contain "/home/precise/hdf5-1.8.11/arm-bin" to
HDFPath/arm-bin (the yellow circle);
Change all the paths that conatain
"/home/precise/timesys/nitrogen6x/toolchain/bin/armv7l-timesys-linux-gnueabi-"
to TimesysToolChainPath/armv7l-timesys-linux-gnueabi-" (the green circles).

Repeat clicking on the Configure button until the configuring is done
successfully.
Click on the Generate button to generate Makefile.
In the "/" directory of the minicom terminal, make sure there is a tmp
directory; if there is none, create it.
In an Ubuntu terminal, change to the HDFPath directory; then run make
command TWICE from the directory.
In the above directory, run command export DeviceIP=192.168.1.200.
In the same directory, run the following three commands in sequence to
transfer the corresponding files to the appropriate directories on the
device system:

sudo scp ./libhdf5.settings root@$DeviceIP:/libhdf5.settings
sudo scp ./arm-bin/H5detect root@$DeviceIP:/tmp
sudo scp ./arm-bin/H5make_libsettings root@$DeviceIP:/tmp

In the "/" directory of the minicom terminal, run the following two commands
to generate two special C files that are to be used for building the HDF5
library:

./tmp/H5make_libsettings > ./tmp/H5lib_settings.c
./tmp/H5detect> ./tmp/H5T_init.c

In the HDFPath directory of the above Ubuntu terminal, run the following two
commands to transfer the two C files back to the desktop system from the
device system:

sudo scp root@$DeviceIP:/tmp/H5T_init.c./H5Tinit.c
sudo scp root@$DeviceIP:/tmp/H5lib_settings.c ./

In the HDFPath directory of the above Ubuntu terminal, run make command
again until the build operations finish successfully.
So far the HDF5 shared library files and other created executable files are
located in the "./arm-bin folder". You can copy the library files to
whichever destination places where you want to use the library from in your
applications.

Any comments will be welcome.

Jason

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Hi Jeo,

I am enclosing for you the CMakeCach file that I used to generate the Makefile for the HDF5 library compilation. Unfortunately the compilation toolchain is a proprietary property of my company, which I couldn't share with you. Nevertheless this toolchain was created for our particular ARM board. If you are using a different ARM device, the toolchain may not be suitable for your system. In this case, you will have to create or get your own compilation toolchain. As for the reason why you need to run the make command twice in step 9, it is because that the make file is to generate two executable files, H5detect and H5make_libsettings, which are used to generate two C programs on the device, as shown in the compilation step sequence. You have to run the make command two times to ensure that the two code generators are all created.

Hope this helps.

Jason

CMakeCache.txt (40.5 KB)

···

On 09/18/13, H. Joe Lee<hyoklee@hdfgroup.org> wrote:

Hi, Jason!

This article is awesome! Thanks for sharing this.

By the way, the links in step 2 and 3 seem broken. Would you please
give us the correct links?

Also, why does step 9 require running make"twice"? I'm curious.

--
HDF: Software that Powers Science

On Wed, Sep 18, 2013 at 7:53 AM, jzhang636@verizon.net> wrote:

Hi folks,

This article describes the procedures of cross-compiling a HDF5 software
library used on Boundary Nitrogen6W development board from an Ubuntu desktop
virtual machine. Hearted with a Quad-Core ARM® Cortex A9 i.MX6 processor,
the development board is used to test our HDF5 programs and other Fusion
programs. The special steps that are needed to go through to accomplish the
cross-platform compilation are described in details in the following
sections.

Compilation environment

Host system:

Virtual Machine: Ubuntu 12.04 64-bit on Windows 7
gcc: version 4.6.3-1ubuntu5

Target system:

Development board: Boundary Nitrogen 6W
Compilation toolchain: armv7l-timesys-linux-gnueabi
Assigned DeviceIP = Your.Device.IP.Address

Compilation procedures

Download HDF5 source version 1.8.11 from HDF website. Note HDFPath =
"/Your/Path/To/hdf5-1.8.11".
Install the Timesys Nitrogen6X toolchain as directed in Wiki page. Note
TimesysToolChainPath = "/Your/Path/To/timesys/nitrogen6x/toolchain/bin/".
Save the following file CMakeCache.txtto the directory that HDFPath refers
to and overwrite the existing file in the directory with the file to be
saved.
Create a folder named as "arm-bin" in the HDFPath folder.
Start CMake-Gui and perform the following steps:

In the CMake-Gui window, set both the "Where is the source code:" and "Where
to build the binaries:" edits to HDFPath (the red circle);
Change all the paths that contain "/home/precise/hdf5-1.8.11/arm-bin" to
HDFPath/arm-bin (the yellow circle);
Change all the paths that conatain
"/home/precise/timesys/nitrogen6x/toolchain/bin/armv7l-timesys-linux-gnueabi-"
to TimesysToolChainPath/armv7l-timesys-linux-gnueabi-" (the green circles).

Repeat clicking on the Configure button until the configuring is done
successfully.
Click on the Generate button to generate Makefile.
In the "/" directory of the minicom terminal, make sure there is a tmp
directory; if there is none, create it.
In an Ubuntu terminal, change to the HDFPath directory; then run make
command TWICE from the directory.
In the above directory, run command export DeviceIP=192.168.1.200.
In the same directory, run the following three commands in sequence to
transfer the corresponding files to the appropriate directories on the
device system:

sudo scp ./libhdf5.settings root@$DeviceIP:/libhdf5.settings
sudo scp ./arm-bin/H5detect root@$DeviceIP:/tmp
sudo scp ./arm-bin/H5make_libsettings root@$DeviceIP:/tmp

In the "/" directory of the minicom terminal, run the following two commands
to generate two special C files that are to be used for building the HDF5
library:

./tmp/H5make_libsettings > ./tmp/H5lib_settings.c
./tmp/H5detect> ./tmp/H5T_init.c

In the HDFPath directory of the above Ubuntu terminal, run the following two
commands to transfer the two C files back to the desktop system from the
device system:

sudo scp root@$DeviceIP:/tmp/H5T_init.c./H5Tinit.c
sudo scp root@$DeviceIP:/tmp/H5lib_settings.c ./

In the HDFPath directory of the above Ubuntu terminal, run make command
again until the build operations finish successfully.
So far the HDF5 shared library files and other created executable files are
located in the "./arm-bin folder". You can copy the library files to
whichever destination places where you want to use the library from in your
applications.

Any comments will be welcome.

Jason

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org