LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Addopt embedded LV to embedded Linux - what do I have to do?

Hello.
I'm a student doing my thesis work in sweden and I'm quite new to LV.
I read the manual for porting emb.LV Runtime but don't have an idea where I have to start with.
my platform is an microcomputer (NetDCU8) with an ARM 9 prozessor, touchscreen, Network, serial ports, SD-Card and ADC's running embedded Linux (Emlix).

The graphic part I allready programmed in C/C++ and it could be running as a thread.

This is what I need to programm within LV:
- starting the graphicfunction as a thread
- reading values from ADC's and store them into global Arrays every 60 seconds
- doing some calculations with those values
- storing values into logfiles onto Networkfolder and SD-Card (both mounted when the target start up Linux)

I'm able to do all this stuff in C/C++. But as a part of my thesis work, I have to make emb. LV useable for programming for my target.
The BSP is only for Linux-Computers.

I'm not very familar with operating systems and have zero experience in porting anything.
But if there are some good hints, where I have to look at and what I maybee can use, that's already done, then I think I have a chance to manage it.

...I have only 1 month left for my work....  Smiley Indifferent

Best regards from Göteborg,

Tobias
0 Kudos
Message 1 of 12
(3,353 Views)
If you are eveloping on a Windows machine, you can install Cygwin (www.cygwin.org). Once you have done that, the Unix target (provided with LabVIEW Embedded) should work out of the box.


See http://digital.ni.com/public.nsf/allkb/58781B571699409D8625706E000062A7 : "What Software Do I Need to use the UNIX Console Target? "


I'm no expert, but I think this should work on Linux as well. The LVEmbedded Evaluation 7.1 also uses this target (but there are no source files, only compiled libraries, so you can't customise a lot).


That would be a great start, I think. After that is't all new to me too. I think you should make a sub target (that is all described in the porting guide pdf), and make inline c nodes to access the hardware.


I would like it very much if you post any results. This is a new arrea, and an expensive one. There is not much information on the subject. Will your thesis be made public?


Regards,


Wiebe.
0 Kudos
Message 2 of 12
(3,344 Views)
Thanks a lot!
i will have a closer look at this and I will post as soon as I get something working the results.

I'm not shure if the complete thesis work will be published, but I think it's no problem to show some parts of it. but this I have to discuss with my boss first. Smiley Wink

Ha det gott!  (swedish: have it good!)

Tobias
0 Kudos
Message 3 of 12
(3,341 Views)
Hello.
I have the next problem....  (maybe my biggest problem is to understand the needed steps)

I have installed Cygwin and did the sample application from the tutorial. that works fine. But I got a windows executeable and no Linux executable file.
Now I'm thinking of cross-compiling the generated code files on my Linux desktop and then getting an Linux executeable. I hope I can use the UNIX runtime without making big changes on it, because in fact I have absolutely now clue how to do any changes. I don't know much about LV and operating systems.
I can generate c-code that is UNIX conform with LV, right?
If I copy this code and the Unix-runtime libraries to my Linux desktop, I should be able to use my cross-compiler from the BSP.
Which files/directories do I have to copy?

In the porting guide I read about Plugin VI's and that I can tell LV there which libraries and directories were referenced. But when I open one of those VI's from the UNIX example I just understand nothing (C programming seems to be much easier than al the symbols and wires).
All I need to do is including a header ("displayfuncs.h") that contains the definitions for my graphic functions, read from ADC's via inline c node and put this value into a global array, so that it can be used from the graphic part to draw a graph.
I have already programmed the graphics in C and I'm able to crosscompile and then run it on my target.

Maybe my brain is to small for this stuff...  Smiley Indifferent

Greetz,
Tobias
0 Kudos
Message 4 of 12
(3,314 Views)
Hi,


Perhaps a better bet is to install a cross-compile toolchain in cygwin. I'm working on this from another viewpoint, I'm trying to learn the eCos stuff (mostly apart from LabVIEW). The embedded system uses temporary files, that are deleted when the build process is done...


I think Cygwin creates an exe, because it uses the gcc files compiled for windows. So if you download the gcc core, you should be able to install the i386-elf toolchain, with all the related tools (i386-linux-gcc etc.). Then you should be able to build an .x file. A problem is that not much people are actually trying to compile linux stuff under windows. (I don't have a linux system up and running, so it's hard for me to test. I am creating .x files from .c examples, but the .x is not for Linux but for eCos.)


If you get this done (installing the ecos toolchain was hard for me, because I know nothing about this stuff, because I use LabVIEW), you should only have to replace the compiler and linker path and name.


Hope it helps,


Wiebe.
0 Kudos
Message 5 of 12
(3,307 Views)
Btw. The graphic code sounds really interesting. Can you comment on this?

E.g. what is it capable of (drawing lines, pixels, bitmaps, etc)? Does it interface with X, or with a windows manager? Or do you drive the (s)vga card directly?

Just curious... I might try to drive a vga card with eCos someday.

Wiebe.
0 Kudos
Message 6 of 12
(3,300 Views)
What I try on my Linux-desktop-PC:

desktop:~$ arm-linux-gcc -o /nfsroot/testcomp -lm -lpthread -L"/2compile/" /Targets/ni/Embedded/embLinux/libs/lvanlys.a /Targets/ni/Embedded/embLinux/libs/libaalcore.a /2compile/linux_tryout.c /2compile/lvEmbeddedMain.c
/tmp/ccSBkoUs.o: In function `linux_tryout_Run':
linux_tryout.c: (.text+0x1b8): undefined reference to `RunVI'
/tmp/ccjY80gl.o: In function `main':
lvEmbeddedMain.c: (.text+0x70): undefined reference to `LV_unix_init'
lvEmbeddedMain.c: (.text+0x74): undefined reference to `LVCGenRTInit'
lvEmbeddedMain.c: (.text+0xcc): undefined reference to `LVCGenRTRunTopLevelVI'
lvEmbeddedMain.c: (.text+0x14c): undefined reference to `LVCGenRTEnd'
lvEmbeddedMain.c: (.text+0x150): undefined reference to `LV_unix_fini'
collect2: ld returned 1 exit status
make: *** ["/nfsroot/testcomp"] Error 1

`RunVI' is declared in "LVCCG.h"
somebody an idea how/what I have to link, that the functions were found? All files were in the folder "/2compile/". (This folder contains a big header-and-source-code-soup. Smiley Very Happy)


@Wiebe:
I use nano-X/microwindows for the graphics. This is supported by my target and so it's very easy to do the graphics. Funktions to draw a line, square, polygone and so on are available, as well, as eventhandling for the touchscreen.

Message Edited by TobiasB on 08-01-2007 12:09 PM

0 Kudos
Message 7 of 12
(3,289 Views)
I looked at nano-X and microwindows (these are seperate things, aren't they?), but am not jet able to compile it with and acos application... There should be a port for nano-X to ecos (it is mentioned on the ecos site), but it is nowhere to be found... It would be great to build my own os (that's what you do when you configure ecos) with a graphical user interface. Even greater if you could use LV to do it, but that's for the future.


The libraries that are shipped with LVEmb are probably intended for gcc. I don't think they can be used for arm-linux-gcc, but I'm not shure. You can include all the c files in your build, instead of the .a files (that should have all the functions inside them). The problem is that you need to do this every time, because only functions that are needed by your LV code are included in the LV source code (the rest is skipped with #ifdefine's). The defines are in the LVUsedFuncs.c (or something like that), in your build directory.


You can try to recreate the .a files, but that's way over my head. Once you've compiled all the files, you can archieve the .o files with "ar" (or perhaps arm-linux-ar) to get the .a archieve. Perhaps somewhere there is a make file for this.


Regards,


Wiebe.
0 Kudos
Message 8 of 12
(3,269 Views)
I just remembered. Gcc is picky about the order of the objects. If lvEmbeddedMain.c needs references to lvanlys.a, lvEmbeddedMain should be put first!


Check out "2.4.3 Link order of libraries" in "An Introduction to GCC" by Brian Gough (it's available online in PDF format).


Regards,


Wiebe.
0 Kudos
Message 9 of 12
(3,271 Views)
Hi!
Smiley Very Happy

I got the first "Hello world" to run!!!
Jiiiiiiiihhhhhhhhhhaaaaaaaaaaa!  Smiley Very Happy

I edited LVGenRTInit.c and removed all unneeded includes and corrected the Makefile:

/* CODE START */
APPLICATION = "/nfsroot/testcomp"
CC = "arm-linux-gcc"
LD = "arm-linux-gcc"
CFLAGS =  -DVAR_WAIT_ON_EXIT -DCHeadless=1 -I.  -O3 -fomit-frame-pointer -Dlinux  -w
LFLAGS =  -lm -lpthread -lnano-X -L"/2compile/"
OBJS = /2compile/linux_tryout.o /2compile/LVUnixInit.o /2compile/LVCGenRTInit.o /2compile/lvEmbeddedMain.o
INCLUDES = -I"/2compile"
LIBS = "/Targets/NI/Embedded/embLinux/libs/lvanlys.a" "/Targets/NI/Embedded/embLinux/libs/libaalcore.a"

%.o: %.c
    $(CC) -c $(CFLAGS) $(INCLUDES) -c -o $@ $<

$(APPLICATION): $(OBJS)
    $(CC) -o $(APPLICATION) $(LFLAGS) $(OBJS) $(LIBS)

/* CODE END */

Now I can work with the inline-C-node. the next step will be a timed loop. and also bringing the old dir-structure back from my actual header-soup....


Microwindows is the old name of Nano-X. Fortunetly I didn't have had to compile it for mz target. The libraries were readymade delivered....
so I can just show you some parts of my code to create windows and stuff in the attached file...
Maybee this can help you on your first tryarounds, when you have compiled nano-x for eCos.

I will post again, when the timed loop works.

have a nice day!
Tobias

0 Kudos
Message 10 of 12
(3,262 Views)