{"id":931,"date":"2010-05-27T17:17:37","date_gmt":"2010-05-27T22:17:37","guid":{"rendered":"http:\/\/www.multitech.net\/developer\/?page_id=931"},"modified":"2011-11-23T14:41:32","modified_gmt":"2011-11-23T20:41:32","slug":"development-examples","status":"publish","type":"page","link":"https:\/\/www.multitech.net\/developer\/software\/corecdp\/development\/development-examples\/","title":{"rendered":"Development Examples"},"content":{"rendered":"<h3>Building HelloWorld without BitBake<\/h3>\n<p>The following example shows how to build a simple C application, transfer it to the device using SCP, and run it over an SSH connection.<\/p>\n<pre class=\"brush:shell\">\r\n# set PATH to include the toolchain \r\n# (assumes OETREE is set from env-oe.sh and build system is x86_64)\r\nexport PATH=$PATH:${OETREE}\/build\/tmp\/sysroots\/x86_64-linux\/usr\/armv5te\/bin\r\n\r\n# compile and link helloworld.c\r\narm-corecdp-linux-gnueabi-gcc -o helloworld helloworld.c\r\n\r\n# copy to device in \/usr\/bin\/\r\nscp helloworld root@192.168.2.1:\/usr\/bin\/\r\n\r\n# ssh to device and run it\r\nssh root@192.168.2.1\r\nhelloworld\r\n<\/pre>\n<h3>Building HelloWorld with a BitBake recipe<\/h3>\n<p>The following example shows how to package a simple C application using a BitBake recipe.  First, the recipe is created.  Then the package is built and copied to the device using SCP.  Lastly, opkg is used to install the package on the device.<\/p>\n<pre class=\"brush:shell\">\r\n# create a recipe\r\ncd ${OETREE}\/user-layer\/recipes\r\nmkdir helloworld\r\ncd helloworld\r\n\r\n# (create helloworld_1.0.0.bb, see below for contents)\r\n# (create helloworld.c)\r\n\r\n# build package\r\ncd ${OETREE}\r\nbitbake helloworld\r\n\r\n# copy the package to the device\r\nscp build\/tmp\/deploy\/eglibc\/ipk\/armv5te\/helloworld_1.0.0-r0.10_armv5te.ipk  root@192.168.2.1:\/var\/tmp\/\r\n\r\n# install the package\r\nssh root@192.168.2.1\r\ncd \/var\/tmp\r\nopkg install helloworld_1.0.0-r0.10_armv5te.ipk\r\n\r\n# run it\r\nhelloworld\r\n<\/pre>\n<p>To install the helloworld package into a custom filesystem image that can be flashed into the device, see <a href='https:\/\/www.multitech.net\/developer\/software\/corecdp\/development\/creating-a-custom-image\/' title='Creating a Custom Image'>Creating a Custom Image<\/a><\/p>\n<h5>helloworld_1.0.0.bb<\/h5>\n<p>For further explanation of this recipe, see <a href='https:\/\/www.multitech.net\/developer\/software\/corecdp\/development\/writing-bitbake-recipes\/' title='Writing BitBake Recipes'>Writing BitBake Recipes<\/a><\/p>\n<pre class=\"brush:shell\">\r\nDESCRIPTION = \"HelloWorld\"\r\nSECTION = \"examples\"\r\nLICENSE = \"GPL\"\r\n \r\nSRC_URI = \"file:\/\/helloworld.c\"\r\n \r\nS = \"${WORKDIR}\"\r\n \r\ndo_compile() {\r\n    ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld\r\n}\r\n \r\ndo_install() {\r\n    install -d ${D}${bindir}\r\n    install -m 0755 helloworld ${D}${bindir}\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Building HelloWorld without BitBake The following example shows how to build a simple C application, transfer it to the device using SCP, and run it over an SSH connection. # set PATH to include the toolchain # (assumes OETREE is set from env-oe.sh and build system is x86_64) export PATH=$PATH:${OETREE}\/build\/tmp\/sysroots\/x86_64-linux\/usr\/armv5te\/bin # compile and link helloworld.c [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":314,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-931","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/931","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/comments?post=931"}],"version-history":[{"count":14,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/931\/revisions"}],"predecessor-version":[{"id":2203,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/931\/revisions\/2203"}],"up":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/314"}],"wp:attachment":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/media?parent=931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}