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.

USER CODE BEGIN (10) block generated twice in can.c

Other Parts Discussed in Thread: TMS570LS0432, HALCOGEN

USER CODE BEGIN (10) block is generated twice in can.c, for TMS570LS0432 MCU

User code which was put in user code block 10 will be incorrectly treated when code is re-generated, which can cause problematic bugs and lost user code.

The problem occurs in HalCoGen version 04.05.02

C:\ti\Hercules\HALCoGen\v04.05.02\drivers\TMS570LS0432PZ\CAN570v000\can.c

The cause seems to be an old hard-coded block on line 1694 (all others have been replaced with a @@USERCODE tag)

  • OK, I see it. In a fresh version that I created with no user code added I see the second /* USER CODE BEGIN (10) */ at line 489. It is between /* USER CODE BEGIN (12) */ and /* USER CODE BEGIN (13) */. I also verified that user code put in this second block is not maintained when HALCoGen regenerates the code. I will report this to the HALCoGen team.
  • Thank you Bob,

    On the first re-generation, the code from the second block is put in the first block, and the second block is left empty.
    On the second re-generation the now empty second block is copied over the first block again, and code from both blocks is now missing.

    There is another bug concerning user code blocks, which I would like to report;
    HalCoGen does not report any warnings or errors when re-generating code with incorrectly structured user code blocks. There is no warning given when user code blocks are duplicated, out of place, or nested. Granted, HalCoGen nor the code should be abused in this way, but a warning would have saved us time in this case.

    Best regards,

    Rob
  • Hi Rob,

    This has been fixed in 4.06.00 release.
    Just a note, we removed the hard coded usercode 10 in canGetID API, only by doing this we will not break the compatibility of other user codes below it. SO there will be no user code supported for canGetID API.