cancel
Showing results for 
Search instead for 
Did you mean: 

Keil and CubeIDE build the same code with difference (work is different)

SFrol.1
Associate

Hello. I use STM32F207 MCU and CubeMX for code generation. I generate template for Keil.

Then I add little test code that drives LCD through FSMC bus. It's OK. I achieved at least 40fps in my LCD. This is fine.

But Keil requires a good price for license. For this reason I tried to generate my project for STM32CubeIDE. All steps the same as above with Keil. A add test code for LCD... But the hell happens. My LCD updates not faster than 10 fps. What the hell??

How can I research and fix this issue?? I turned off all optimization. But hex built with CubeIDE makes me confused.

7 REPLIES 7
Pavel A.
Evangelist III

The life is too short and your time is precious. Just pay them what they deserve? :)

/* and enjoy their fast professional support */

TDK
Guru

If you're going for speed, maybe turn optimization back on? Why is it off?

Hard to say without knowing what your code is doing.

If you feel a post has answered your question, please click "Accept as Solution".
mattias norlander
ST Employee

Something is apparently running slower in CubeIDE. But what? Impossible to tell at this point...

  • In your debug config enable SWV tracing.
  • Then in the debug session enable PC sampling. This will allow you to sample the PC counter while executing your code.
  • If you need create an extra test harness which only exercises the LCD code.
  • Execute the LCD code for a few seconds and see where you get the most PC sample matches.

Both CubeIDE and Keil should offer this tracing feature.

Now you will know where the CPU spends its cycles. Give it a try and see if you can narrow the problem down.

Please share your findings!

@mattias norlander​ could you explain how to use the PC sampling in CubeIDE to see which functions or parts of code consume most time?

mattias norlander
ST Employee

Hello Pavel,

Have a look at this video: https://www.youtube.com/watch?v=BZKzwn5w1D8

SWV PC-sampling part is covered starting at 4:25 - 6:25.

You also have to enable SWV in the debug configuration before trace can work at all. This is described in the User Guide but should be easy! :)

mattias norlander
ST Employee

If you manage to narrow the issue down to some call sequences you could also try to use a timer to set some time stamps when you enter and exit a call sequence to benchmark certain sequences of CubeIDE binaries vs Keil binaries.

mattias norlander
ST Employee

Did you ever solve the issue. Any feedback to share?