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

Transition from SDK 15.0 to 17.2; Endless loop

Hi all,

I am trying transition from SDK 15.0 to 17.2 and having a branch instruction to itself (an infinite loop) which I think has something to do with the adjustment of the Flash and RAM macros. Current development on a nrf52 DK but will transition to a 52810 chip with 192K Flash and 24K RAM. And using the s112 soft device.

With a 192K flash size, FLASH_PH_SIZE = 0x2EE00.

With a 24K RAM size, RAM_PH_SIZE = 0x5DC0. 

When I debug through the program, I find RAM_START=0x20001AE0. This leaves RAM_SIZE=0x42E0 to satisfy (RAM_SIZE + RAM_START) should not be larger than (RAM_PH_START + RAM_PH_SIZE).

Due to the s112 softdevice, the FLASH_START=0x19000. This leaves FLASH_SIZE=0x15E00 as to satisfy FLASH_SIZE should not be larger than (FLASH_PH_SIZE - FLASH_START).

With these findings, this should be the correct macros but don't seem to work in SDK 17.2:

FLASH_PH_START=0x0

FLASH_PH_SIZE=0x2EE00

RAM_PH_START=0x20000000

RAM_PH_SIZE=0x5DC0

FLASH_START=0x19000

FLASH_SIZE=0x15E00

RAM_START=0x20001AE0

RAM_SIZE=0x42E0

Previous Macros in SDK 15.0 that worked for the same code. 

FLASH_PH_START=0x0

FLASH_PH_SIZE=0x2EE00

RAM_PH_START=0x20000000

RAM_PH_SIZE=0x5DC0

FLASH_START=0x19000

FLASH_SIZE=0x15E00

RAM_START=0x20001b18

RAM_SIZE=0x42A8

Once all modules are initialized, and main() is entered, the code gets stuck in this infinite loop. 

0x0001D808: b 0x0001D808   # while(main_state == OFF); where main_state is incremented on a push button which is verified to increment in debug. 

There is enough memory for the application on this system and the code is the same as it is in the SDK 15.0 version. The .config file has been changed to enable the appropriate modules that were enabled in the 15.0 version. 

Any thoughts would be appreciated Slight smile

Parents
  • Hello,

    The memory settings appear to be correct. But were you building the SDK 17 version with or without compiler optmization enabled? It sounds like the code to check the 'main_state' state flag in your "while" loop might be optimized away by the compiler. The compiler may do this if you define this state flag globally without the the 'volatile' keyword.

    static volatile <variable type>  main_state;

    Please try with 'volatile' if you haven't done it already.

    Best regards,

    Vidar

Reply
  • Hello,

    The memory settings appear to be correct. But were you building the SDK 17 version with or without compiler optmization enabled? It sounds like the code to check the 'main_state' state flag in your "while" loop might be optimized away by the compiler. The compiler may do this if you define this state flag globally without the the 'volatile' keyword.

    static volatile <variable type>  main_state;

    Please try with 'volatile' if you haven't done it already.

    Best regards,

    Vidar

Children
Related