Code Optimisation

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
797件の閲覧回数
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 解決策
510件の閲覧回数
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 返信
511件の閲覧回数
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!
-----------------------------------------------------------------------------------------------------------------------