Thursday, November 6, 2014

RAM/Flash Usage in Embedded C Programs

 

Read-only memory(Flash)

Data Section

int data_variable = 500;

Read-only date



constant

const int read_only_variable = 2000;

Text(code)



“literal pool” may in the function.


void my_function(void){
int x;
x = 200;
printf("X is %d\n", x);
}

Read-Write Data(RAM)


Data section


int data_var = 500; //require flash memory to stored.

BSS section


int bss_var0;
int bss_var1 = 0;
//doesn’t need require flash memory to stored.

Heap section


static int static_var;
buffer = malloc(512);

Stack section


int my_function(int a, int b, int c, int d)

Reference


[1] http://coactionos.com/embedded%20design%20tips/2013/10/18/Tips-RAM-Flash-Usage-in-Embedded-C-Programs/

No comments:

Post a Comment

Register Transfer Level Design with Verilog (1) [ebook]

設計程式之所以有趣不外乎是它的千變萬化,同樣的結果卻有不同的寫法。 但這些不同寫法當中也並沒有分誰對誰錯,也沒有制定標準來規範何事該用何解。 這也就是我們設計者的珍貴!! [1] Primitive Instantiations 在Verilog中最基本的邏輯...