I am stumped by some code where a straightforward statement causes instant bloating of my code.
I am using an ATmega8. Compiler option -Os. My code is sitting at approx 4.2K and then I add the statement
#define _6ML 52.000/0.025 #define _6MH 54.000/0.025 uint16_t channel; if((channel>=_6ML)&&(channel<_6MH)) TX_INHIBIT=0; else TX_INHIBIT=1;
This causes the code to goto to about 6.8 K.
When I look at the hex output it appears to add at the top of the code an array of binary numbers 00,01,01,02,02,02,02,02,(8x03),(16x04),(32x,05),(64x06), etc where the number of numbers increase exponentially, which the dis-assembler treats as non-sense.
This of course does not happen when I do it in a test program. Currently I have the code patched out to enable me to proceed!
In the same code I want to add a 2X16 LCD, so I added the lcd functionality from the WinAVR examples and presto, instant bloat code to exceed toe 8K limit.
When I investigate this, I find by patching out a code] _delay_us(40);[/code] in the HD7780 code
and then I come back to about 4.6K
I use _delay_ms(), elsewhere in one of my modules and it seems to behave OK.
I was not able to find out what the bloat code looks like as no binary is generated.
The remaining code generated so far works OK in the target system(without the comparison & LCD of course). Has anyone come accross this bloating problem, who may be able to throw some light on it.
(I gather one of Murphy, Darwin or Lord Thompson has finaly got me!)