Menu

#306 Incorrect .cinit data when... not sure why

None
open
None
1
2022-02-20
2017-09-30
No

While developing an assembler-only project on a PIC12F1572 I hit a PC corruption bug in code that I wasn't meddling with. It turned out that a should-have-made-no-difference change in one file had cause the initialisation data for an idata variable in a different file to be broken.

The code is attached. As it stands, it works. If I change line 34 of comms.asm to "if 1" then the initialisation data for "rtos_schedpt" in sched.asm gets written as 0 instead of 20. When I first saw the problem, line 35 of comms.asm specified an absolute address but changing to using the linker file made no difference.

1 Attachments

Discussion

  • Molnár Károly

    Molnár Károly - 2017-10-02
    • assigned_to: Molnár Károly
     
  • Molnár Károly

    Molnár Károly - 2017-10-02

    Thanks for the report. I will deal with it when it will be enough my time.

     
  • Robert Pearce

    Robert Pearce - 2022-02-20

    This bug is still present in v1.5.2 and is actually worse than I thought. The apparently harmless change (with a linker-defined address) causes all five bytes of .idata to be initialised wrongly.
    I've attached an updated zip with the build results I get (and the makefile tweaked to not need my complex build environment)

     

Anonymous
Anonymous

Add attachments
Cancel