16 | | For example, if you wanted to build a hello-world for laguna (cns3xxx) platform: |
17 | | {{{ |
18 | | $ wget http://dev.gateworks.com/openwrt/latest/cns3xxx/OpenWrt-Toolchain-cns3xxx-for-arm_v6k-gcc-4.6-linaro_uClibc-0.9.33.2_eabi.tar.bz2 |
| 16 | The steps involved: |
| 17 | 1. Download prebuilt toolchain/SDK, the toolchain contains the compiler and standard libraries only. |
| 18 | 1. Uncompress it. |
| 19 | 1. Add it to your path (optional) |
| 20 | 1. Use the toolchain cross compiler to cross compile your code. |
| 21 | |
| 22 | Examples: |
| 23 | * Example, if you wanted to build a hello-world for OpenWrt 14.08 for the laguna (cns3xxx) platform: |
| 24 | {{{#!bash |
| 25 | $ wget http://dev.gateworks.com/openwrt/14.08/cns3xxx/OpenWrt-Toolchain-cns3xxx-for-arm_v6k-gcc-4.6-linaro_uClibc-0.9.33.2_eabi.tar.bz2 |
34 | | |
| 41 | * Example OpenWrt 16.02 for the Ventana (imx6) platform: |
| 42 | {{{#!bash |
| 43 | # download toolchain |
| 44 | wget http://dev.gateworks.com/openwrt/16.02/imx6/Gateworks-Toolchain-imx6_gcc-5.2.0_musl-1.1.12_eabi.Linux-x86_64.tar.bz2 |
| 45 | # extract toolchain |
| 46 | tar xvf Gateworks-Toolchain-imx6_gcc-5.2.0_musl-1.1.12_eabi.Linux-x86_64.tar.bz2 |
| 47 | # add toolchain to path |
| 48 | PATH=$PWD/Gateworks-Toolchain-imx6_gcc-5.2.0_musl-1.1.12_eabi.Linux-x86_64/toolchain-arm_cortex-a9+neon_gcc-5.2.0_musl-1.1.12_eabi/bin:$PATH |
| 49 | # create a simple program |
| 50 | cat << EOF > hello-world.c |
| 51 | #include <stdio.h> |
| 52 | |
| 53 | int main (int argc, char** argv) |
| 54 | { |
| 55 | printf("Hello World\n"); |
| 56 | return 0; |
| 57 | } |
| 58 | EOF |
| 59 | # compile your program |
| 60 | arm-openwrt-linux-gcc hello-world.c -o hello-world |
| 61 | }}} |
| 62 | |