[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Confusing static method RAM usage.
From: |
Marcin S |
Subject: |
Re: [avr-gcc-list] Confusing static method RAM usage. |
Date: |
Sat, 17 Dec 2011 13:09:00 +0100 |
I never said this code does not compile.
> Without code that can be compiled, without compiler version and compiler
> options it's just guessing around.
>
> As we have no code that compiles (noone has PanelPellet, CNapisy, ST_OFF
> ...) look at the genrated code and what takes the additional RAM.
lets get rolling then
using avr-gcc-4.5.3
build opts are:
avr-gcc -c -mmcu=atmega128 -x c++ -gdwarf-2 -DF_CPU=3686400UL -Os
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
-fno-exceptions -Wall -Wundef -ffunction-sections -fdata-sections
-Wa,-adhlns=OBJ/PanelPellet.lst -I. -IhrdDefs -ImyClasses -MMD -MP
-MF .dep/PanelPellet.o.d PanelPellet.cpp -o OBJ/PanelPellet.o
>> I thought this should not take any RAM until execution, am I right?
>
>
> Obviously, not. You tried -fno-tree-switch-conversion?
Obviously there's no reson it should.
-fno-tree-switch-conversion does not making any difference.
I prepared some related code snippets that should give You general
idea how its organized.
http://pastebin.com/96dWVww8
Yet, this example code compiling just fine and avr-size report 0 bytes
RAM used, just as it should.
And there is something i discovered just min ago, when I modify
static CNapisy::TTextId getStateString(uint8_t state)
to
static uint16_t getStateString(uint8_t state)
and change all returns to return some decimal values, it does not
increase ram usage.
Marcin
2011/12/17 Georg-Johann Lay <address@hidden>:
> Marcin S wrote:
>>
>> Hello,
>> I'm trying to figure out what's wrong with this code, I have this
>>
>> [bunch of code that does not compile]
>>
>>
>> When I use this method in my program then according to avr-size, RAM
>> memory usage jumps by 168 bytes! Why?
>
>
> There may be all sorts of explanation for that.
>
> Without code that can be compiled, without compiler version and compiler
> options it's just guessing around.
>
> As we have no code that compiles (noone has PanelPellet, CNapisy, ST_OFF
> ...) look at the genrated code and what takes the additional RAM.
>
>
>> I thought this should not take any RAM until execution, am I right?
>
>
> Obviously, not. You tried -fno-tree-switch-conversion?
>