Hello,
I am working with KDS with Towerkit TWR0K60D100M. I created my project in Processor expert mode.
By building my project using SysV format. I got like below,
section size addr
.interrupts 1024 0
.flash_config 16 1024
.text 129716 1040
.ARM 8 130756
.init_array 4 130764
.fini_array 4 130768
.data 904 536806400
.m_interrupts_ram 1024 536805376
.bss 67300 536807328
.heap 53252 536874628
.stack 512 536927880
.ARM.attributes 42 0
.debug_info 507910 0
.debug_abbrev 74434 0
.debug_loc 228149 0
.debug_aranges 12400 0
.debug_ranges 15624 0
.debug_macro 349650 0
.debug_line 339463 0
.debug_str 1972414 0
.comment 112 0
.debug_frame 37204 0
.stab 156 0
.stabstr 387 0
Total 3791709
What is this Total bytes? why it is too much large?? Beyond the range of RAM?
When I print size unsing Berkley format , I got like this,
text data bss dec hex filename
0x1fecc 0x390 0x1dce8 253764 3df44 Test_Project.elf
bss + data = 0x1dce8 + 0x390 = 123000 bytes used.
Total RAM available is 128KB in module.
When I manually calculate the ram like, structures used in my project, global variables and task stacks , Total RAM I calculate is only 37000 bytes.
Now when I declared, say array of 9000 bytes , I am getting error like, "m_data segment overflow by 986 bytes....."
why this is so?
Tell me how can I find Current Free RAM? In codewarrior I was using below functions, but I was unable to find this in KDS.
_mqx_get_initialization() and ()_mem_get_free()
Regards
Utsavi Bharuchwala
Hello Utsavi Bharuchwala,
1. "Total RAM available is 128KB in module. "
While the SRAM is split into two equally-size logical arrays, SRAM_L and
SRAM_U, so on your chip each one is 64KB. Please check the default linker file "ProcessorExpert.ld",:
the .data and .bss part all placed into m_data, not use m_data_20000000.
So "bss + data = 0x1dce8 + 0x390 = 123000 bytes used." 123000 > 64KB , overflow.
2. Please check the *.map file under your project->debug why the bss is so large.
About the bss in Eclipse please check this thread:
text, data and bss: Code and Data Size Explained | MCU on Eclipse
3.In your project, please don't use printf() print to console view, it adds greatly to
the code size of application and stack.
4.You can relocate the large data into the second RAM " m_data_20000000"
refer to : Relocating Code and Data Using the KDS GCC Linker File for Kinetis
Hope it helps
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Alice,
I have
const int_16 Buffer[8000]; //changing approx 15 times per month
This buffer store in Flash as a RAM, but i want to know limit of Flash write cycle? What is a life of flash memory?
Can I use Flash as RAM in this case?
Regards
Utsavi Bharuchwala
Hello Utsavi,
1. In your linker file , the two RAM part SRAM_L and SRAM_U have merged to one m_data (RW) .
2.About the method of store huge arrays into flash memory, please also refer to this DOC:
Relocating Code and Data Using the KDS GCC Linker File for Kinetis
3.About the Flash life cycle , please check on the Data Sheet of your chip:
Hope it helps
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Yang,
Thanks for information.
In linker file, HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0xD000;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0200; What is that indicating??
When I tried to reduce heap size from 0XD000 to 0xC000 error of heap overflow error is solved....!! But my code is not running in this case what to do?
I am not using any malloc or calloc functions in my project, but I am assuming that the internal files may be using it. But my query here is why large size heap is defined?
When I am declaring it as 0x0000, it is not giving me an error. Then what is the purpose of it??
Is it the right method to solve??
Regards
Utsavi Bharuchwala
Hi Utsavi,
Maybe the Heap is too big to other data overflow RAM, so when you reduce the Heap size there is no error .
BR
Alice
Hi Yang ,
Thanks for reply.
I can see that my bss start address is : 0x1fff07a0 and bss end address is : 0x200012e4 in .map file, so total bytes in bss is 68420.
And in between this bss range, variables are mapped.There is something like (*COMMON) segment which are also included in bss. what is that?
One more thing there is no separate m_data_20000000 segment provided in my linker file. Segment in linker file is,
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_interrupts_ram (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00000400
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0
m_data (RW) : ORIGIN = 0x1FFF0400, LENGTH = 0x0001FC00 /*(130048 bytes)*/
}
How can I reduce bss size in KDS? How can I store huge arrays into flash memory if possible?
Regards
Utsavi Bharuchwala