• AVR Freaks

Hot!XC16 Linker Bug with Boot Sector and AIVT, dspic33ch

Junior Member
  • Total Posts : 77
  • Reward points : 0
  • Joined: 2012/07/11 15:07:31
  • Location: 0
  • Status: offline
2020/11/23 09:13:24 (permalink)
4 (1)

XC16 Linker Bug with Boot Sector and AIVT, dspic33ch

I'm experiencing a problem with the XC16 linker which I believe is a bug. The linker refuses to allocate most of the entries for the alternate interrupt vector table, as well as other small manual allocations with no discernable pattern. For those not familiar, the address of the AIVT in program memory is determined by the config bits BSLIM, and is only available when the boot sector is enabled. I have attached my config file, pragmaConfigs.c.
XC16 v1.60 (and 1.50)
Project configuration, Create default ISR = OFF, No Interrupt Vector Table = OFF, Code Model = Large and Small
Allow overlapped sections = OFF (ON still won't compile, suppresses individual errors and only reports {Link Error: Could not allocate program memory}
Changing the value of BSLIM to place the AIVT at a different address has no impact.
Adding definitions for _AltMSIBInterrupt, _AltStackError, _AltAddressError, _AltMathError, and others causes errors despite the memory being unallocated at the requested address. Manual allocations to the AIVT entry address also fail.
Link Error: Could not allocate section '.aivt._AltMSIBInterrupt' at 0x1011a
Link Error: Could not allocate program memory
With the problematic vector table entries disabled the allocation succeeds, and results in the following memory map. As you can see, some of the AIVT entries are allocated without a problem.
"program" Memory [Origin = 0x200, Length = 0x57d00]

section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.aivt._AltOscillatorFail 0x10004 0x2 0x3 (3)
.aivt._AltMSIAInterrupt 0x10118 0x2 0x3 (3)
.aivt._AltMSIFLTInterrupt 0x1012c 0x2 0x3 (3)
.text 0x10800 0xe1c 0x152a (5418)
.const 0x1161c 0x6c8 0xa2c (2604)
DCDC2S_image 0x11ce4 0x2a00 0x3f00 (16128)
.text 0x146e4 0x3318 0x4ca4 (19620)
.NVM_flash 0x179fc 0x1dc 0x2ca (714)
.text 0x17bd8 0x84e 0xc75 (3189)
.dinit 0x18426 0x82 0xc3 (195)
.text 0x184a8 0x15a 0x207 (519)
.cfg 0x50000 0x1000 0x1800 (6144)
.cal 0x51000 0x4000 0x6000 (24576)
.res 0x55000 0x2efe 0x467d (18045)

                 Total "program" memory used (bytes): 0x17b89 (97161) 18%


1 Reply Related Threads

    Super Member
    • Total Posts : 128
    • Reward points : 0
    • Joined: 2010/10/25 16:51:05
    • Location: 0
    • Status: offline
    Re: XC16 Linker Bug with Boot Sector and AIVT, dspic33ch 2021/01/21 18:49:12 (permalink)
    +1 (1)
    You presumably wrote your own linker script.  Can we see it?
    Jump to:
    © 2021 APG vNext Commercial Version 4.5