How to develop software/interface?

haraldn
 
Posts: 11
Joined: Sun Oct 26, 2014 4:36 pm

How to develop software/interface?

Wed Nov 19, 2014 1:23 pm

How can I develop programs for the VoCore in C?
How are the interfaces used in C and shell scripts?
Is it possible to run Python on the VoCore to use it like a Mini-PC?

thebestjohn
 
Posts: 6
Joined: Tue Nov 18, 2014 5:42 pm

Re: How to develop software/interface?

Wed Nov 19, 2014 2:31 pm

First I'd like to point you to this: viewtopic.php?f=8&t=34

As far as interfaces perhaps someone else can chime in

and Python yes you can use python I believe. It basically is a mini PC. It's running linux.

Peter H
 
Posts: 58
Joined: Wed Nov 12, 2014 10:24 pm

Re: How to develop software/interface?

Wed Nov 19, 2014 3:17 pm

The operating system is OpenWrt's Linux distribution, and the OpenWrt development environment is reasonably well documented. Vonger posted some notes on development which explained very briefly how to download and build the OpenWrt development environment. The easiest way to do that is in a Linux environment. If you don't already have a Linux environment then it is easy and free to set one up using Virtual Box and Ubuntu.

haraldn
 
Posts: 11
Joined: Sun Oct 26, 2014 4:36 pm

Re: How to develop software/interface?

Wed Nov 19, 2014 3:42 pm

Thanks so far. Is there any tutorial for absolute beginners?

Peter H
 
Posts: 58
Joined: Wed Nov 12, 2014 10:24 pm

Re: How to develop software/interface?

Wed Nov 19, 2014 5:13 pm

I suppose that depends what you're trying to do and what you consider an absolute beginner. I agree it would be useful to have a getting started guide, and there have been several threads here about re-flashing and so on, but none that IMO are suitable for a beginner.

If you want to develop a 'C'/C++ application I think you should start by getting a Linux development environment, follow Vonger's instructions to download and build OpenWrt on it (which gets you the tools you need to cross-compile your own applications), write a 'hello world' application and invoke the OpenWrt cross-compiler to produce an executable image, then use SCP or similar to upload it to the VoCore over the network. Do you understand what those steps mean?

haraldn
 
Posts: 11
Joined: Sun Oct 26, 2014 4:36 pm

Re: How to develop software/interface?

Wed Nov 19, 2014 7:05 pm

Yes I do. In general.
But I have no idea how these steps are performed on a embedded linux in particular. But I will try to get it done.... Nevertheless, a hands-on tutorial would be nice.... I already asked Vonger about, but no response in this direction....

Peter H
 
Posts: 58
Joined: Wed Nov 12, 2014 10:24 pm

Re: How to develop software/interface?

Wed Nov 19, 2014 11:13 pm

I'm hardly the right person to provide a tutorial, but once you have got a Linux development host then you can follow the instructions here to set up an OpenWrt development environment on it:

http://vocore.io/wiki/index/id:15

When you 'make menuconfig' you will need to choose the configuration options. Select "Ralink RT288x/RT3xxx" as the Target System and select "RT3x5x/RT5350 based boards" as the Subtarget, then select "VoCore" as the Target Profile.

Then run 'make'. As the WiKi suggests, this will take a long time. I found it needed several tries to complete because some of the GIT repositories that it needed were offline, but it did eventually complete. The 'make' will create a flash image that could be uploaded to the VoCore if you wanted, but you don't need to. More importantly it will create the cross-compiler that you need to build your own applications. In my case, the compiler was built here:

openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-uclibc-g++

You can test the compiler with a simple Hello World application:
Code: Select all
#include <stdio.h>
int main(int argc, char *argv[])
{
    printf("Hello World!\n");
}


If you save this to HelloWorld.cpp you can invoke the compiler above with arguments HelloWorld.cpp -o HelloWorld to compile and link it, which will create an executable file HelloWorld.

You need to have a network connection between your development host and the VoCore in order to upload your executable file over the network. One way to do that is to have your development host connect to the VoCore's WiFi AP. Once it is connected you can use SCP to copy the executable file to the VoCore:

Code: Select all
scp HelloWorld root@192.168.61.1:HelloWorld


Provide the password "vocore" when prompted.

To run your application you will need to open a shell session on the VoCore. The easiest way to do that is to use PuTTY or similar to connect an SSH session. If you type 'ls' at the command prompt you should find your new HelloWorld file listed, and you can run it by typing './HelloWorld'.

The first time you do this it will probably fail because your HelloWorld application needs the std 'C' libraries to run. They are built as part of the OpenWRT development environment. In my case the required file was here:

Code: Select all
openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libstdc++.so.6


You can copy it to the VoCore like this:

Code: Select all
scp openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libstdc++.so.6 root@192.168.61.1:/lib/libstdc++.so.6


With that in place you should now be able to run ./HelloWorld in your SSH session and see the message "Hello World!" on the console.

OpenWrt has a scheme for packaging your applications as part of OpenWrt so that you can 'make' it within the OpenWRT development environment and have it included in the OpenWrt flash image, and you can read the OpenWRT documentation to learn how to do that.

haraldn
 
Posts: 11
Joined: Sun Oct 26, 2014 4:36 pm

Re: How to develop software/interface?

Thu Nov 20, 2014 8:06 am

Hi!
Thanks a lot for that. That's the kind of tutorial I meant!
And how now can I access GPIOs and alternate/other functions of the VoCore in C?

Peter H
 
Posts: 58
Joined: Wed Nov 12, 2014 10:24 pm

Re: How to develop software/interface?

Thu Nov 20, 2014 1:54 pm

I only have limited experience with VoCore so I'm not going to be able to answer most of your questions, but I can tell you that the GPIO pins are mapped to devices as described here:

http://vonger.cn/?p=473

You can configure, read and write the GPIOs by reading and writing to these devices. You can do this using the usual I/O functions in an application, or by invoking shell commands to do it:

echo out > /sys/class/gpio/gpio0/direction
echo 1 > /sys/class/gpio/gpio0/value
echo 0 > /sys/class/gpio/gpio0/value
echo in > /sys/class/gpio/gpio0/direction

The VoCore manual gives you details of the GPIO pin-outs:

http://vonger.cn/upload/vocore.manual.pdf

alexparadise
 
Posts: 5
Joined: Tue Sep 01, 2015 5:50 pm

Re: How to develop software/interface?

Fri Sep 18, 2015 3:36 pm

I setup the toolchain like explained in the tutorial and cross compile the C file but when I execute it on Vocore I get the following error:

Code: Select all
root@OpenWrt:~# ./hello
-ash: ./hello: not found


Any idea why this happen?

Next
Return to VoCore & VoCore+Dock

Who is online

Users browsing this forum: No registered users and 4 guests