How do I declare certain RAM variables that are NOT initialized at reset?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Hi,

I'm trying to aggressively use a hibernate mode and a WDT is intended to pull the CPU out of hibernation.

However, I need to preserve some data through the WDT reset.

Is there a keyword declaration to place certain RAM variables in an area of memory that does not get initialized immediately after a reset?

I'm aware of the .bss section of RAM.  However after multiple searches among the compiler .h files, I could not find a declarative keyword that would force RAM variables to this area of memory.

I suspect I'm missing something obvious.  Help would be appreciated. 

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
1 Solution

pacr,

Excellent question.  Thanks for your interest in this question.

I'm new to low-power operation.

I just found two pieces of information related to my original post.

Info #1 - Using the WDT in Hibernation mode.

The WDT is disabled in Hibernation mode.  This is because the Hibernation regulator that is only available in Hibernation mode removes the power from the ILO.  Since the ILO drives the CTW of the WDT, the WDT is automatically disabled.

Therefore my attempt to use the WDT in hibernation mode is IMPOSSIBLE!!!  (Need to rethink this design direction.)

Info #2 - Placing variables in noinit .bss memory.

I believe I have found my answer to my original post.

If I add a CY_NOINIT as a keyword to my RAM variable, it appears to survive any nonvoltage-related Resets.

Voltage-related resets could affect the reliability of the RAM data contents.  A well set LVD threshold could preserve the RAM contents if the SW is designed properly.

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
4 Replies
pacr_284376
Level 5
Level 5
100 replies posted 10 solutions authored 50 sign-ins

Why are you using WDT to pull CPU out of hibernation ? Can't you use another wakeup event (some other timer) ?

0 Likes

pacr,

Excellent question.  Thanks for your interest in this question.

I'm new to low-power operation.

I just found two pieces of information related to my original post.

Info #1 - Using the WDT in Hibernation mode.

The WDT is disabled in Hibernation mode.  This is because the Hibernation regulator that is only available in Hibernation mode removes the power from the ILO.  Since the ILO drives the CTW of the WDT, the WDT is automatically disabled.

Therefore my attempt to use the WDT in hibernation mode is IMPOSSIBLE!!!  (Need to rethink this design direction.)

Info #2 - Placing variables in noinit .bss memory.

I believe I have found my answer to my original post.

If I add a CY_NOINIT as a keyword to my RAM variable, it appears to survive any nonvoltage-related Resets.

Voltage-related resets could affect the reliability of the RAM data contents.  A well set LVD threshold could preserve the RAM contents if the SW is designed properly.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hi Len.

This thread may provide the clues you need.
Solved: Reading the correct reset status from a bootloadbl... - Infineon Developer Community

I know the thread discusses sharing memory between bootloader and bootloadable, but the key take away is, not allowing the RAM memory section to get changed.

0 Likes

BiBi,

Thanks for your reply.  I will look into it.

However I found a keyword CY_NOINIT appears to work under multiple tests.

A quick perusal of the link you supplied may be more valuable to share data between two applications (bootloader/bootloadable)  without init when transferring operation between the two apps.

It is more complicated since there is a special section declaration that is shared across the apps.

In my specific case, the data is only used in the same App therefore the CY_NOINIT  simplifies the C code and linker definitions.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes