This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Stack errors with OAD

I am trying to decrease the code size of Image A for OAD. Image A will always be on my device with the BIM to update Image B.

I am experiencing reset on my device when performing BLE stack functions. I observe the failures by placing a breakpoint at the start of my code. My code starts with HAL_BOARD_INIT(). The chip will "start over" without chaining the RST bits in SLEEPSTA. The RST bits can be 10 (WDT timer reset) cause by the BIM or 01 (external reset) caused by me hitting the reset button on the CC debugger. The chip is not resetting due to conventional reasons. My assumption is the PC runs away and recycles at 0xffff, then hits to the start of the code where by breakpoint is. The resets are continuous and repeatable.

 One failure I have seen occurs when LL_TimeToNextRfEvent() is called inside halSleep(). Another failure happens when the Gap task getting an osal message. I observe this by seeing idx= 5 and event = 0x8000 in osal_run_system(). Both of these failure occur within the hidden part of the stack. I have not observed such a failure within my own code. 

The "resets" can be trigger one by removing an unneeded hal function, changing the CODE regions (specifically setting _BANK5_BEG=0x59000) in the linker file, or changing the optimization setting in my project options. All these steps serve to decrease the size of Image A to make room for my application image B.

My assumption is that the binary stack is being broken up on unsafe CODE memory boundaries. 

  • Hi Peter,

    It's hard to say what is going on. I have seen implementations with reduced Img A sizes, so in theory this should work. What BLE stack version & IAR tool version are you using? Does OAD work with the default Img A?

    Best wishes