[SOLVED] [bug]ozone v3.10b can not get the correct initial​ PC based iar7.10 *.out

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] [bug]ozone v3.10b can not get the correct initial​ PC based iar7.10 *.out

    1. It is possible to debug the same * .out (created by iar 7.10) with the ozone project created by v2.70, but the ozone project created by v3.10 is wrong.
    2. The screenshot below shows that they got a different PC and v2.70 got the right PC.
    3. The source code shows different content inside the two projects.
    4. Elf.GetEntryPointPC (), this api cannot get the correct initial pc, at least * .out created by iar 7.10.

    C Source Code

    1. void AfterTargetDownload (void) {
    2. unsigned int SP;
    3. unsigned int PC;
    4. unsigned int VectorTableAddr;
    5. VectorTableAddr = Elf.GetBaseAddr();
    6. if (VectorTableAddr == 0xFFFFFFFF) {
    7. Util.Log("Project file error: failed to get program base");
    8. } else {
    9. SP = Target.ReadU32(VectorTableAddr);
    10. Target.SetReg("SP", SP);
    11. PC = Target.ReadU32(VectorTableAddr + 4);
    12. Target.SetReg("PC", PC);
    13. }
    14. }
    Display All



    C Source Code

    1. void AfterTargetDownload (void) {
    2. unsigned int SP;
    3. unsigned int PC;
    4. unsigned int VectorTableAddr;
    5. VectorTableAddr = Elf.GetBaseAddr();
    6. if (VectorTableAddr != 0xFFFFFFFF) {
    7. SP = Target.ReadU32(VectorTableAddr);
    8. Target.SetReg("SP", SP);
    9. } else {
    10. Util.Log("Project file error: failed to get program base");
    11. }
    12. PC = Elf.GetEntryPointPC();
    13. if (PC != 0xFFFFFFFF) {
    14. Target.SetReg("PC", PC);
    15. } else if (VectorTableAddr != 0xFFFFFFFF) {
    16. PC = Target.ReadU32(VectorTableAddr + 4);
    17. Target.SetReg("PC", PC);
    18. }
    19. }
    Display All
    Images
    • log_2.70.png

      8.55 kB, 565×128, viewed 317 times
    • log_3.10.png

      8.73 kB, 566×128, viewed 335 times
    • pc_2.70.png

      9.58 kB, 618×162, viewed 323 times
    • pc_3.10.png

      8.67 kB, 498×162, viewed 318 times
  • Hello,

    Thank you for your inquiry.
    Such an issue is not known to us.

    Could you provide your .out file for reference?

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 1. Thank you for your attention.
    2. Please change the file name "project.out.bin" to "project.out".
    3. The same problem was encountered again today. This time in MDK.
    4. The problem caused the program to skip "SystemInit ()".
    5. After I used Target.ReadU32 (VectorTableAddr + 4) to get the PC value, the problem was solved.
    Files
    • project.out.bin

      (861.81 kB, downloaded 368 times, last: )

    The post was edited 1 time, last by caowent ().

  • Hello,

    This is no issue with Ozone as Ozone correctly finds the entry point of this application which is __iar_program_start in this particular elf file.
    IAR creates this information. Ozone only displays it. So Elf.GetEntryPointPC() does exactly what is documented.
    Anyhow we will add an option in the project wizard so you can generate the Ozone projects better so such elf files with unexpected information in them still work normally.

    We will consider this thread as solved now.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.