Absolute or Relocatable

Status
Not open for further replies.

HerohetoChakma

Junior Member level 3
Joined
Apr 19, 2013
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Chittagong, Bangladesh.
herohetoc.webs.com
Activity points
2,338
When I select build All option in MPLAB it is show that Absolute and Relocatable. When i select Absolute it is seen that error but when i select relocatable it show success or build success. Which one should i select to make .hex file? Which one is correct option to build .hex file without error? How can i find out that my program is correct?
 

Both are correct in different situations and both produce hex files.

In absolute code you have to specify the addresses of the variables and code, in relocatable mode you simply tell it what type of variable or code it is and the MPLAB linker allocates the addresses for you. There are differences in the code syntax which will make it show errors if you write for one type but assemble for the other.

I would guess in your code you have sections labelled 'CODE', 'DATA' and possibly 'UDATA' which are instructions to the linker to find somewhere to fit them in PIC memory. If you tried to assemble in absolute mode it would expect you to provide addresses yourself and not finding any would cause the error.

Brian.
 

Both the function work similar but, absolute comes with tool which help you to make better code. It facilitates automatic placement of RAM variables in different areas chosen within a Linker file, and same for Code sections.
business phone lines
 

Thats the wrong way around RELOCATABLE code is the type that is automatically placed. I'm not sure that either makes "better code", that's entirely decided by the person writing it. In most circumstances, relocatable code is versatile because it can be modular and reused in other programs

Brian.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…