• AVR Freaks

[FAQ]Newbie - Linker Script Error

Author
Altzone
Starting Member
  • Total Posts : 74
  • Reward points : 0
  • Joined: 2007/04/27 23:21:23
  • Location: 0
  • Status: offline
2007/04/27 23:34:33 (permalink)
0

Newbie - Linker Script Error

Hi, this is my first attempt at using C30 C compiler and I canot get a simple program to compile.
I am using the latest MPLAB7.52 and C30 upgrade.
I have created a new project using a 24FJ64GA004 device and tried to create a simple Hello World program like this:

#include <p24Fxxxx.h>
#include <stdio.h>
int main(void)
{
printf("hello world");
return 0;
}

When I build I get the error messages:
"Skipping link step.  The project contains no linker script."
"BUILD FAILED"

I looked at some examples and they have linker script .glb files, but when I try to add say "p24FJ64GA004.gld" it startscompiling stuff but then givesm e the error:
"C:\Program Files\Microchip\MPLAB C30\bin\pic30-coff-ld.exe Error: A heap is required, but has not been specified"

Anyone know what's going on?
Why do I have to include "linker scripts" to make a simple program compiler?, I'm not actually sure what this is doing...

Also, why does the compiler say it's used up 10% of my (64K) program memory?, just for printf?, surely not?!
Incidently, when I have a simple one-line program like "i++;" it tells me it's taken almost 1K of program memory. What's going on?, is there really that much overhead?

I have a lot of experinece with the HITECH C compiler for the 16 series, but this is my first attempt at the C30 compiler.

Thanks
Dave.
#1

11 Replies Related Threads

    aschen0866
    Super Member
    • Total Posts : 4573
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    RE: Newbie - Linker Script Error 2007/04/28 07:43:26 (permalink)
    +2 (1)
    If you use any standard I/O function, such as printf() in this case, you'll need to specify the heap size even if the size is zero (go to Build Options --> MPLAB LINK30).
     
    The 10% code size estimate sounds right to me because printf() is a costly function.
    #2
    Altzone
    Starting Member
    • Total Posts : 74
    • Reward points : 0
    • Joined: 2007/04/27 23:21:23
    • Location: 0
    • Status: offline
    RE: Newbie - Linker Script Error 2007/04/28 23:50:47 (permalink)
    0
    ORIGINAL: aschen0866

    If you use any standard I/O function, such as printf() in this case, you'll need to specify the heap size even if the size is zero (go to Build Options --> MPLAB LINK30).

    The 10% code size estimate sounds right to me because printf() is a costly function.


    That did the trick, thanks.

    Dave.
    #3
    PIC_user
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2007/12/26 03:42:55
    • Location: 0
    • Status: offline
    RE: Newbie - Linker Script Error 2008/01/02 20:50:18 (permalink)
    0
    Thank you.
    I got solution from you,even I'm also facing the same problem.

    Thnakyou a lot
    #4
    montanari9
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2007/11/05 06:49:51
    • Location: 0
    • Status: offline
    RE: Newbie - Linker Script Error 2008/04/11 12:05:15 (permalink)
    0
    Thanks for your tip  =]

    I just faced this problem and it is solved

    Thanks!
    #5
    Gef
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2009/01/27 12:30:28
    • Location: 0
    • Status: offline
    RE: Newbie - Linker Script Error 2009/03/12 02:53:47 (permalink)
    0
    Another Thank you!
    #6
    srullo
    Starting Member
    • Total Posts : 34
    • Reward points : 0
    • Joined: 2009/06/09 00:00:15
    • Location: Barcelona
    • Status: offline
    RE: Newbie - Linker Script Error 2009/07/22 02:47:04 (permalink)
    0
    Thanks!
    #7
    guymc
    Administrator
    • Total Posts : 769
    • Reward points : 0
    • Joined: 2004/06/08 07:14:37
    • Status: offline
    RE: Newbie - Linker Script Error 2009/07/22 09:56:17 (permalink)
    0
    I am using the latest MPLAB7.52 and C30 upgrade.

    Actually, that's a really old version of MPLAB.

    When I build I get the error messages:
    "Skipping link step. The project contains no linker script."
    "BUILD FAILED"

    In more recent versions of MPLAB, linker scripts are optional.

    In fact, we recommend that you don't specify a linker script. That way you always use a script that matches your target device and the compiler itself.

    Cheers..
    #8
    eddiehart
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2009/09/17 09:27:26
    • Location: 0
    • Status: offline
    RE: Newbie - Linker Script Error 2009/10/14 15:32:53 (permalink)
    0
    Thank you for the solution! I have the same problem.
    #9
    Preethi
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2012/06/25 01:11:39
    • Location: 0
    • Status: offline
    RE: Newbie - Linker Script Error 2012/07/12 02:18:20 (permalink)
    0
    even i was facing the same problem of heap size required...
    your post helped meSmile THANX ALOTSmileSmile
    #10
    eindecker2000
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2011/01/18 11:29:53
    • Location: 0
    • Status: offline
    RE: Newbie - Linker Script Error 2012/09/06 13:17:24 (permalink)
    0
    Awesome, thank you!
    #11
    amilcury
    New Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2011/01/28 14:21:16
    • Location: Brasil
    • Status: offline
    RE: Newbie - Linker Script Error 2013/07/27 20:01:44 (permalink)
    0
    Thanks!
    #12
    Jump to:
    © 2020 APG vNext Commercial Version 4.5