Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Knowledge Base Articles

Exception in BSP initialization code when debugging a project with Segger Ozone – KBA234662

MohammedA_41
Community Manager
Community Manager First like received First like given First solution authored
Community Manager

Exception in BSP initialization code when debugging a project with Segger Ozone – KBA234662

Version: **

Background: In the case of debugging a CM4 application from an .elf file that contains images for both CM0+ and CM4 cores, Ozone by default extracts the SP value from the first vector table it finds, which is usually part of the CM0+ application. As a result, the cores use the same memory area as the stack and the CM0+ core overwrites the contents of the stack to the CM4 core.

Solution: There are two possible solutions.

  1. Do not set the SP value in the debug project creation wizard at all. In this case, setting the SP value will be performed by the application that is running on the CM0+ core just before it starts the application on the CM4 core.
    For a newly created project, select the "Do not set" option in the "Initial Stack Pointer" section.
    MohammedA_41_0-1643271287028.png
    For existing projects, find the _SetupTarget function in the project file and comment out the setting of the initial value of the "SP" register in it.
    MohammedA_41_1-1643271338922.png

     

  1. If the name of the symbol that contains the value of the top of the stack is known, it can be specified in the debug project creation wizard. However, the name of such a symbol depends on the compiler and is often not obvious. For example, for ModusToolbox™ projects compiled with GCC, this symbol is named "__StackTop".
    For a newly created project, select the "Location" option and specify the symbol name in the "Initial Stack Pointer" section.
    MohammedA_41_2-1643271364560.png
    For existing projects, find the _SetupTarget function in the project file, and then change the way the SP register value is retrieved so that it is retrieved by known symbol's name.
    MohammedA_41_3-1643271388114.png

     

0 Likes
Version history
Revision #:
1 of 1
Last update:
‎Jan 27, 2022 12:18 AM
Updated by:
 
Contributors