# No initialized variable in RAM

**URL:** <https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259>\
**Category:** Development tools\
**Created:** [April 14, 2007, 2:45pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259 "2007-04-14T14:45:29Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![hegler](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@hegler](https://forum.sierrawireless.com/u/hegler)\
**Post date:** [April 14, 2007, 2:45pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/1 "2007-04-14T14:45:29Z")

</div>

Hi,

i need to use in my application, global variable in no initialized RAM. Others compilers have pragma or special key for this type. Is there something else like this in open AT with Visual C++ ?

thanks,

Hegler

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [April 14, 2007, 7:42pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/2 "2007-04-14T19:42:32Z")

</div>

Perhaps if you explained what you are actually trying to achieve, people might be able to suggest appropriate ways to do it… ❓

---

<div class="post-metadata">

**Author:** ![hegler](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@hegler](https://forum.sierrawireless.com/u/hegler)\
**Post date:** [April 15, 2007, 11:26pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/3 "2007-04-15T23:26:50Z")

</div>

IÂ´m needing a type of variable that is not initialized when the application starts. I use two other compilers C, IAR and Dynamic C, and these compilers have two special keywords as â€œnoinitâ€ and â€œbbâ€ (backup battery). Thus the variables of these types never are initializedâ€¦

Examples :

// Global variables -\> Dynamic C compiler  
bb int aux;  
bb char x;

// Global variables -\> IAR C compiler  
noinit int aux;  
noinit char x;

such compilers never initialize those variables.

I know that, by default, all global variables are initialized with “0”, however i need other kind that donÂ´t be initialized with START UP C ROUTINE.

Hegler

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [April 16, 2007, 6:26am UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/4 "2007-04-16T06:26:56Z")

</div>

> [@hegler](#):
>
> I use two other compilers C, IAR and Dynamic C, and these compilers have two special keywords as â€œnoinitâ€ and â€œbbâ€ (backup battery).

These are probably for writing “stand-alone” applications, but your Open-AT application is not “stand-alone” - it is a Task running within the Wavecom environment.  
Therefore, even if you did read the GCC Manual and find the appropriate switch, it might not help you!

> [@](#):
>
> I know that, by default, all global variables are initialized with “0”, however i need other kind that donÂ´t be initialized with START UP C ROUTINE.

Again, why do you think you need this?

As I said before, if you explained what you are actually trying to achieve, people might be able to suggest appropriate ways to do it…

Remember: the value of an uninitialised variable is undefined at startup - so it is quite possible that it could be zero anyway! You code has to cope with this, so why is it a problem if the values does just “happen” always to be zero?? 😉

---

<div class="post-metadata">

**Author:** ![tomalex](https://avatars.discourse-cdn.com/v4/letter/t/71e660/32.png) [@tomalex](https://forum.sierrawireless.com/u/tomalex)\
**Post date:** [April 26, 2007, 9:54pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/5 "2007-04-26T21:54:38Z")

</div>

Hello,

I think he would like to hold the data in the memory, for example when a reset happens. But as awneil said, the Open AT application is a task, the memory is handled by the Wavecom OS. You can’t even be sure that you get the same part of the memory when you start your application. It is not impossible, but it must be strongly supported by the OS, which is not the case as far as i know.

Best Regards,  
tom

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [April 27, 2007, 6:32am UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/6 "2007-04-27T06:32:42Z")

</div>

> [@tomalex](#):
>
> I think he would like to hold the data in the memory, for example when a reset happens.

Yes, that would be my guess, too!

But, until he explains what he’s actually trying to do, it remains just a guess - so no real answers can be given.

Unfortunately, he seems to have lost interest now. ☹

---

<div class="post-metadata">

**Author:** ![ofernandez](https://avatars.discourse-cdn.com/v4/letter/o/838e76/32.png) [@ofernandez](https://forum.sierrawireless.com/u/ofernandez)\
**Post date:** [May 24, 2007, 10:50pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/7 "2007-05-24T22:50:35Z")

</div>

vars not initialized???  
what the hell is he talking about?  
if you ? what is the value? (globals are know of course)(locals are dirty)

i am sure he is doing another question

if he wants to get the var value if a resets happend of course there are a non volatile memory as all we know it is call ROM

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [May 25, 2007, 7:41am UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/8 "2007-05-25T07:41:55Z")

</div>

ROM wouldn’t help since that is Read Only Memory. So you wouldn’t be able to write it from the application at all! You probably mean Flash or EEPROM?

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![ofernandez](https://avatars.discourse-cdn.com/v4/letter/o/838e76/32.png) [@ofernandez](https://forum.sierrawireless.com/u/ofernandez)\
**Post date:** [May 25, 2007, 10:42am UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/9 "2007-05-25T10:42:56Z")

</div>

absolutely rigth, i was talking about in a general way.

indeed flash is an EEPROM with block size reading and writing

---

<div class="post-metadata">

**Author:** ![hegler](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@hegler](https://forum.sierrawireless.com/u/hegler)\
**Post date:** [May 26, 2007, 2:40am UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/10 "2007-05-26T02:40:44Z")

</div>

Hi all,  
I will try to justify myself better. By default, all global variable are initialized by startup code, that run before the call to the main function. Start up initialize global variables, initialize also the stack and all memory space that will be used by the program. That is valid in such a way for the development of software or firmware. In some compilers is possible to use global variables that donÂ´t be initialized by start up code. These variables are kept in memory regions, where the CPU preserves them with battery, thus when the equipment if disconnect such values is not lost. In my application I need an variable that is not initialized by startup code and that it keeps its value in case that the equipment is kept energized, if equipment restart for many times without it is turned off, the value of those variables must be preserved and will have to lose its value when the equipment will be off.  
I know that in Wavecom modules have OS in a layer before the application and when its restart the OS run before the application !! (is it correct ?). However, those variables type (not initialized) may not be possible.  
That is my problem, know if equipment was turned on or restarted !!  
Someone have any idea ?

Thanks,  
and sorry for my english !!

Hegler

---

<div class="post-metadata">

**Author:** ![ofernandez](https://avatars.discourse-cdn.com/v4/letter/o/838e76/32.png) [@ofernandez](https://forum.sierrawireless.com/u/ofernandez)\
**Post date:** [May 26, 2007, 2:33pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/11 "2007-05-26T14:33:47Z")

</div>

> [@](#):
>
> These variables are kept in memory regions, where the CPU preserves them with battery

1. the first thing is to know if this is posible in your wavecom module.

2. if the feature it is availble, can you asign your var at some location in wavecom OS?

3. if your var it is not update to much you can keep it in the eeprom, and playwith that.

from my point of view point number 1 it is need, if you do not have such behaviour your question it is out of coverage.

---

<div class="post-metadata">

**Author:** ![hegler](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@hegler](https://forum.sierrawireless.com/u/hegler)\
**Post date:** [May 26, 2007, 3:42pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/12 "2007-05-26T15:42:02Z")

</div>

hi ofernandez,

iÂ´m using 24NG with 6.57 firmware and OAT 3.13.

answer !

1. the first thing is to know if this is posible in your wavecom module.  
I’m sure that is possible with that module, however if OS allows it !! i don’t know…

2. if the feature it is availble, can you asign your var at some location in wavecom OS?  
That is what I want !! How can I do it ?

3. if your var it is not update to much you can keep it in the eeprom, and playwith that.  
This is not possible, because when module were turned off, the variable don’t lose its value, and in my application it is very important !

Hegler

---

<div class="post-metadata">

**Author:** ![tomalex](https://avatars.discourse-cdn.com/v4/letter/t/71e660/32.png) [@tomalex](https://forum.sierrawireless.com/u/tomalex)\
**Post date:** [May 27, 2007, 3:16pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/13 "2007-05-27T15:16:46Z")

</div>

Hello hegler,

I’ve already told you that my opinion is that this is not supported by the OS 6.57 and i don’t think it will be in the future, but i’ve heard something about an external RAM feature in the future OS 6.6x versions. Unfortunately i have no more information about that, but my guess is, that it is going to be what you need. Please contact your distributor to get information for you about this feature. If your development is in an early phase, i suggest changing to q268x processor because you will miss the new things in the future.

Best Regards,  
tom

---

<div class="post-metadata">

**Author:** ![ofernandez](https://avatars.discourse-cdn.com/v4/letter/o/838e76/32.png) [@ofernandez](https://forum.sierrawireless.com/u/ofernandez)\
**Post date:** [May 27, 2007, 3:25pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/14 "2007-05-27T15:25:08Z")

</div>

> [@](#):
>
> This is not possible, because when module were turned off, the variable don’t lose its value, and in my application it is very important

well when the app start init the var, how easy

it is dificult to me understand that you want to keep a value when the app it is not running, but when the app run againg you do not want to use it, how and who will use this value then?

if procesor is running the app is running, the only way to stop the app it is turning off the procesor  
whe n you turn on agains then all will be restarted

i do not know if you are asking for low power modes? (the app still running in power save mode)

---

<div class="post-metadata">

**Author:** ![tomalex](https://avatars.discourse-cdn.com/v4/letter/t/71e660/32.png) [@tomalex](https://forum.sierrawireless.com/u/tomalex)\
**Post date:** [May 27, 2007, 4:00pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/15 "2007-05-27T16:00:46Z")

</div>

Why is it so difficult to understand?  
It could be very useful to keep logging information or measurement datas on that and you don’t have to worry about flash memory cycles, altough today’s flashes are quite durable.  
Just think about GPS receivers, what do you think how can they achive warm and hot starts ( \< 1 sec )?

Cheers,  
tom

---

<div class="post-metadata">

**Author:** ![hegler](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@hegler](https://forum.sierrawireless.com/u/hegler)\
**Post date:** [May 27, 2007, 5:07pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/16 "2007-05-27T17:07:59Z")

</div>

hi tom

thank you very much. Unfortunately i’ll find another way…to solve my problem.

Hegler,

---

<div class="post-metadata">

**Author:** ![tomalex](https://avatars.discourse-cdn.com/v4/letter/t/71e660/32.png) [@tomalex](https://forum.sierrawireless.com/u/tomalex)\
**Post date:** [May 28, 2007, 5:23pm UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/17 "2007-05-28T17:23:07Z")

</div>

Maybe SPI RAM?

cheers

---

<div class="post-metadata">

**Author:** ![hegler](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@hegler](https://forum.sierrawireless.com/u/hegler)\
**Post date:** [May 29, 2007, 2:24am UTC](https://forum.sierrawireless.com/t/no-initialized-variable-in-ram/1259/18 "2007-05-29T02:24:00Z")

</div>

Yes, it’s a good idea ! I already use SPI to control logic in FPGA. Then iÂ´ll implement only one register with flip-flop there and so… all right.

thank you so much,

Hegler
