This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using Optimisation in nRF 51822 (Keil)

Hi,

I am using nRF51822 Evaluation Kit along with keil uvision4. Will using optimization in keil IDE make any problem in the normal working of BLE project? Will it affect the delay function ? My code size is nearly 35KB. I am using the Keil demo version. It can compile only 32KB. So i am using the optimization level 1.Please let me know if it affect the normal working.My project is entirely depending on timings.

Thanks and regards,
Shiju

Parents
  • The optimization should not affect the normal working of the program. My projects which are also time-dependent work correctly using any level of optimization.

  • Still, in that case, I don't think that the Keil compiler is the one to blame. I have done a lot of projects not only in Keil but also in other development environments with 10000+ lines of code and various components and even though they are all heavily optimized, I have never encountered a problem.

    I would take a look at the code itself. The compiler is absolutely free to change your program as long as it preserves the so called "side effects" (please study Google more for further explanation). Thus, the code after optimization is far different from your original code. Let me give you an example:

    for(i=0;i<64;i++) {}
    

    The compiler is absolutely free to remove this part of code because it does not create any side effects. There are many other examples of it. If your application depends somehow (i.e. creates a delay) on those constructions, I suggest to redesign it.

Reply
  • Still, in that case, I don't think that the Keil compiler is the one to blame. I have done a lot of projects not only in Keil but also in other development environments with 10000+ lines of code and various components and even though they are all heavily optimized, I have never encountered a problem.

    I would take a look at the code itself. The compiler is absolutely free to change your program as long as it preserves the so called "side effects" (please study Google more for further explanation). Thus, the code after optimization is far different from your original code. Let me give you an example:

    for(i=0;i<64;i++) {}
    

    The compiler is absolutely free to remove this part of code because it does not create any side effects. There are many other examples of it. If your application depends somehow (i.e. creates a delay) on those constructions, I suggest to redesign it.

Children
No Data
Related