Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with compiling my avr program in CodeBlocks

Status
Not open for further replies.

Eng.Fahd

Junior Member level 3
Joined
Aug 17, 2011
Messages
25
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,283
Activity points
1,467
Hello all,

I started using CodeBlocks for programming AVR micorcontrollers, it looks a good IDE for AVR programming. But I have a small problem with it.
I wrote a simple code for testing, the code is:
PHP:
#include <avr/io.h>

int main(void)
{
    DDRB=00000011;
    PORTB=00000001;
    while(1)
    {
   
    }

    return 0;
}

When I press build button, I get:
PHP:
-------------- Build: Debug in test (compiler: GNU GCC Compiler for AVR)---------------

avr-gcc -mmcu=atmega8 -Wall -DF_CPU=8000000UL -g -I/usr/include -c fuse.c -o obj/Debug/fuse.o
avr-gcc -mmcu=atmega8 -Wall -DF_CPU=8000000UL -g -I/usr/include -c main.c -o obj/Debug/main.o
avr-g++ -L/usr/lib -o bin/Debug/test.elf obj/Debug/fuse.o obj/Debug/main.o  -mmcu=atmega8 -Wl,-Map=bin/Debug/test.map,--cref  
Output file is bin/Debug/test.elf with size 8,74 KB
Running target post-build steps
avr-objdump -h -S bin/Debug/test.elf > bin/Debug/test.lss
avr-objcopy -R .eeprom -R .fuse -R .lock -R .signature -O ihex bin/Debug/test.elf bin/Debug/test.hex
avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex bin/Debug/test.elf bin/Debug/test.eep
avr-objcopy --no-change-warnings -j .lock --change-section-lma .lock=0 -O ihex bin/Debug/test.elf bin/Debug/test.lock
avr-objcopy --no-change-warnings -j .signature --change-section-lma .signature=0 -O ihex bin/Debug/test.elf bin/Debug/test.sig
avr-objcopy --no-change-warnings -j .fuse --change-section-lma .fuse=0 -O ihex bin/Debug/test.elf bin/Debug/test.fuse
srec_cat bin/Debug/test.fuse -Intel -crop 0x00 0x01 -offset  0x00 -O bin/Debug/test.lfs -Intel
srec_cat bin/Debug/test.fuse -Intel -crop 0x01 0x02 -offset -0x01 -O bin/Debug/test.hfs -Intel
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
I works fine, and there is no error and I get the hex file in the folder Debug.
But when I press run button, I get the following:
PHP:
-------------- Run: Debug in test (compiler: GNU GCC Compiler for AVR)---------------

Checking for existence: /home/fahd/Desktop/mfiles/AVR/test/test/bin/Debug/test.elf
Executing: /home/fahd/Desktop/mfiles/AVR/test/test/bin/Debug/test.elf  (in /home/fahd/Desktop/mfiles/AVR/test/test/)
Process terminated with status 2 (0 minute(s), 0 second(s))
It should generate another folder named 'release' which contains the final output files like hex file, so somthing goes wrong.

Thanks in advance.

- - - Updated - - -

Now I found that I can get the release folder by selecting release form the menu (Build --> Select target --> Release), it worked.
But What is the real difference between Debug and Release. And the run option still not working, is run has no function with avr programming.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top