-1

I am trying to generate .hex file to be burned on micro-controller.

I'm using WinAVR.

With MFile I generated makefile for my ATmega8. Here is the makefile

main.c

Now when I try to make all from Programmer's Notepad it gives me error saying :

> "make.exe" all
      0 [main] sh 4248 sync_with_child: child 7356(0x1D8) died before initialization with status code 0xC0000142
  15529 [main] sh 4248 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
      0 [main] sh 10220 sync_with_child: child 3336(0x1E4) died before initialization with status code 0xC0000142
   9277 [main] sh 10220 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable

-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling C: main.c
avr-gcc -c -mmcu=atmega8 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./main.lst  -std=gnu99 -MMD -MP -MF .dep/main.o.d main.c -o main.o 
main.c:14: fatal error: opening dependency file .dep/main.o.d: No such file or directory
compilation terminated.
make.exe: *** [main.o] Error 1

> Process Exit Code: 2
> Time Taken: 00:02

What is the actual error here, what should I do ?

Maifee Ul Asad
  • 3,992
  • 6
  • 38
  • 86
  • Try to run make in a command prompt window. If the output is the same, it's a problem with MFile and/or make. If it works, it's a problem with Programmer's Notepad. Why did you tag your question `cmake`? – the busybee Oct 10 '19 at 06:15
  • @thebusybee i don't know cmd for these – Maifee Ul Asad Oct 10 '19 at 17:34
  • Open the Command Prompt, for example by entering "cmd" in the search box of the start menu. A windows with black background opens and shows white text that "prompts" you for commands. You change directories by "cd" and the target, please see a decent documentation of tutorial. Most (Windows) commands know the option "/?" to print some help. For example enter `cd /?`. Change into the directory of your project where the "Makefile" is. There call "make". NOTE: It's really worth to learn to use the Command Prompt, commonly known as "console" and "shell." Each developer should be able to use it. – the busybee Oct 10 '19 at 18:25
  • I tried in [console](https://i.stack.imgur.com/mKLsX.png) and in [ide](https://i.stack.imgur.com/KCVU1.png) agian, but no hope.. – Maifee Ul Asad Oct 11 '19 at 03:16
  • What does that mean? Do you get the same messsages? – the busybee Oct 11 '19 at 05:37
  • No, another new message I changed the code too.. Simplest code for mc, blinking led – Maifee Ul Asad Oct 11 '19 at 05:40
  • So, please, [edit] your question and show us the new code and the new error messages! We don't have a glass sphere to look into. ;-) – the busybee Oct 11 '19 at 05:47
  • @thebusybee can you take a look now, make file is as it was, main.c is here, and new error message pasted – Maifee Ul Asad Oct 11 '19 at 08:05
  • The makefile in line 607 and 611 calls `sh` and does not work on your system. The two offending lines expand to `sh mkdir . 2>/dev/null` and `sh mkdir .dep 2>/dev/null`, resp. Your system (Windows?) can't run this, perhaps due to a missing or wrong `sh.exe`. 1) Can you run `sh`? If so, quit it by `exit` or Ctrl-D. 2) If you can, what is the output of `where sh`? Search for more `sh.exe`, there might be some more. – the busybee Oct 11 '19 at 08:21
  • I can run sh, and I can find sh with `where sh` :-( – Maifee Ul Asad Oct 11 '19 at 11:33
  • And where is `sh`? Is it part of WinAVR's binaries? Are there more of it? Please, don't let me pull each detail one by one... – the busybee Oct 11 '19 at 11:38
  • it's part of WinAVR binary, there is only one sh... – Maifee Ul Asad Oct 11 '19 at 11:56
  • Now try this, just to see if the rest of the makefile will work: 1) Put a comment sign '#' in front of line 607 of the makefile to disable the call of `sh`. 2) Edit line 611 of the makefile deleting the call of `sh` so that it reads `-include $(wildcard .dep/*)`. 3) Create a directory `.dep` (note the dot!) if it doesn't exist. And 4) run make again. What's the result? BTW, You can [edit] your question to document all the steps we made so that others can jump in. – the busybee Oct 11 '19 at 12:17
  • I did the same thing on window 7 and everything worked out smooth for me – Maifee Ul Asad Oct 26 '19 at 18:15
  • And in win10, I don't use makefile anymore, I directly use this two command from cmd `avr-gcc -Wall -g -Os -mmcu=atmega8 -o main.bin main.c` `avr-objcopy -j .text -j .data -O ihex main.bin main.hex` this works for me.. i'm somewhat satisfied with it – Maifee Ul Asad Oct 26 '19 at 18:17
  • 1
    That's OK if you know what you're doing. Make is just a tool to simplify the work in projects. It's your freedom to **not** use it. ;-) – the busybee Oct 26 '19 at 20:24

1 Answers1

0

And in win10, I don't use makefile anymore, I directly use this two command from cmd

  • avr-gcc -Wall -g -Os -mmcu=atmega8 -o main.bin main.c
  • avr-objcopy -j .text -j .data -O ihex main.bin main.hex this works for me
Maifee Ul Asad
  • 3,992
  • 6
  • 38
  • 86