-4

I am trying to learn embedded C programming for atmega. I am stuck with this error called

avr-gcc.exe(0,0): CreateProcess: No such file or directory

I have written a simple C code of about 10 lines.

/*
 * RAJESH_AVRC_PROG.c
 *
 * Created: 6/10/2017 10:33:39 PM
 *  Author: AMMU_AMMA
 */ 

#define F_CPU 2000000L
#include <avr/io.h>
#include <avt/delay.>
int main(void)
{
    DDRB = 0xFF;
    PORTB = 0xFF;

    while(1)
    {
        PORTB = 0xFF;
        _delay_ms(1000);
        PORTB=0x00;
        _delay_ms(1000);
        //TODO:: Please write your application code 
    }
}
halfer
  • 19,824
  • 17
  • 99
  • 186
  • 4
    It can't find your `avr-gcc.exe` compiler. totally unrelated to your code. – Eugene Sh. Jun 13 '17 at 17:22
  • 3
    `avt/delay.` is a decidedly odd name for a file. – EOF Jun 13 '17 at 17:23
  • Lots to improve here as mentioned in the other comments. I'm also curious how you arrived at your value for F_CPU. That's not typical at all for first attempts. Also it's `delay.h` and you need to find out where it really is on your system. And of course find the compiler. ;) – TomServo Jun 13 '17 at 17:30
  • Downvoted for begging. It will probably be genuinely surprising to you that we get a few hundred posts a day pleading for assistance, and it really is counterproductive. People here are volunteers, and they do not need to see any attempts to get them to take on more work than they would normally have time for. – halfer Jun 13 '17 at 19:21
  • The problem is with how you set up your build environment. From the looks of it, you're probably using GNU Make in Windows. Make sure avr-gcc.exe is on your PATH environment variable. If you need more help than that, you'll need to provide the details of how you set up your environment. – David Grayson Jun 13 '17 at 20:37
  • [This is for you](http://www.avrfreaks.net/forum/avr-gcc-createprocess-no-such-file-or-directory-1) – Gaurav Pathak Jun 14 '17 at 09:28

1 Answers1

0

If you want to get a quick start, I suggest you use Linux (in a VM or on a separate PC). On Debian/Ubuntu, you can install the required tools on a terminal using:

sudo apt-get install avrdude gcc-avr

You can then use this to compile your files (for atmega32):

avr-gcc -Os -mmcu=atmega32 RAJESH_AVRC_PROG.c -o RAJESH_AVRC_PROG.elf && avr-objcopy -O ihex -j .text -j .data RAJESH_AVRC_PROG.elf  RAJESH_AVRC_PROG.hex

You can load the resulting hex file onto your AVR.

Michael2
  • 860
  • 4
  • 15
  • A Linux VM is an option, but a simpler one is that installing the arduino IDE necessarily dumps a working avr-gcc somewhere - you only have to figure out where, and then you can readily use it for non-Arduino avr projects. – Chris Stratton Jun 22 '17 at 06:04