Ozone detects wrong application entry point

From SEGGER Wiki
Jump to: navigation, search

When autogenerating a project with Ozone V3.20 or later you will find the following line once or twice in the Ozone .jdebug project file:

PC = Elf.GetEntryPointPC();    

This function will return the entry point of the elf file. However for some toolchains (e.g. IAR and Keil) this entry point address will not be the actual address from where the target application starts but rather the point where the C runtime library starts executing. Depending on your target application this might lead to issues as he SystemInit might be skipped that way. While this behaviour of the third party toolchains is technically not wrong it makes not much sense for most embedded target devices.

Anyhow should you run into this issue it can simply be fixed by replacing the line mentioned above with the following instead:

PC = Target.ReadU32(VectorTableAddr + 4);  

Now everything should be working as expected.

Should this also fail check if the VectorTableAddr detected by Ozone is at the expected address. If not either the debug information in the elf file is missing/incorrect or you are debugging a multi image setup. To solve the precedent error simply set the VectorTableAddr to the expected value. For the latter issue see: Debug on a Target with Bootloader