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

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

[avr-gcc-list] CPU restart and pgm_read_word( ) function


From: address@hidden
Subject: [avr-gcc-list] CPU restart and pgm_read_word( ) function
Date: Mon, 28 Jun 2004 16:38:48 +0200

Hi to all,

I'm developing an application using WinAVR20040404 and I'm using JTAG ICE with 
AVR-Insight to debug.

The CPU is a ATmega128 with external ram clocked at 16 MHz.

When I run the my application, sometimes ( not all the times) it restart to 0 
(I put a breakpoint to address 0 ) but I'm not able to find the point where it 
happens; I have redefined the symbol void __bad_interrupt( void ), put in the 
main file and set a breakpoint on it, but this breakpoint does not occur.

I have investigated the problem trying to find out why the CPU jump to 0.

After a long debug I have discovered this:
I have an array of pointer to function in flash and I access this table reading 
it with the library function pgm_read_word( ).

I have seen that in some cases the pointer read from the flash is different 
from the value I see in the listing generated by avr-objdump and also present 
in the hex file I use to program the device.

For example in the listing I have the value 0x42cc while from the flash I have 
0x424c or
0x4372 instead of 0x43f2.

The problem occurs only some times.

Of corse the icall jump to a wrong point (normally in a middle point of a 
different function) and then the cpu restart from 0.

In the source file I have included <avr/pgmspace.h>.

I have verifyed the software in the flash also with AVR-ISP programmer and also 
with avarice with AVR-JTAG and the verification is OK.

Any idea about this problem ?

Thanks

Patrizio Zelotti




reply via email to

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