This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to set optimisation level in SES 5.34a (Nordic version)

Hi,

As in the subject, I cannot find where to change the optimisation level.  I am working with the Zephyr bluetooth sample project - peripheral_hr.

I have found a previous post on this topic (Case ID 213802) that says to right click on the project->Options-Code Generation->Optimisation Level.

In my setup, the only project where the Options menu item is not greyed out is this one:

and the displayed window does not have a Code Generation and Optimisation selection.

So how do I set the optimisation?

Regards,

AC

Parents Reply Children
  • Thanks for this.  I didn't say but I'm using the nrf5340 which has two core. Changing the settings in prj.conf seems to impact optimisation for both the network and the application cores.  I don't want to change the optimisation for the network core (the bluetooth stack) - only the application core.  Where do I adjust the settings for just the app core?

    Regards,

    AC

  • If you change the optimization configuration in the samples prj.conf, then that will not affect the network core.

    -Amanda H.

  • OK. So I've changed the optimisation in prj.conf to (and rebuilt the system):

    CONFIG_NO_OPTIMIZATIONS=y

    This change causes this crash:

    Next, I changed the main stack size up in increments of 256 bytes. At 1536 bytes it still crashes:

    Increasing it to 2048 bytes cases a hard fault:

    When the stack size is set to 1536 bytes, the map file (.../build/zephyr/zephyr.map) shows:

     - a logging stack of 1024
     - an interrupt stack of 2048
     - a main stack of 1536
     - a work queue stack of 1024

    FYI - The faulting instruction in the Usage Fault images (0x0002b202) is somewhere in a kernel mutex.

    Any recommendations on how to turn optimisation off and still get the app to run?

    REgards,

    ac

  • Hi AC, 

    Sorry for the dealy. 

    Could you try the following config in the prj.conf?

    CONFIG_NO_OPTIMIZATIONS=y
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_BT_RX_STACK_SIZE=4096

    -Amanda H.

  • Hi Amanda,

    Many thanks for your reply. Apologies for the slow response but I had to step away for a few days.

    I have tried your suggestion but, unfortunately, there is no change in behaviour.  I updated prj.conf as you suggested:

    CONFIG_NO_OPTIMIZATIONS=y
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_BT_RX_STACK_SIZE=4096
    

    Then I quit SES, deleted the build folder to force a project rebuild then re-built the project for debug and ran it on the DK.  As you can see from the screenshot, I'm still getting a hard fault after a few seconds of running.

    There isn't much useful on the stack trace:

    Kind regards,

    AC

Related