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?