bradix_14
bradix_14

Reputation: 17

Use Atmel Studio as General C Compiler

I'm trying to dig in and learn C. My end goal is to head more toward AVR programming and hardware so I downloaded AtmelStudio.

I'm working through a C primer book and wondering how to write console programs in AtmelStudio? All the project types seem to be AVR/ARM focused (makes sense) and require me to pick a Device.

Can I use AtmelStudio for just compiling simple programs and running them in a cmd window?

Upvotes: 0

Views: 1618

Answers (2)

Mike Housky
Mike Housky

Reputation: 4069

For programs intended to run in a Windows console window, may I suggest using MinGW? That's a port of the GCC C/C++/etc. compilers used by Atmel Studio, and the Code::Blocks IDE makes a nice match for that under Windows. I usually don't recommend software bundles, but there's a handy binary download codeblocks.org with a stable Code::Blocks and a recent stable MinGW.

Code::Block Binary Downloads

As for using AtmelStudio to compile programs to run in a "cmd" window, the compilers used will will be some sort of cross-compiler for a CPU and OS that is not what you are running on. Unless you have an emulator for that target platform that runs in Windows console, then I think you're out of luck. Embedded systems typically don't have keyboard or console devices, so real programs won't have a classical Unix-style main() function. You still can write and test functions that don't do console I/O or system calls. Properly coded, those will recompile without changes to run in either environment.

Upvotes: 0

Stefan Falk
Stefan Falk

Reputation: 25387

As far as I know this is not possible. You can only use the simulator to investigate the simulated internal state of a microcontroller and that's it.

There is stuff out there like avrtest or simavr but I'm not sure if this is working for you.

If you just want to learn C before getting into microcontroller development - which is a rather good idea - just get another IDE like Eclipse C/C++ and start with that. After you have the basics you will be able to debug a microcontroller using just the AVR simulator as well.

Here is another (possible) solution to what you want but I guess that is not an answer you want to get as a beginner.

Upvotes: 2

Related Questions