Can the Arduino IDE be used to develop plain old C programs? - c

I have a simple Arduino sketch that spans several files. There is a function signature in an h file, and the definition in the C file.
If I attempt to compile ("Verify") the sketch, I get "undefined reference" errors to the function defined in a C file. Changing the file name from *.c to *.cpp resolves the issue, but I don't want to define the file as a C++ file. Is it possible to compile plain old C files in Arduino?

The Arduino IDE is very limited, my advice: avoid it. You have some alternatives you can find here: http://arduino.cc/playground/Main/DevelopmentTools
Develop for Arduino using Minibloq graphical programming environment.
Arduino CMake build system
Ino command line toolkit for Arduino
Develop for Arduino using AVR-Ada
Develop for Arduino using Eclipse
Develop for Arduino using Bitlash
Run Arduino from the command line
Build using Cmake
Build using Scons
Build using build_arduino.py
Getting a Chumby talking to Arduino
Running Arduino on the XO laptop (AKA the $100 laptop)
Arduino in Sharp Netwalker
Arduino on OpenSolaris
Using Arduino Libraries in CodeBlocks
Develop for Arduino using Kdevelop
Using assembly language source files in the Arduino IDE: Assembly in Arduino

Related

How do you build Lua with Dev-C++ compiler?

I've been coding in C for a while and I only compiled and debugged with Dev-C++ compiler. Now I'm trying to learn Lua programming language. Just downloaded the Lua source code and I want to compile it with Dev-C++. Can you explain how can I use them? My OS is Win 7.
Edit: Sorry for the explaining mistake. I downloaded the original Lua source code and I want to use the header files that the original source code contains. So I do not know how to add header files to the project that you can open in Dev-C++.
I recommend that you download and use the IDE called SciTE, it is as simple as DEV C++ and comes with a compiler ready to run Lua.
But if you really want to customize a lua compiler, you can call lua.exe to compile and run your Lua file
for example, my Lua is installed in C:\Lua
so I use the following command to compile my codes:
C:\Lua\lua.exe myScript.lua

flash arduino micro using code::blocks and avr-dude

The program I am trying to compile for my arduino micro does not compile in the 'standard' arduino IDE. The reason is subject to a completely different topic discussed at the arduino forum. Cut a long story short, I write pure C and the arduino GUI only does C++. Trust me, I have tried to tweak the interface so it would use avr-gcc, but you enter in an infinite compile - error - refactor loop. I need an other solution.
I am using code::blocks as IDE and want to flash the avr-gcc compiled code onto the arduino micro board using avr-dude on linux kubuntu machine. How would one achieve this?
Problem is I have been running in circles for quite some time now trying to find the correct command line arguments or code:blocks post compiler settings. All information out there is either very old or irrelevant.
I'll keep you posted if I find relevant info
avrdude -V -F -C <avrdude.conf> -p <processor> -P <tty-port> -c stk500v1 -b <baud-rate> -U flash:w:<your-application>.hex
An easy way to see all the settings and get a suitable command line for your system is to use the Arduino gui. Enable verbose upload in the preferences, then program in a basic program like blink. Copy/paste that command line and change the hex file.
I did it here
here
body 24262830

Not able to upload code on CC2538dk board from Ubuntu 12.04 command line

I have a CC2538dk board. I am using Ubuntu 12.04 and cloned Contiki repository from github. I was able to compile all the code in Contiki using make TARGET=cc2538dk hello-world, but I'm not able to upload the code to the CC2538dk board from command line.
The error I'm getting when I ran make TARGET=cc2538dk hello-world.upload is as below.
make: No rule to make target `hello-world.upload'. Stop.
I used to use TI's Uniflash tool (CCS_Uniflash v2.2) to upload the the .elf binary, but it is not available in Contiki.
There is no make target for uploading to CC2538dk boards. According to the documentation one should use TI's UniFlash.
I had success compiling the contiki examples on a separate computer, then using Code Compose Studio v 5.4 to import my binaries (ELF files) to an empty CC2538 project, then debug it from there in order to get it loaded onto the board. Definitely not ideal, but it works.
Setup:
Compile contiki source and examples from instantContiki
move the example directory, included blink.elf to windows machine with CCS 5.4 installed
make a new project in CCS, select Other Examples->Empty CC2538 Project
Import a C/C++ executable, then using the GNU Elf reader, select the blink.elf file you moved over
copy+paste the CC2538SF53.ccxml and the cx2538xf53_ccs.cmd to the new project, and try to debug using those configurations.
The reason this seems to work is that the xds100v3 drivers that come with the board's install disc and the uniflash tool don't seem to work right and just give me any number of errors. There's a black-magic-configuration-combination of the CCS 5.4 for Window's drivers/Other Example's CC2538SF53.ccxml that was the only way I was able to connect to the target.

c compiler commands for generating a winexe

how do i instruct the C compiler (gcc &| cc) to make a "Windows executable" in command line? just like csc /t:winexe filename.cs in c#?
my goal is to create a GUI(winapi) based app without the console.
Are you using MinGW like package and do the build on windows platform? If not I'm afraid you can build PE image from Linux like environment directly, except you are using WINE.

Adding external Graphics library in Ubuntu10.04

i am a beginner to c progmmng, right nw m coding c on ubuntu using gedit and compiling in gcc, i want to plot a graph in c prog, i read regarding gnuplot and koolplot, but when i include those files in my prog i get output as: fatal error/no such directory etc..can anyone tell me how to work it out..please give in detail ans..coz m new to using ubuntu...
i appreciate your answers thankx
How did you install gnuplot and how are you using it in your program? Did you follow the instructions in the gnuplot manual?
Koolplot appears to be designed for the MingW environment under Windows, I wouldn't recommend using it if you're in a Linux environment.
Why not to use GPL library MathGL? It is cross-platform, have C interface and is specially designed as plotting library (not an external program). However it has external GUI and console tools too.

Resources