Cross Toolchain [ARM]

Cross Toolchain [ARM] 20110901

No permission to download
SDK
arm toolchain

Revision History
Rev: V0.10
Date: 19/Oct/2010
Author: Kent Tsai
Description: Initial draft



1. Introduction
This document provides detailed description to create the cross compile environment and build your application for QNAP NAS. It also provides how to run your own application at startup in QNAP NAS system.



2. Install the arm toolchain
Please follow the steps to install/uninstall toolchain on your host Linux machine

To Install:​
As root, decompress the toolchain to the “/” folder
Bash:
tar zxvf cross-project-arm-20101019.tar.gz -C /

To Uninstall:​
As root, remove /opt/cross-project/x86
Bash:
rm -rf /opt/cross-project/x86



3. Test if “hello world” worked in x86 platform

Please follow the steps to test “hello world” program
Bash:
source /opt/cross-project/arm/marvell/arm-glibc-2.5.env
cd $TARGET_PREFIX/src/hello_world_project
arm-none-linux-gnueabi-gcc -o hello_world hello_world.c
scp hello_world admin@xxx.xxx.xxx.xxx:/root
ssh admin@xxx.xxx.xxx.xxx /root/hello_world
(xxx.xxx.xxx.xxx is your NAS IP)

It works if you can see the output “Hello World!!!!!!!!!!!!!!!!!!!!!!!”



4. Cross-compiling and testing your application
4.1 Cross-compiling your application

Please follow the steps
A. Put your project in $TARGET_PREFIX/src/myproject
B.​
Bash:
cd $TARGET_PREFIX/src/myproject
C. use 'arm-none-linux-gnueabi-gcc' or 'make CC=${CROSS_COMPILE}gcc' to compile your project​



4.2 Testing the binary of your application

Please follow the steps
A. scp your_binary admin@xxx.xxx.xxx.xxx:/root​
B. Use ssh to login to your NAS​
C. Run your_binary (./your_binary)​



4.3 Running your own application at startup

Please follow the steps
A. scp your_binary admin@xxx.xxx.xxx.xxx:/root​
B. Use ssh to login to your NAS​
Bash:
mount -t ext2 /dev/mtdblock5 /tmp/config
cp /root/your_binary /tmp/config
C. create your own autorun.sh script in /tmp/config/autorun.sh
Bash:
touch /tmp/config/autorun.sh
chown +x /tmp/config/autorun.sh
umount /tmp/config

Note: you can also refer to QNAP wiki to make your autorun.sh script http://wiki.qnap.com/wiki/Running_Your_Own_Application_at_Startup



5. Additional libraries

If you are going to cross-compile some packages, they might miss some libraries. Get the libraries source code first, and follow standard procedure to compile/install it.

For example, to compile libpng, follow the steps
A. Download libpng source to $TARGET_PREFIX/src
Bash:
cd $TARGET_PREFIX/src
wget http://prdownloads.sourceforge.net/libpng/libpng-1.4.4.tar.gz?download
tar zxvf libpng-1.4.4.tar.gz
cd libpng-1.4.4
CC=${CROSS_COMPILE}gcc LDFLAGS="-L$TARGET_PREFIX/usr/lib -L$TARGET_PREFIX/lib" CPPFLAGS="-I${TARGET_PREFIX}/include -I${TARGET_PREFIX}/usr/include" ./configure --host=${TARGET} --prefix=${TARGET_PREFIX}/usr
make
make install


6. Important Notes

Question:
When I use scp to upload binary to NAS, the ram disk is full, how can I do?​
Answer:
Change the target directory to hard disk​
ex: scp your_binary admin@xxx.xxx.xxx.xxx:/mnt/HDA_ROOT​
scp your_binary admin@xxx.xxx.xxx.xxx:/share/MD0_DATA​

Question:
The log of my application will cause ram disk full, how can I don?​
Answer:
Usually open source or application might save logs, to prevent ram disk full, always make sure the log file has been size rotated or save it to hard disks​
(Ram disk full will cause your system abnormal and unstable)​
Author
Silas Mariusz
Downloads
9
Views
997
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Silas Mariusz

Similar resources

Cross Toolchain [x86] Silas Mariusz
Cross Toolchain [x86] u7-20111011
Cross Compiler for QNAP NAS Intel-based platform devices
0.00 star(s) 0 ratings
Downloads
16
Updated