SRAM0B shutdown error

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SRAM0B shutdown error

ソリューションへジャンプ
1,215件の閲覧回数
simonwyss
Contributor III

Going in power-down mode works if I use the default setting (from the LPCopen example rtc.c):

/* Go to sleep leaving SRAM and the 32K oscillator powered during sleep. Use lower
voltage during sleep. */
Chip_POWER_EnterPowerMode(curr_pwr,
(SYSCON_PDRUNCFG_PD_SRAM0A | SYSCON_PDRUNCFG_PD_SRAM0B | SYSCON_PDRUNCFG_PD_32K_OSC)); ‍‍‍‍‍‍‍‍‍‍‍‍

 But wakeup doesn't work if I also shutdown the SRAM0B. Therefore only the first 8kB of the RAM stay active.

/* Go to sleep leaving SRAM and the 32K oscillator powered during sleep. Use lower
voltage during sleep. */
Chip_POWER_EnterPowerMode(curr_pwr,
(SYSCON_PDRUNCFG_PD_SRAM0A | SYSCON_PDRUNCFG_PD_32K_OSC));


My code uses the following space:
text data bss dec hex filename
40288 4 1004 41296 a150 MyCode.axf

In my opinion the bss is the required RAM size in bytes. This is much less than the size of the first 8kB of the SRAM0.

How can I solve this problem?

Thank you for your advice.

ラベル(2)
1 解決策
913件の閲覧回数
simonwyss
Contributor III

Thank you for your really detailed response. Your hint "Check where your stack is located." lead me to the right location :-)

Here the complete solution for others with the same problem:

Following table shows the RAM setup (old and new desired version, the SRAM block 1 and 2 are not used)
Table not in scale!

SRAM0 Address
Top (End, 64kB) 0x0200'FFFFTop of Stack (OLD place, wrong for my application) =  __top_RAM0_64
(End of first 8kB, SRM0A) 0x0200'2000 Top of Stack (NEW place for my application)
initial position of Stack pointer, growing downwards (in direction Bottom)
Bottom (Start) 0x0200'000

Variables in RAM (from Bottom up)

The Memory locations are defined in LPCxpresso in following path:
MyProject/Debug/myproject_Debug_memory.ld

The Stack and Heap location is set in following file:
MyProject/Debug/myproject_Debug.ld - on Line 179 and 180 witt the define __user_heap_base and __user_stack_top

The heap pointer is on reset by default on location ??? (I'dont know, I don't need the heap until now because I didn't use dynamic memory allocation with malloc)

The stack pointer is on reset by default on location __top_RAM0_64 = 0x0200'FFFF (This is outside of the first 8kB of RAM, therefore after the wakeup, the CPU was lost with corrupted memory, the stack was killed by memory shutdown :-) )

To change the stackpointer to 0x0200'2000 (top of first 8kB = SRAM0A) I set the following Linker Flag:
Project / Properties / C/C++ Build / Settings / Tool Settings / MCU Linker /  Add Flag:

--defsym=__user_stack_top=0x2002000 

This solution is from the following thread:
How to modify the stack location? 

Here is a list with topics concerning this question. 

Stack location
Heap allocation/checking in Redlib 

How can check stack level using IDE? 

Monitoring Stack Size 

How to use Watchpoints 


Move (data) location into different RAM blocks:
Placing data into different RAM blocks 

Move stack to RamAHB32 
Stack placed in RAM2 
How to modify the stack location? 

元の投稿で解決策を見る

2 返答(返信)
913件の閲覧回数
Dezheng_Tang
NXP Employee
NXP Employee

Check where your stack is located.

914件の閲覧回数
simonwyss
Contributor III

Thank you for your really detailed response. Your hint "Check where your stack is located." lead me to the right location :-)

Here the complete solution for others with the same problem:

Following table shows the RAM setup (old and new desired version, the SRAM block 1 and 2 are not used)
Table not in scale!

SRAM0 Address
Top (End, 64kB) 0x0200'FFFFTop of Stack (OLD place, wrong for my application) =  __top_RAM0_64
(End of first 8kB, SRM0A) 0x0200'2000 Top of Stack (NEW place for my application)
initial position of Stack pointer, growing downwards (in direction Bottom)
Bottom (Start) 0x0200'000

Variables in RAM (from Bottom up)

The Memory locations are defined in LPCxpresso in following path:
MyProject/Debug/myproject_Debug_memory.ld

The Stack and Heap location is set in following file:
MyProject/Debug/myproject_Debug.ld - on Line 179 and 180 witt the define __user_heap_base and __user_stack_top

The heap pointer is on reset by default on location ??? (I'dont know, I don't need the heap until now because I didn't use dynamic memory allocation with malloc)

The stack pointer is on reset by default on location __top_RAM0_64 = 0x0200'FFFF (This is outside of the first 8kB of RAM, therefore after the wakeup, the CPU was lost with corrupted memory, the stack was killed by memory shutdown :-) )

To change the stackpointer to 0x0200'2000 (top of first 8kB = SRAM0A) I set the following Linker Flag:
Project / Properties / C/C++ Build / Settings / Tool Settings / MCU Linker /  Add Flag:

--defsym=__user_stack_top=0x2002000 

This solution is from the following thread:
How to modify the stack location? 

Here is a list with topics concerning this question. 

Stack location
Heap allocation/checking in Redlib 

How can check stack level using IDE? 

Monitoring Stack Size 

How to use Watchpoints 


Move (data) location into different RAM blocks:
Placing data into different RAM blocks 

Move stack to RamAHB32 
Stack placed in RAM2 
How to modify the stack location?