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

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

Re: [avr-gcc-list] Strange issues with 16-bit values


From: David Brown
Subject: Re: [avr-gcc-list] Strange issues with 16-bit values
Date: Fri, 07 Nov 2008 09:00:48 +0100
User-agent: Thunderbird 2.0.0.17 (Windows/20080914)


Have you looked at the generated assembly code? (Add "-Wa,-ahlsd" to your compiler options to generate a list file). And have you considered other problems, such as watchdog resets causing problems for the slower code?

mvh.,

David


Brian Neltner wrote:
Very oddly, the code runs when I compile it with -O3, but not with any
other optimization level.

...

Is this a known bug?

On Fri, 2008-11-07 at 00:05 -0500, Brian Neltner wrote:
Apologies if this has been mentioned before.

I have some software that previously compiled perfectly on my computer,
but which now fails silently when uploaded (no compile-time errors or
warnings). I am hoping someone can help me!

This works:

int main(void) {
        uint8_t i;
        for(i=1;i<0xFF;i++) asm volatile("nop/n/t");
        PORTA=0x01;
        while(1);
}

and PORTA is correctly set.

However, this doesn't work:

int main(void) {
        uint16_t i;
        for(i=1;i<0xFF;i++) asm volatile("nop/n/t");
        PORTA=0x01;
        while(1);
}

and the code never reaches the PORTA setting command.

I have included the following libraries:

#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>

and this all worked previously, so I'm not sure what to do.

This is using avr-gcc 4.3.0

Hopefully I am just missing a library which didn't used to be necessary
but now is? It's very strange to me that my code is compiling without
errors or warnings... but not running.

Thanks,
Brian






reply via email to

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