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.

How to modify the program coutner in C program

Other Parts Discussed in Thread: MSP430F5342

Hi All,

Do you know how to modify the PC(program coutner) in C program ?

MSP430F543x has errata CPU28 & CPU34.

I believe that we can program the C language to avoid this errata If I know the PC how to modify.

Best regards,

Mino.M

  • Would be great if you post link to document you are referring to.
  • Most c-compilers will automatically change PC by itself without your help. Some of them will work arround know CPU bugs. Some of them will even work arround non-existing CPU bugs.
  • Hi Ilmars,

    Thank you for your reply.

    I'm referring to the following documents.

    MSP430F5342 Device Erratasheet(5 & 7page)
    www.ti.com.cn/.../slaz278m.pdf

    Best regards,

    Mino.M

  • Hi old_cow_yellow,

    Thank you for your answer.

    old_cow_yellow said:
    Most c-compilers will automatically change PC by itself without your help. Some of them will work arround know CPU bugs. Some of them will even work arround non-existing CPU bugs.

    I can not judge whether the compiler to avoid CPU bugs of CPU28 & CPU34.

    Best regards,

    Mino.M

  • You can inspect the object code they generate. You may find that there are planty of NOP here and there including the ones that can work around CPU28 & CPU34.
  • Thank you for quick reply.

    old_cow_yellow said:
    You can inspect the object code they generate. You may find that there are planty of NOP here and there including the ones that can work around CPU28 & CPU34.

    I understand that it is not possible to care at the time of programming.

    In other words,  this errata(CPU28&34) can not be avoided unless I check the ASM output by the compiler.

    Best regards,

    Mino.M

  • Errata list situations where the system does not behave as expected or described. Sometimes it even lists things that ARE described in the users guide, but are not expected/surprising.
    However, those anomalies do not need to be sane at all.
    I don't know why someone should do a rotate PC operation. what good would it do to multiply the program counter by two or divide it by two? I can't figure out any real-world situation where CPU34 would hit.
    IMHO, the only indexed operation generated by a compiler where the PC is the target (CPU28) would be the __even_in_range() intrinsic, which adds the interrupt vector (xxIV) register to the PC for a jump table. In case the compiler doesn't take care of this itself (and usually, such errata are known and supported by the compiler), you can add a NOP right before the switch statement.

**Attention** This is a public forum