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

startup_config.h in the 8.9.0 pack

In arm_startup_nrf52.s (in the 8.9.0 device family pack), there is a new bit of code:

                IF :DEF: __STARTUP_CONFIG
#include "startup_config.h"
                ENDIF

I assume this code allows one to manually specify things like Stack_Size and Heap_Size. Is there a template of this file provided anywhere or is it just something that we write ourselves?

Also (and this is the reason I noticed this change), why does using --cpreproc in the Asm options result in the compiler looking for startup_config.h? As far as I can see, using the C preprocessor should not define STARTUP_CONFIG anywhere. Am I wrong? What is going on here?

What problems might I encounter if I remove the --cpreproc from my project?

  • Hi

    there is not a template file, but is very simple to make. Create a file called startup_config.h with the following two lines (numbers can of course change):

    #define __STARTUP_CONFIG_STACK_SIZE 4000
    #define __STARTUP_CONFIG_HEAP_SIZE 4000
    

    In your project wizard, asm tab, define __STARTUP_CONFIG, in Misc Controlls write --cpreproc, and add the folder where the file is placed to the include paths in the asm tab. Now the size of heap and stack comes from a file, and not from the arm_startup_nrf52.s file or the project define __STACK_SIZE.

    If you define __STARTUP_CONFIG but do not use the --cpreproc assembling options, the assembler will fail with A1167E: Invalid line start on the line that includes the startup_config.h file.

    If you use or not --cpreproc in your project but not define __STARTUP_CONFIG, nothing will change. If you have defined in the project __STACK_SIZE it will be taken, if not, default 8192 will be used. In order for the change to have an effect, you need to use both __STARTUP_CONFIG and --cpreproc.

Related