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

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

[avr-gcc-list] Confusing static method RAM usage.


From: Marcin S
Subject: [avr-gcc-list] Confusing static method RAM usage.
Date: Sat, 17 Dec 2011 10:20:23 +0100

Hello,
I'm trying to figure out what's wrong with this code, I have this
STATIC method in PanelPellet class

CNapisy::TTextId PanelPellet::getStateString(uint16_t state)
{
        switch (state)
        {
                case ST_PRACA_RECZNA:
                        return CNapisy::IDT_TEXT_PRACA_RECZNA;
                        break;

                case ST_OFF:
                        return CNapisy::IDT_TEXT_WYLACZONY;
                        break;

                case ST_PALENIE_RECZNE:
                case ST_PALENIE_RECZNE_PRZEDMUCH_PRACA:
                case ST_PALENIE_RECZNE_PRZEDMUCH_PRZERWA:
                        return CNapisy::IDT_TEXT_PALENIE_RECZNE;
                        break;

                case ST_PODSYP:
                case ST_OPOZNIENIEROZPALANIA:
                case ST_PRZERWAROZPALANIA:
                case ST_PRACAROZPALANIA:
                        return CNapisy::IDT_TEXT_ROZPALANIE;
                        break;

                case ST_PRACA:
                case ST_PRZERWA:
                        return CNapisy::IDT_TEXT_PRACA;
                        break;

                case ST_PRACAMODULACJI:
                case ST_PRZERWAMODULACJI:
                        return CNapisy::IDT_TEXT_PRACA_MOD;
                        break;

                case ST_PRACAPRZEJSCIA:
                case ST_PRZERWAPRZEJSCIA:
                        return CNapisy::IDT_TEXT_FAZA_PRZEJSCIA;
                        break;

                case ST_PRZERWAPODTRZYMANIA:
                case ST_PRACAPODTRZYMANIA:
                case ST_OPOZPODAJNIKA:
                case ST_OPOZNADMUCHU:
                        return CNapisy::IDT_TEXT_PODTRZYMANIE;
                        break;

                case ST_WYLACZANIE:
                case ST_WYLACZANIE_DOSYP_CZEKAJ:
                case ST_WYLACZANIE_DOSYP:
                case ST_WYLACZANIE_RUSZTAWSTEPNIE:
                case ST_WYLACZANIE_2NDPHASE:
                case ST_WYLACZANIE_DOSYP2:
                case ST_RUSZTAOCZYSC:
                        return CNapisy::IDT_TEXT_WYGASZANIE;
                        break;

                default:
                        return CNapisy::IDT_PONIEDZIALEK_SHORT;
                        break;
        }
}

"state" switch parameter is simple uint definition for example
#define ST_SOMETHING 10
nothing special, and CNapisy::TTextId is enumeration type of CNapisy class.

Problem:
When I use this method in my program then according to avr-size, RAM
memory usage jumps by 168 bytes! Why? I thought this should not take
any RAM until execution, am I right?
or maybe I misinterpreting avr-size output, Can someone explain please?


before:
AVR Memory Usage
----------------
Device: atmega128

Program:   73812 bytes (56.3% Full)
(.text + .data + .bootloader)

Data:       3209 bytes (78.3% Full)
(.data + .bss + .noinit)

EEPROM:      197 bytes (4.8% Full)
(.eeprom)


after:
AVR Memory Usage
----------------
Device: atmega128

Program:   74100 bytes (56.5% Full)
(.text + .data + .bootloader)

Data:       3377 bytes (82.4% Full)
(.data + .bss + .noinit)

EEPROM:      197 bytes (4.8% Full)
(.eeprom)

I know it's not much info here, but i don't know where to start
diagnosing, and I can't provide whole project code. I'll try to
provide as much details as possible, when needed.

Cheers.



reply via email to

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