[avr-gcc-list] How to set section order

2006-01-18 Thread David Bourgeois
I have a bootloader that I would like to start at 0x0E00 in an ATMega48 (no special boot loader section in FLASH). It has 2 functions that should be placed in the following order: bootloader(), smallFunction(). I created a .bootloader section and I ask the linker to put it at 0x0E00 and

[avr-gcc-list] BUG? Comparing of words error.

2006-01-18 Thread Flemming Steffensen (sent by Nabble.com)
Hi, This is my first post to this forum. I'm not even sure it's the right place to post, but I think so. I'm trying this with an ATmega8, with a 500Hz oscillator connected at INT0, using WinAVR (avr-gcc 3.4.3). I noticed the problem using this code: unsigned short RotCount;

Re: [avr-gcc-list] How to set section order

2006-01-18 Thread Eric Weddington
David Bourgeois wrote: I have a bootloader that I would like to start at 0x0E00 in an ATMega48 (no special boot loader section in FLASH). It has 2 functions that should be placed in the following order: bootloader(), smallFunction(). I created a .bootloader section and I ask the linker to

Re: [avr-gcc-list] BUG? Comparing of words error.

2006-01-18 Thread Eric Weddington
Flemming Steffensen (sent by Nabble.com) wrote: Hi, This is my first post to this forum. I'm not even sure it's the right place to post, but I think so. I'm trying this with an ATmega8, with a 500Hz oscillator connected at INT0, using WinAVR (avr-gcc 3.4.3). I noticed the problem using

Re: [avr-gcc-list] BUG? Comparing of words error.

2006-01-18 Thread Markus Baertschi
Hi Flemming,I'd assume thi happens because you increment RotCount in an interrupt and interrupts are active while you are testing the condition. The AVR is an 8 bit CPu and the 16bit test will take a couple of instructions. As you are doing nothing else in the loop the chance is that the interrupt

Re: [avr-gcc-list] BUG? Comparing of words error.

2006-01-18 Thread Albert Andras
Hi Flemming, I think you should disable intrerupts for the time of comparing. 16 bit compare (load) is not atomic. This is your code compiled by me (you better use volatile if don`t want the whole loop to be optimized away). volatile unsigned short RotCount; void test(void){ while (1){

[avr-gcc-list] Re: BUG? Comparing of words error.

2006-01-18 Thread Volkmar Dierkes
That's not a bug. On Wed, 18 Jan 2006 06:47:33 -0800 (PST), Flemming Steffensen (sent by Nabble.com) wrote: unsigned short RotCount; Please use: volatile unsigned short RotCount; Volkmar ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org

Re: [avr-gcc-list] BUG? Comparing of words error.

2006-01-18 Thread Dimitar Dimitrov
On 18.1.2006 16:47, Flemming Steffensen (sent by Nabble.com) wrote: unsigned short RotCount; SIGNAL(SIG_INTERRUPT0){ RotCount++; } void test(void){ while (1){ RotCount = 0; while (RotCount 1000) {} RotCount = 0;   

Re: [avr-gcc-list] How to set section order

2006-01-18 Thread David Bourgeois
Yes. I noticed that without optimization, the linker keep the order the functions appear in the code but if I turn on optimization (-Os) then the smaller function comes first. Actually the small function is void i2cWaitForComplete(void) { while( !(TWCR _BV(TWINT)) ); /* wait for the i2c

Re: [avr-gcc-list] BUG? Comparing of words error.

2006-01-18 Thread Flemming Steffensen (sent by Nabble.com)
Thanks Paulo, Eric, Marcus, David, Andras, Dave, Jeff, Francisco, Alan who has up to now answered my question and all others who will be doing so. Way back in my mind, I had this litle voice wispering interrupts... I just couldn't hear it over all the other and louder thoughts. Thanks for

Re: [avr-gcc-list] How to set section order

2006-01-18 Thread David Bourgeois
In the source code, the smaller function comes after but is located before in the .lss file. With optimization -O0, it's correctly located after. I attached the source code and the makefile (generated by avrstudio) I use if it can be of any help. Thanks On Wed, 18 Jan 2006 23:22:52 +0100,

[avr-gcc-list] sprintf problem

2006-01-18 Thread Parthasaradhi Nayani
Hello all, In one of my projects (ATMega128 based) I am using floating point numbers and sprintf to write a formatted record to a buffer. Tthe buffer contents is then sent to a mini printer. The first two records print properly and thereafter I am getting garbage from sprintf!! The