Clear Ram Region or Global Variable

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Clear Ram Region or Global Variable

722 次查看
ramazan_kurban3
Contributor III

I need to clear ram region that use bootloader code before jump to firmware code. My global variables take up huge space in ram memory. I can't change these with dynamic variables. I use lpc1769.

How can I clear ram region or delete global variables. 

标记 (3)
0 项奖励
1 回复

678 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Ramazan,

This is the api function to fill memory with zero.

void bss_init(unsigned int start, unsigned int len) {
    unsigned int *pulDest = (unsigned int*) start;
    unsigned int loop;
    for (loop = 0; loop < len; loop = loop + 4)
        *pulDest++ = 0;
}

But it is not the main task to develop a function to fill memory, the main task is to know which memory space needs to be filled with zero, which memory space must not be filled. For example, the stack can NOT be filled, the application global variables can not be filled. so you have to check the link file to know the allocation of memory space and know what memory need to be filled or not.

Hope it can help you

BR

XiangJun Rong

0 项奖励