Main Site Documentation

Easy programming on Linux mini-boards, tools?


#1

Attaching the Lynx S4 to the Beagle is a cool idea. But I am searching for cool programming tools to use under Linux so the ease of programming from Gadgeteer can be replicated?

Any tips and tricks?


#2

Well, when it comes to Linux, everything down to the editor is a matter of opinion. As well as ease of use is relative to how you are used to working. Vi is probably still the most powerful editor when it comes to wanting to get things done in the quickest possible way. However, there is a much steeper learning curve associated with it.

I personally prefer 2 main editors, depending on whether I am creating a user interface or if I will be distributing the source code to multiple platforms.

User Interfaces: [em]Qt[/em]
If I am to create a user interface, I most certainly prefer Qt (pronounced cute) framework and Creator. This is by far the easiest to use, manage and style the interface with. You may use the default window controls on the platform, but you can also style them with near-full CSS3. You also have the ability to use QtQuick which is a pretty nice mesh of CSS style control descriptors and JavaScript or C++ for the logic.

However, Qt’s major draw-back is that is a rather large dependency to satisfy if the host OS does not come bundled with it. Also, while Qt aims to allow you to write one code set and have it work the same on any platform that has Qt (which they do very very well), it does not play nice with non-Qt systems. Even when choosing to create a non-qt project, the makefile that is produced still makes Qt specific calls.

Qt Creator also has decent Advanced Code Completion. While it is not as good as Intellisense, it is the closest I have personally used.

Multi-platform support: [em]Code::Blocks[/em]

Code::Blocks is not strong on user-interface designs (doesn’t even have a built-in designer), however it excels where Qt falls just short. While you will have to worry about platform specific calls, casing and directory separators (since you are using std c++), there is a tool called cbp2make that will convert the Code::Blocks project into a platform independent Makefile. Even if you distribute it to Windows, MinGW (GCC for Windows) and GNU Utils for windows are much smaller dependencies to satisfy.

Personally, I use both editors on a constant basis. Also, I would recommend using Ubuntu for BeagleBone as it will greatly ease the learning curve of package and repository management. I would also recommend that you develop with Qt on a desktop, if you have one available that runs or can run Linux. This way, you can setup your toolchains and allow the desktop to do the compiling and then you can deploy and remote debug as though it were a NETMF device. (I’m sure this is possible for Windows but I would not be able to list a compatible toolchain).

http://www.codeblocks.org/

Info on Qt Embedded:


#3

Real men use Vi.


#4

Thanks for that, what I wanted to get around and not coding in C++ ??

The drivers are in C++, but can they be wrapped decently?


#5

They can be wrapped, but a lot of head-way is needed for that to happen. Basically every function nested within a class or a struct needs to have a method exposed in global scope as well as every member of each class will need getter and setter methods.

For example:



Would need the following bridge function allowing it to be accessible by other languages:


```cpp
gadgeteering_mainboard_digital_write(base_mainboard* board, cpu_pin pin, bool state)
{
    board->write_digital(pin, state);
}

As well as you will need a proxy class in the targeted language:

public class FEZLynxS4
{
    public void WriteDigital(CPUPin pin, bool state)
    {
        gadgeteering_mainboard_digital_write(...);
        ...
    }
}

This is something I have been planning to do on my own using SWIG, but might not be for some time. Using SWIG will allow you to generate for many languages at the same time with a singular interface file.


#6

Can Mono be used on Beagle/Pi?


#7

I will have to verify this but i dont see why it would not. You may have to compile it from source, but it should run


#8

And mono supports c# ??


#9

It does. ;D

http://www.mono-project.com/Main_Page


#10

Ok, sounds brilliant, James are working on C# wrappers in the future, and then we just need Visual Studio and online debugging to work??


#11

I would need to play with it, but my first thought would be that an easier task to create managed wrapper using C++/CLI, rather than trying to create the procedural exports to interop with.

Just a thought.


#12

Do you want to program now or ten years from now :wink:

Joking aside:

The eclipse IDE is widely used and has a lot of active development (originally from IBM, and now from Google and others). It has “plug-ins” for most languages. It’s learning curve is steep, but lots of folks swear by it. You will NOT find anything as polished as Visual Studio (some linux heads will probably flame me for this comment).

Debuggers, there a lot.

I think, once you try it for a while, that as long as you stick to basic language constructs, the step from C# to C++ is really not that big of a leap. There are corner cases to this statement, but not as many as you’d think. (And, No, I’m not going to get into a debate about this statement, this is my only comment on the subject)

We have been busting our butts to make sure the C++ framework is as close to the paradigms of Gadgeteer as we can. Mainboard concept, sockets, driver APIs, …

Some references you might find interesting:

http://msdn.microsoft.com/en-us/library/yyaad03b(v=vs.90).aspx

follow the links: http://geekswithblogs.net/mikebmcl/archive/2012/02/02/c-to-c-ndash-a-somewhat-short-guide.aspx

http://www.tangiblesoftwaresolutions.com/Product_Details/CSharp_to_CPlusPlus_Converter_Details.html

http://black-sun.sourceforge.net/


#13

Thank you Jeff, those are some good links.

You may want to fix the first link to the msdn site.

http://msdn.microsoft.com/en-us/library/yyaad03b(v=vs.90).aspx


#14

Thank you so much for this, should get me started.


#15

The reason behind creating the exports is that this will allow it to work with any language that can load a C lib. The only place we can not do this is Android Java. It is much faster to generate a generic base that can be called from everywhere and provide proxy classes rather than rewrite the entire framework in the targeted language.

http://www.swig.org/

This is the target utility I plan on using. By writing calls as I had mentioned and creating a single interface file for individual components we could support the following languages:

Allegro CL
C#
CFFI
CLISP
Chicken
D
Go
Guile
Java
Lua
Modula-3
Mzscheme
OCAML
Octave
Perl
PHP
Python
R
Ruby
Tcl
UFFI


#16

What about development under the Windows?
Only C++?


#17

And with C++11, it’s even closer than it used to be. Given a proper module system, We’d be nearly there.

Does Mono support C++/CLI?


#18

Doesn’t say so on the main page.