Virtual Page overwritten by application

Hello all!

I am currently developing on the development board nRF52832, SDK16.0 and SD132v7.2.0.

As mentioned in the subject the virtual pages are overwritten by the application. Due to this, the function "pages_init()" returns an error which leads to FDS_ERR_NO_PAGES error. I checked the hex-dump and it seems that the application overlaps the memory regions 0x6C000 - 0x6E000. These pages are foreseen for the virtual pages since in sdk_config.h following is set:

#ifndef FDS_VIRTUAL_PAGES
#define FDS_VIRTUAL_PAGES 4
#endif

The point is that in debug the hex-file is 100k bigger than the release hex. I figured out that for release version in the tab Code generation the Optimization Level is set to "Optimize For Size". If a copy the same settings for debug version it is not possible to debug the application.

So my question is, is it possible to shring somehow the debug version applying some optimization?

Thanks in advance.

Rgerads,

MKarl

Parents
  • Hi MKarl,

    I understand the problem. When you remove optimization, the machine code matches closely to the C code, which makes it easy to step, watch variables etc, as what you see in the code is more or less what is actually in the binary. With optimization, the compiler will do tricks to try to achieve what it is supposed to focus on (smaller size, faster speed, etc), and then it is not at all easy to match the machine code to the C code. Therefore, you typically want to disable optimization when debugging.

    In this case, where you cannot fit everything there are a few things you can do:

    • Simplest: Do you need 4 FDS pages when doing your testing or is it enough with 2 or 3?
    • You can keep optimize for size for the project as a whole, and specifically use a different optimization level for the files you are debugging in.
      • If you for instance are using Segger Embedded Studio, you can right click on a file and select "Options...". Then adjust the optimization level under "Code Generation".

    Einar

Reply
  • Hi MKarl,

    I understand the problem. When you remove optimization, the machine code matches closely to the C code, which makes it easy to step, watch variables etc, as what you see in the code is more or less what is actually in the binary. With optimization, the compiler will do tricks to try to achieve what it is supposed to focus on (smaller size, faster speed, etc), and then it is not at all easy to match the machine code to the C code. Therefore, you typically want to disable optimization when debugging.

    In this case, where you cannot fit everything there are a few things you can do:

    • Simplest: Do you need 4 FDS pages when doing your testing or is it enough with 2 or 3?
    • You can keep optimize for size for the project as a whole, and specifically use a different optimization level for the files you are debugging in.
      • If you for instance are using Segger Embedded Studio, you can right click on a file and select "Options...". Then adjust the optimization level under "Code Generation".

    Einar

Children
No Data
Related