Code Optimisation

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

Code Optimisation

跳至解决方案
1,003 次查看
syed_idris
Contributor III

Hi,
We are using KL03 chip with KDS 3.1.0 and PE , "debug console" and "fsl-i2c" components from PE are used, In the code when I am adding some mathematical calculations of float values, the memory is getting overflowed and showing errors as

 

make: *** [test.elf] Error 1 
region `m_text' overflowed by 1092 bytes 
region m_text overflowed with text and data 
test.elf section `.text' will not fit in region `m_text' 

 

  • How to optimize the code so that we can get same code working ?
  • How to use the optimization levels as available in project properties ?
标签 (1)
标记 (3)
0 项奖励
回复
1 解答
716 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi syed idris 

The problem is because of  the code size in .text is too big to fit in m_text section. Unfortunately Processor expert comes with overhead due to the implement of code that is no used, it will increase your size code and it’ll be a little difficult to reduce 1092 bytes your size code.

 You can try the -Os in the settings options

BalaSNXPDoubt1.jpg

Can you share your project? if you are no using OSA components other options are; Instead of using Peripheral Driver, use just HAL APIs. PD functions have OSA support and it's not suitable for optimum code size, but sure, this highly depends in your application, when HAL APIs are used, the OSA can be removed then to reduce size. Also you can remove utilities under platform, the debug utility can be removed to reduce size.

You can also check the post: https://mcuoneclipse.com/2012/11/11/optimizing-the-kinetis-gcc-startup/ 

Hope this information help you
Have a great day,
Jorge Alcala

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

1 回复
717 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi syed idris 

The problem is because of  the code size in .text is too big to fit in m_text section. Unfortunately Processor expert comes with overhead due to the implement of code that is no used, it will increase your size code and it’ll be a little difficult to reduce 1092 bytes your size code.

 You can try the -Os in the settings options

BalaSNXPDoubt1.jpg

Can you share your project? if you are no using OSA components other options are; Instead of using Peripheral Driver, use just HAL APIs. PD functions have OSA support and it's not suitable for optimum code size, but sure, this highly depends in your application, when HAL APIs are used, the OSA can be removed then to reduce size. Also you can remove utilities under platform, the debug utility can be removed to reduce size.

You can also check the post: https://mcuoneclipse.com/2012/11/11/optimizing-the-kinetis-gcc-startup/ 

Hope this information help you
Have a great day,
Jorge Alcala

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------