SPI Slave fails when code is built with -O1 optimized flag

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

SPI Slave fails when code is built with -O1 optimized flag

1,434 次查看
cwati
Contributor III

Hi there,


We're using MK22FN256xxx12, running bare metal KSDK 1.0.0 (I know it's old, but we don't have the resource to update it yet).  The SPI on this board is running as a slave to a master (Nordic NRF51822 chip).  When the Kinetis code is built regularly, everything runs ok.  But recently we're short on space so I tried to build with optimized (I tried specifically with "-O1").  When I do that, then SPI slave starts failing.  The data coming into K22F is okay generally, but the data going to Nordic is so messed up it's unusable.

Has anyone ever experienced this?  Is this caused by something trivial, perhaps some Compiler settings that I can modify?

In general I do see when building with Optimized (C/C++ Build->Settings->Optimization Level->Optimize...) then the system degenerates.  But I've never tried to pinpoint exactly where it's happening.  This time, it's very reproducible and obvious.

Thanks,
Cecylia

标签 (1)
0 项奖励
回复
2 回复数

1,252 次查看
cwati
Contributor III

Seems like my code works better if I choose to disable loop invariant move.

pastedImage_1.png

0 项奖励
回复

1,252 次查看
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Cecylia,

It is good to hear you found a workaround. Since KSDK 1.0.0 is an old version, it is no longer available for download so I can't reproduce what you mention. I would recommend that you use the new MCUXpresso SDK 2.x, there have been some bug fixes and improvements since version 1.0.0.


Hope it helps!

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 项奖励
回复