Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help needed with Linker Scripts!

Status
Not open for further replies.

electronics_guy

Member level 2
Joined
Apr 12, 2012
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,655
Hi everyone,
I am new to programming and I am working on ADC Driver of PIC16f877A microcontroller. I use HI-Tech C compiler and MPLab 8.30. When I compile my code and wish to see the result in watch window, some of the variables are automatically declared in "Reserved Memory." I came to know that this can be overcome by using Linker Scripts. Since I am new to programming I have no idea about Linker Scripts. Please do enlighten me about them, like how to write a linker script and also suggest me a good tutorial.....


Thanks in advance
 

When compiling your code, do you have the build option set to 'DEBUG'

I do not think Hi-Tech C uses linker scripts for the Pic16f series micros???
 

When compiling your code, do you have the build option set to 'DEBUG'

I do not think Hi-Tech C uses linker scripts for the Pic16f series micros???

Hi btbass,
Thank you very much for replying!
Yeah I have the build option set to DEBUG when compiling, and yes even I have the same doubt but again I am not sure if Hi-Tech C uses linker scripts for PIC16F series but in the project window I do not get any option to add the linker(.lkr) files.
So if that is not the solution, how else can I overcome this "RESERVED MEMORY" problem?
And can you suggest me some good tutorial on linker scripts? Really want to know about 'em!
Thanks in advance
 

If you download the pdf,
'MPLAB® ASSEMBLER, LINKER AND UTILITIES for PIC24 MCUs and dsPIC® DSCs User’s Guide'
From here

**broken link removed**

You will find quite a lot of info on the MPLAB C30 linker and linker scripts.

If you look in the 'dat' directory of your Hi-Tech compiler installation, you will find a file called 'picc.ini'
It is a text file so you can open it with notepad.
I think this is Hi-Tech's way of knowing the addresses of the micros.

Do you have the configuration flags set for debugging?

/*debug option*/
#define DEBUGEN 0x37FF // debugger enabled
#define DEBUGDIS 0x3FFF // debugger disabled
 
Last edited:

I have set the Build Configuration on the Project Manager toolbar of MPLAB to "DEBUG" mode.
 

There are also some config fuse settings for debug.

/*debug option*/
#define DEBUGEN 0x37FF // debugger enabled
#define DEBUGDIS 0x3FFF // debugger disabled

For example:

/*--- Config fuse settings ---*/

#ifdef __DEBUG

__CONFIG(INTIO & WDTDIS & PWRTDIS & MCLREN & BOREN & IESODIS & FCMDIS & LVPDIS & DEBUGEN);

#else

__CONFIG(INTIO & WDTDIS & PWRTEN & MCLREN & BOREN & CP & IESODIS & FCMDIS & LVPDIS & DEBUGDIS);

#endif
 

Thanks btbass. Yeahused the same settings.... but still no change
:(

However if i declare the same variable in some other place, say before some function or after a function then it works! I dont get the "reserved memory" problem. But again if I add more .c or .h files to my project and compile, the problem returns. This is really ruining everythin.... Plz help


Thanks
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top