Clear Ram Region or Global Variable

表示  限定  | 次の代わりに検索 

Clear Ram Region or Global Variable

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. 

0 件の賞賛
1 返信

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


XiangJun Rong

0 件の賞賛