avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Execution problem


From: Matte
Subject: [avr-gcc-list] Execution problem
Date: Thu, 22 Jan 2004 09:54:44 +0100

Hi Again

Thanks for all the help last time..!

Well, now I've solved the problems I had before and started writing
code. Now I got another little slight problem, I cannot get the compiled
c-code to execute within the AVR. 

In order to eleminiate as many errors as possible I created a really
tiny testprogram, shown below:

#include<inttypes.h>
#include<avr/io.h>
                                                                                
#define PORT_C 0x15
#define DDR_C 0x14;
                                                                                
int main(void) {
  volatile uint8_t *PC; PC = &PORTC;
  volatile uint8_t *DC; DC = &DDRC;
                                                                                
  for(;;)
{                                                                               
 
  *DC = 0xFF;
  *PC =
0xFF;                                                                   
  }                                                               
}

All this program should do is to set a high output on the PORTC pins,
where I connected leds via a resistor monitoring the output. I compile
this code, creates an -hex file and downloads it with the avrdude by the
following:

avr-gcc -mmcu=atmega16 -Os test.c -o test.o
avr-objcopy -j .text -j .data -O ihex test.o test.hex
avrdude -c bsd -p m16 -P/dev/parport1 -e -f i -i test.hex -E reset

Well the downloading is fine, but when I starting the program by:

avrdude -c bsd -p m16 -P/dev/parport1 -E noreset

Nothing happends. I've tried implementing the same small testprogram
using assembler, just to ensure that the mmcu are intact, and that
workes fine. When I inspecting the gcc output by disassembling, the code
in the main section looks fine, however it seems like it never gets to
execute. The ohter stuff generated by the gcc I assumed to be correct
(the assumption seems incorrect to me). 

Now, I would like to know, howto get the above code to execute as it
should. How do I control what code gcc puts into the project ?? After
upgrading I'm using the gcc-3.3.2, the latest avr-libc and binutils-2.14
(could not find any that where younger). 

I think I've described the symtoms and what I do. I got the feeling that
it's somewhat easy to fix, I just need to know how. Anyone that knows,
pleas tell me how to get the accurate code and execution using gcc and
the other tools described. 

Best Regards 
Mattias 


-- 
Mattias

address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]