Author Topic: Can't found a working compiler for AVR  (Read 9359 times)

Offline Faber

  • Single posting newcomer
  • *
  • Posts: 3
Can't found a working compiler for AVR
« on: May 11, 2018, 12:05:19 pm »
Hello everybody, I'm new on Code::Blocks and I'm having some troubles with compiler. Code::Blocks doesn't find a right compiler so i downloaded from Internet WinAVR 20100110 . From setting -> compiler my selected compiler is GNU AVR GCC compiler (I don't have one). Into "search directories" I have two voices:
  • C:\WinAVR\avr\include
  • C:\WinAvr-20100110\avr\include
(this is what I've managed to add)
[/list]

In toolchain executables I didn't change anything, and in debugger fields i found: GDB/CDB debugger: avr.

Once i compile, i had this in build log:
Quote
Project/Target: "prv - Debug":
  The compiler's setup (GNU GCC Compiler for AVR) is invalid, so Code::Blocks cannot find/run the compiler.
  Probably the toolchain path within the compiler options is not setup correctly?!
  Do you have a compiler installed?
Goto "Settings->Compiler...->Global compiler settings->GNU GCC Compiler for AVR->Toolchain executables" and fix the compiler's setup.

Tried to run compiler executable 'C:\WinAVR/bin/avr-gcc.exe', but failed!
Tried to run compiler executable 'C:\WinAVR/avr-gcc.exe', but failed!

Skipping...
Nothing to be done (all items are up-to-date).

Could someone show me the way to fix it? Thanks in advance,

Faber

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't found a working compiler for AVR
« Reply #1 on: May 11, 2018, 05:43:38 pm »
You have to set the path to the compiler....

So if your avr-gcc is in C:\WinAVR\bin you have to set the toolchain executable*) path to C:\WinAVR\bin

*) Settings->compiler->AVR gcc from the drop down list on the top->Toolchain executables->Main path (or something like that)

Offline Faber

  • Single posting newcomer
  • *
  • Posts: 3
Re: Can't found a working compiler for AVR
« Reply #2 on: May 14, 2018, 03:51:34 pm »
Thank you for the reply, much appreciated  ;D
I'd already did this, but I still have the same problem and print from the debugger  :'(

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't found a working compiler for AVR
« Reply #3 on: May 14, 2018, 03:59:54 pm »
Have you looked at these two messages:
Quote
Tried to run compiler executable 'C:\WinAVR/bin/avr-gcc.exe', but failed!
Tried to run compiler executable 'C:\WinAVR/avr-gcc.exe', but failed!

Do you have avg-gcc in the directory where C::B is searching for it?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't found a working compiler for AVR
« Reply #4 on: May 14, 2018, 07:42:56 pm »
Quote
but I still have the same problem and print from the debugger  :'(
what has the debugger to do with all this?

Quote
I'd already did this,
I doubt it, because if you did it would work ;)

Ok, here is a step by step guide:
1) Download http://blog.zakkemble.co.uk/download/avr-gcc-8.1.0-x86-mingw.zip Or use this site: http://blog.zakkemble.co.uk/avr-gcc-builds/
2) Extract it to C:\AVR_GCC
3) Your compile should be at c:\AVR_GCC\bin\avr-gcc.exe
4) Open Codeblocks
5) Settings->Compiler->From the drop down list at the top select "GNU gcc compiler for AVR"
6) Toolchain executables->Compilers installation direcotry: "C:\AVR_GCC"
7) C compiler: avr-gcc.exe
c++ compiler: avr-g++.exe
linker for dynamic : avr-g++.exe
linker for static: avr-ar.exe
8) Hit ok

Create avr project:
File->New->Project->AVR-> follow the wizard
Before compiling you probably have to remove some ?unneeded? stuff from the post build steps:
1) Project->Build options->Pre/post build steps->Select the project name in the tree control on the left->Remove the "srec_cat" lines