changing app optimization level of application only works with debug bootloader

Hi,

I have the following 2 scenarios:

Scenario 1: I create an image with nrfutil containing SD, App and debug bootloader. I flash this image and it works. Then I change the optimization level of the app, and I flash the app only, this works.

Scenario 2: I create an image with nrfutil containing SD, App and "normal" bootloader. I flash this image and it works. Then I change the optimization level of the app, and I flash the app only. Now the application won't boot. Because there is no debug information from the bootloader I can't see with logging what's going on.

I compared the 2 sdk_config.h files of the debug and "normal" bootloader, but I can only see that it has to do with logging. Other settings are the same.

What can cause the issue that only with a debug loader I'm able to flash an application with a different optimization level?

Parents
  • Hi, 

    Scenario 2: I create an image with nrfutil containing SD, App and "normal" bootloader. I flash this image and it works. Then I change the optimization level of the app, and I flash the app only. Now the application won't boot. Because there is no debug information from the bootloader I can't see with logging what's going on.

    Do you also program with the Bootloader settings page? Could it work without optimization?

    Regards,
    Amanda

  • Do you also program with the Bootloader settings page?

    Yes, in both scenario's I initially program with the bootloader settings page.

    Could it work without optimization?

    If I execute scenario 2, and then after I flash an application without optimization it works.

    However, what I found out is that it's not the optimization, but the fact that the application is different. Because when I use the same optimization level, and make a small change in the app, it's also not booting.

    I don't have this problem with the _debug bootloader, which I don't understand because the only difference is the logging as far as I know.

  • What do you charge? Is it another application? How do you flash the application, by nRF Programmer app or nrfjprog -e?

    Same application, but I just change a minor thing in the application so that it generates different binary code. I program with nrfjprog --program [application] --sectorerase --reset

    Maybe you could try to regenerate the settings page for the app and program it. 

    I tried this now, and then it works. It seems like I need to generate a new settingspage and flash it too with the new application. It makes sense if I read the description of the settingspage, but then why I don't need to do this with the debug bootloader? I can't find any description that the debug bootloader works different with the settingspage?

  • Hi, 

    Gueston said:
    why I don't need to do this with the debug bootloader?

    Are you sure you did the same flow for the debug bootloader? Programming SD+BL+APP+Setting, then just flash the modified APP? If so, I don't figure out the reason. 

    It is supposed to also update the setting if the application is different. 

    -Amanda

  • Yes I am sure. And to prove it, I prepared something for you so you can reproduce it yourself.
    I used the app_template as an example. I compiled the debug and secure bootloader for the pca10040.

    I made a batch file so you can see what I do and execute it to create the merged image.

    To reproduce scenario 1:

    Execute make_hex_debug.bat and flash dfu_target_firmware_debug.hex
    Now open app_template example and change something in the file, for instance change     NRF_LOG_INFO("Template example started."); to     NRF_LOG_INFO("Template example started...");
    It doesn't matter what, as long as you change something useful which will be compiled and linked.

    Now compile in debug and flash this with a sectorerase. The application will run.

    To reproduce scenario 2:

    Execute make_hex_release.bat and flash dfu_target_firmware_release.hex
    Now open app_template example and change something in the file, for instance change     NRF_LOG_INFO("Template example started."); to     NRF_LOG_INFO("Template example started...");
    It doesn't matter what, as long as you change something useful which will be compiled and linked.

    Now compile in release and flash this with a sectorerase. The application will run initially, but then do a reset. You will see it fails.

    If you compile it again in debug you see that the logging output gives this result:

    <error> app: ERROR 8 [NRF_ERROR_INVALID_STATE] at C:\Nordic\nRF5_SDK_17.1.0_ddde560\examples\ble_peripheral\ble_app_template\main.c:501
    
    PC at: 0x00031E35
    
    <error> app: End of error report

    7024.test.zip

  • Hi, 

    For bootload release, you should generate a setting with "--app-boot-validation NO_VALIDATION" to get the same feature as bootloader debug without the boot validation for the application. Otherwise, you will have to generate a new settings page every time you recompile as the checksum value will not stay the same. 

    -Amanda

Reply Children
No Data
Related