Why does code become twice as large in mcuxpresso

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

Why does code become twice as large in mcuxpresso

跳至解决方案
988 次查看
Kratz
Contributor IV

I am converting a working bare metal project from IAR kickstarter to MCUXpresso to take advantage of the unlimited code size.  Without making any changes to the program other than using the macros provided the code doubled in size. When contrasting at the IAR and MCUXpresso .map files I noticed the lines on IAR are 16 bits wide and 32 bits wide in Xpresso.  The instruction size becomes just more than twice as large.  What setting needs to be changed in Xpresso?

name                              location & width    instruct size  (IAR)

get_key_status               0x1a59                 0x66             Code  Gb  io.o [1]

name                           location & width    instruct size  (Xpresso)

.text.get_key_status  0x00000728            0xe8             ./source/io.o   0x00000728  get_key_status 

0 项奖励
1 解答
903 次查看
converse
Senior Contributor V

1. It looks like you have built MCUXpresso with debug and no optimisation. This greatly affects the code size. By default, MCUXpresso provides two type of build: Debug and Release. Debug builds with all debug information and no/minimal optimisation to aid debugging. Release builds include optimisation - but you can change the optimisation level to suit you needs (speed vs size) - see this FAQ for more information

https://community.nxp.com/thread/388981 

2. I don't know where you got instruction size from. All Cortex-M parts (M0, M1, M3, M4, M33, M7 etc) are Thumb processors which use 16-bit instruction width. MCUXpresso builds the correct instructions

在原帖中查看解决方案

2 回复数
903 次查看
Kratz
Contributor IV

You are correct that the optimization was the issue. The code size reduced from 37K down to 28.5K. Thank you!!!

0 项奖励
904 次查看
converse
Senior Contributor V

1. It looks like you have built MCUXpresso with debug and no optimisation. This greatly affects the code size. By default, MCUXpresso provides two type of build: Debug and Release. Debug builds with all debug information and no/minimal optimisation to aid debugging. Release builds include optimisation - but you can change the optimisation level to suit you needs (speed vs size) - see this FAQ for more information

https://community.nxp.com/thread/388981 

2. I don't know where you got instruction size from. All Cortex-M parts (M0, M1, M3, M4, M33, M7 etc) are Thumb processors which use 16-bit instruction width. MCUXpresso builds the correct instructions