• AVR Freaks

Bug in example linker script ?

Author
PRC
Starting Member
  • Total Posts : 68
  • Reward points : 0
  • Joined: 2011/01/26 03:56:15
  • Location: UK Channel Islands
  • Status: offline
2011/03/14 07:49:40 (permalink)
0

Bug in example linker script ?

Hi all,

Trying to get the HID bootloader to work - seem to have run into a bug in the example linker script that chokes the linker as soon as it is included in the project.

The problem seems to be common to all of the example app_hid_boot_pic24fxxx.gld files for the pic24fj256gb210 family - all four seem to choke the linker.

The output line :-

c:\program files\microchip\mplabc30\v3.25\bin\bin\..\bin/pic30-coff-ld.exe:app_hid_boot_p24FJ256GB210.gld.00:454: syntax error

Should suggest where the error is but how should I interpret what it is saying ? 454 does not seem to directly relate to a line number in the file - I tried putting 'errors' in the script in random places to find out.

So how do I go about finding where the issue is ?

Output from linker :-


Executing: "C:\Program Files\Microchip\mplabc30\v3.25\bin\pic30-gcc.exe" -mcpu=24FJ256GB110 "Objects\USB HID Mouse - C30\usb_descriptors.o" "Objects\USB HID Mouse - C30\mouse.o" "Objects\USB HID Mouse - C30\usb_device.o" "Objects\USB HID Mouse - C30\usb_function_hid.o" "Objects\USB HID Mouse - C30\usb_hal_pic24.o" -o"USB Device - HID - Mouse - C30.cof" -Wl,-L"C:\Program Files\Microchip\MPLAB C30\lib",--script="..\..\USB Device - Bootloaders\HID - Bootloader\HID Bootloader - Firmware for PIC24FJ256GB210 Family Devices\Application Files\app_hid_boot_p24FJ256GB210.gld",--defsym=__MPLAB_BUILD=1,-Map="USB Device - HID - Mouse - C30.map",--report-mem
c:\program files\microchip\mplabc30\v3.25\bin\bin\..\bin/pic30-coff-ld.exe:app_hid_boot_p24FJ256GB210.gld.00:454: syntax error
Link step failed.
----------------------------------------------------------------------
Release build of project `C:\Junk\Microchip Solutions v2010-10-19\USB Device - HID - Mouse\HID - Mouse - Firmware\USB Device - HID - Mouse - C30.mcp' failed.
Language tool versions: pic30-as.exe v3.25, pic30-gcc.exe v3.25, pic30-ld.exe v3.25, pic30-ar.exe v3.25
Mon Mar 14 14:37:17 2011
----------------------------------------------------------------------
BUILD FAILED

Best regards,

Paul C

#1

11 Replies Related Threads

    aschen0866
    Super Member
    • Total Posts : 4433
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re:Bug in example linker script ? 2011/03/14 08:43:06 (permalink)
    +2 (1)
    There are some bugs in that linker script:


    .ivt __IVT_BASE :
      {
        ...
        LONG(ABSOLUTE(__APP_IVT_BASE) + 0x100)); /* __SPI3Interrupt */
        LONG(ABSOLUTE(__APP_IVT_BASE) + 0x104)); /* __OC9Interrupt */
        LONG(ABSOLUTE(__APP_IVT_BASE) + 0x108)); /* __IC9Interrupt */
        ...

    As you can see, parentheses are not paired properly. Also, I would add:

      .application_ivt __APP_IVT_BASE :
      {
           ...
       } > app_ivt

    to the existing section command.
    #2
    PRC
    Starting Member
    • Total Posts : 68
    • Reward points : 0
    • Joined: 2011/01/26 03:56:15
    • Location: UK Channel Islands
    • Status: offline
    Re:Bug in example linker script ? 2011/03/15 00:37:41 (permalink)
    0

    First of all thanks for the help - it is much appreciated as I have been at this for a couple of days - learnt quite a bit about linkers so not all bad at all!

    The suggestions above fixed the build and I now seem to have a functional bootloader.

    However (why is that always the case?) the second suggestion  > app_ivt  chokes the build saying :-

    c:\program files\microchip\mplabc30\v3.25\bin\bin\..\bin/pic30-coff-ld.exe: Link Error: address 0x100 of USB Eval.cof section .ivt is not within region app_ivt

    So I will look into what this section is up to.

    Thanks again,

    Paul C

    #3
    aschen0866
    Super Member
    • Total Posts : 4433
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re:Bug in example linker script ? 2011/03/15 07:18:12 (permalink)
    +2 (1)
    PRC
    ...
    However (why is that always the case?) the second suggestion  > app_ivt  chokes the build saying :-

    c:\program files\microchip\mplabc30\v3.25\bin\bin\..\bin/pic30-coff-ld.exe: Link Error: address 0x100 of USB Eval.cof section .ivt is not within region app_ivt
    ...

    Are you sure you put '>app_ivt' on the right place? What this does is tell the Linker that the output section .application_ivt, whose virtual address is at __APP_IVT_BASE, should be located in the app_ivt memory region. The SECTION command should look like this:


    SECTION
    {
        .application_ivt __APP_IVT_BASE :
        {
           ...
        } > app_ivt /* Output section .application_ivt goes to memory region app_ivt */

       .ivt __IVT_BASE :
       {
           ....
        } > ivt /* Output section .ivt goes to memory region ivt */

    }



    #4
    PRC
    Starting Member
    • Total Posts : 68
    • Reward points : 0
    • Joined: 2011/01/26 03:56:15
    • Location: UK Channel Islands
    • Status: offline
    Re:Bug in example linker script ? 2011/03/16 00:52:13 (permalink)
    0

    You are absolutely correct - when put where you suggest it links fine.

    Again my thanks - if I were in San Diego I would buy you a beer.

    Paul C
    #5
    youssefcool
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2010/11/25 01:37:26
    • Location: GERMANY
    • Status: offline
    Re:Bug in example linker script ? 2011/07/04 23:31:05 (permalink)
    0
    Hi,
    I get the same error after building the demo project with the linker "app_msd_boot_p24FJ256GB210.gld"

    the Output is:

    c:\microchip starter kits\pic24f starter kit 1\mplab c30\bin\bin\..\bin/pic30-coff-ld.exe:app_msd_boot_p24FJ256GB210.gld.00:454: syntax error
    Link step failed.
    ----------------------------------------------------------------------
    Debug build of project `C:\Pic24F\Projekte_Explorer16\PIC24ExplDemo\PIC24ExplDemo.mcp' failed.
    Language tool versions: pic30-as.exe v3.24, pic30-gcc.exe v3.24, pic30-ld.exe v3.24, pic30-ar.exe v3.24
    Preprocessor symbol `__DEBUG' is defined.
    Target debug platform is `__MPLAB_DEBUGGER_ICD3=1'.
    Debug platform options are: `__ICD2RAM=1'.
    Mon Jul 04 17:37:09 2011
    ----------------------------------------------------------------------
    BUILD FAILED


    can you help me please
    Best regards,
    Josef
    #6
    PRC
    Starting Member
    • Total Posts : 68
    • Reward points : 0
    • Joined: 2011/01/26 03:56:15
    • Location: UK Channel Islands
    • Status: offline
    Re:Bug in example linker script ? 2011/07/05 04:34:59 (permalink)
    0

    Given that the line reported in the error message is the same I would hazard a guess that the solution proposed by aschen0866 that fixed my problem will fix yours as well !

    Have you actually tried it ?

    Paul C
    #7
    youssefcool
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2010/11/25 01:37:26
    • Location: GERMANY
    • Status: offline
    Re:Bug in example linker script ? 2011/07/05 05:28:03 (permalink)
    0
    PRC

    Given that the line reported in the error message is the same I would hazard a guess that the solution proposed by aschen0866 that fixed my problem will fix yours as well !

    Have you actually tried it ?

    Paul C


    yes i have tried it but i get allways the same error message
    #8
    PRC
    Starting Member
    • Total Posts : 68
    • Reward points : 0
    • Joined: 2011/01/26 03:56:15
    • Location: UK Channel Islands
    • Status: offline
    Re:Bug in example linker script ? 2011/07/06 00:06:22 (permalink)
    0
    app_hid_boot_.zip K - for completeness here is the linker script that I ended up with after the modifications suggested above.

    [Edit] Uploaded the app linker file app_hid.... and the bootloader linker file boot_hid....

    Paul C
    post edited by PRC - 2011/07/06 00:52:50
    #9
    youssefcool
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2010/11/25 01:37:26
    • Location: GERMANY
    • Status: offline
    Re:Bug in example linker script ? 2011/07/06 01:43:09 (permalink)
    0
    thanks Paul for your Respense, but it's not about the linker Script "app_hid_boot_p24FJ256GB210.gld" but about "app_msd_boot_p24FJ256GB210.gld"



    Josef A
    #10
    aschen0866
    Super Member
    • Total Posts : 4433
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re:Bug in example linker script ? 2011/07/06 07:21:07 (permalink)
    0
    youssefcool

    PRC

    Given that the line reported in the error message is the same I would hazard a guess that the solution proposed by aschen0866 that fixed my problem will fix yours as well !

    Have you actually tried it ?

    Paul C


    yes i have tried it but i get allways the same error message

    It looks like the file app_msd_boot_p24FJ256GB210.gld, just like what Paul said,  has the same problem one line 389 - 391:

    ...
        LONG(ABSOLUTE(__APP_IVT_BASE) + 0x100)); /* __SPI3Interrupt */
        LONG(ABSOLUTE(__APP_IVT_BASE) + 0x104)); /* __OC9Interrupt */
        LONG(ABSOLUTE(__APP_IVT_BASE) + 0x108)); /* __IC9Interrupt */
    ...

    The correct code should be:

        LONG(ABSOLUTE(__APP_IVT_BASE) + 0x100); /* __SPI3Interrupt */
        LONG(ABSOLUTE(__APP_IVT_BASE) + 0x104); /* __OC9Interrupt */
        LONG(ABSOLUTE(__APP_IVT_BASE) + 0x108); /* __IC9Interrupt */

    Is this what you did?

    #11
    youssefcool
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2010/11/25 01:37:26
    • Location: GERMANY
    • Status: offline
    Re:Bug in example linker script ? 2011/07/06 23:54:43 (permalink)
    0
    exactly! now works.
    first time i believed that i have only to put >app_ivt in the right line, but the unique bug are "much parentheses in the lines 389-391".
    sorry i haven't see it in the first time.

    thank you for the help
    post edited by youssefcool - 2011/07/07 00:13:23
    #12
    Jump to:
    © 2019 APG vNext Commercial Version 4.5