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

Zero Initialized Data increase causes program to crash at the start

Hi,

I am using NRF51822 SDK12 S130, I have increased my code and encountered a crash right at the beginning, I debugged it as follows -

I increase an integer (uint32) array I use for debugging this problem from size 5 to 6 it crashes(uint32_t debug_z1[5]; to uint32_t debug_z1[6];), and the program stops working,

this is the program size reported before the increase -

 Program Size: Code=60768 RO-data=1488 RW-data=848 ZI-data=8368 (with uint32_t debug_z1[5] ) works fine

this is after the increase -

Program Size: Code=60768 RO-data=1488 RW-data=848 ZI-data=8360 (with uint32_t debug_z1[6] ) doesn't work

This is my code size, 

My RAM memory allocated is 0x6018, so I don't understand how I have a problem, To my understanding I have enough RAM,

Please help me, any suggestion on how to proceed will be very much appreciated!

Thanks!

---------------------

I am adding my arm_startup_nrf51.s file part of the code dealing with HEAP SIZE and STACK SIZE which I assume might be connected

                IF :DEF: __STARTUP_CONFIG
Stack_Size      EQU __STARTUP_CONFIG_STACK_SIZE
                ELIF :DEF: __STACK_SIZE
Stack_Size      EQU __STACK_SIZE
                ELSE
Stack_Size      EQU 2048
                ENDIF
                
                IF :DEF: __STARTUP_CONFIG
Stack_Align     EQU __STARTUP_CONFIG_STACK_ALIGNEMENT
                ELSE
Stack_Align     EQU 3
                ENDIF

                AREA    STACK, NOINIT, READWRITE, ALIGN=Stack_Align
Stack_Mem       SPACE   Stack_Size
__initial_sp

                IF :DEF: __STARTUP_CONFIG
Heap_Size       EQU __STARTUP_CONFIG_HEAP_SIZE
                ELIF :DEF: __HEAP_SIZE
Heap_Size       EQU __HEAP_SIZE
                ELSE
Heap_Size       EQU 2048
                ENDIF

Related