Program C++ through putty using VI (Library installations needed?)

I was wondering if it is possible to write a c/c++ code in vi through SSH on Putty and then generate an output file and run directly on the beaglebone?
I tried the simple helloworld.c program and it worked.
But I tried to write LED blink program and I’m getting error messages.

I used the code by Derek Molley on his website: That uses "FILE, fopen, fclose, sleep, NULL, " etc. I’m getting errors about these.
Am I supposed to install some kind of libraries or a arm-gnueabi compiler before I try to run programs that access the GPIOs and the LEDs ?

Please also let me know the commands for installing the needed packages or an example LED code that would work this way.

Also is there a better OS than Angstrom for beginners on BBB? How is the Ti SDK?

Thank you

hello siddharth,

Personally I prefers nano than vi to write code, but this doesn’t change a lot and it’s possible to write code this way.

Perhaps you could show us your error messages, this could help.

I was wondering if it is possible to write a c/c++ code in vi through SSH on Putty and then generate an output file and run directly on the beaglebone?

Yes, if your program is simple (small), this is the easiest approach
since you dont have to setup a cross development environment.

I used the code by Derek Molley on his website: That uses "FILE,
fopen, fclose, sleep, NULL, " etc. I'm getting errors about these.
Am I supposed to install some kind of libraries or a arm-gnueabi
compiler before I try to run programs that access the GPIOs and the
LEDs ?

make sure you use glibc stdio library. AFAIK, everything on the
beagleboard is memory mapped; but if you ever need to io access, make
sure you use ioperm to request io access permission, and outb or inb
to write and read from io address. Do, if you compile on the board,
you do not to install a cross compiler.

Also is there a better OS than Angstrom for beginners on BBB? How is the Ti SDK?

Angstrom distro comes with a package manager already, use opkg command
to install and search for packages. I, however, have a custom
distribution that i geared for embedded, industrial application, it is
harder to develop on it because it does not come with a package
manager.

Could give me a link with specific commands for this process?
I tried installing G++ with “opkg install g++” I get 3-4 error messages and there is no installation.
Do I need to be in some kind of an administrator mode?
I’m very new to Linux and to beaglebone. I have no clue how to do the things you guys told me in the previous replies.

I’m familiar with FPGA programming but its my first time in Embedded

I was wondering if it is possible to write a c/c++ code in vi through SSH on Putty and then generate an output file and run directly on the beaglebone?
I tried the simple helloworld.c program and it worked.

I have a network share set up, accessible by the beaglebone. I also have the beaglebone set up as a network share, with samba. I edit my files in my favorite modern editor, but compile and run from the network shares, directly, on the beaglebone. Biggest benefit is, if I hose something on the beaglebone or the flash/sd card dies or whatever, I just plug in a new beaglebone, and and up and running after I cd to my development directory.

Don’t develop on the beaglebone flash without some sort of constant backup/source control. You will most likely break something at some point, like with a “opkg upgrade” and it’s hard to get stuff off the emmc.

but its my first time in Embedded

Forget the embedded part, just think of it as a low end little Linux PC. That’s the whole point of Linux, it’s nearly identical regardless of the machine you’re on. This one is no different than a supercomputer cluster, except you have somewhat constrained resources :wink: and some unusual, kick butt, peripherals, like the PRUs.

g++, gcc, python, perl, and node.js (probably forgetting some) are already installed. There are tens of thousands of tutorials on developing regular Linux applications, which is all you’ll be doing (maybe accessing some interesting sysfs interfaces, but that’s not unusual). With the kernel-dev and kernel-headers packages, you can even compile kernel modules right on the Beaglebone.

For opkg, you need the exact name. Use “opkg list” to find the package. You can use wildcards to list packages, so “opkg list gcc”.