Change from Relocatable to Absolute?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change from Relocatable to Absolute?

Jump to solution
3,940 Views
TomHoag
Contributor II

I have started a project in relocatable code using the HCS08AC60 and CW6.1 and processor expert.  How is it possible to change the project from relocatable to absolute code so that I can use ORG statements to set the location of the code where I want it? 

 

In the case of my MCUinit.asm file, I wish it could just assemble and link 'in line' with the rest of the code by using 'INCLUDE MCUinit.asm'.  But I cant get that to work.  It seems that CW wants to start it at $1860 and keep that module relocatable.

 

Thank you!

Labels (1)
0 Kudos
1 Solution
1,029 Views
TomHoag
Contributor II

It took a while to figure out, but I have converted my relocatable project to absolute.  For those interested, here's how to do it:

 

Build a new project using absolute assembly.

Copythe project.ipe file from the old project to the new one.  This way, no need to rebuild the Device Init.  Then reload it into device Initialization and generate the MCUinit.inc file.  It will generate an absolute file.

Copy all other source files to the new project.

Add the INCLUDE "MCUinit.inc" to the Main.asm file.

 

Now I can specify where I want all my code for my purposes.

 

Thanks all for the help...:smileyhappy:

View solution in original post

0 Kudos
8 Replies
1,029 Views
bigmac
Specialist III

Hello Tom, and welcome to the forum.

 

A requirement for CW absolute assembly is that only a single file may have the .ASM extension.  Your include files must use another extension, so simply rename these files.  You may also need to incorporate the ABSENTRY directive within your code, for debugging purposes.

 

Regards,

Mac

 

0 Kudos
1,029 Views
TomHoag
Contributor II

Hi Mac, thank you for the advice.  I can certainly make those changes and see what happens.  

 

However, it seems that does not explain why the MCUinit.asm file generated by Device Initialization, ends up in a relocatable format with supporting file MCUinit.inc.  It would seem that there must be an option somewhere that will allow Device Initialization to generate an absolute file.  Or, maybe it can only be done by hand-editing? 

 

Thank you!

0 Kudos
1,029 Views
bigmac
Specialist III

Hello Tom,

 

I guess it is quite possible that Processor Expert device initialisation tool does not specifically support absolute assembly coding.  This is supplied by a third party, so they will need to provide a specific answer.

 

However, I suspect that you will probably need to hand edit an/or rename the file.  What does the MCUInit.inc file actually contain?  Perhaps you could incorporate the contents of MCUInit.asm within the .inc file.

 

Regards,

Mac 

0 Kudos
1,029 Views
CompilerGuru
NXP Employee
NXP Employee

Processor Expert's device initialization does support absolute assembly.

I'm however not sure if an existing project can be manually changed or not. Could be, I just don't know. If not the you would have to create a new project and copy the modifications in manually.

 

Also note that the assembler does support the assembler ORG directive in relocatable assembly mode, so I don't see the real need to switch to begin with.

The only thing to note is that the areas used by ORG sections must not be listed in the prm file to receive relocatable content.

 

Daniel

 

0 Kudos
1,029 Views
TomHoag
Contributor II

The MCUinit.inc file seems to only contain a few XREF directives for the MCUinit.asm file and IRQ vectors.

 

I have looked for the option to switch Processor Expert from relocatable to Absolute, but I have not seen any option for it. 

 

I may try to build a new project for absolute assembly.  However, it seems to me that the selection for absolute assembly was greyed out, and not selectable.  I can't explain why that might be.

 

So I have yet to find a good solution.

 

0 Kudos
1,029 Views
TomHoag
Contributor II
I did check out the FAQ, and that makes sense.  I thought that I had unchecked the C options, but I think I need to try to build a new project and see if I can get the Absolute assembly option.  Then hopefully I can just import my source files.  I do not know if it will be possible to import the CPU configuration from Processor Expert.  May have to rebuild it, time consuming as it was.
0 Kudos
1,030 Views
TomHoag
Contributor II

It took a while to figure out, but I have converted my relocatable project to absolute.  For those interested, here's how to do it:

 

Build a new project using absolute assembly.

Copythe project.ipe file from the old project to the new one.  This way, no need to rebuild the Device Init.  Then reload it into device Initialization and generate the MCUinit.inc file.  It will generate an absolute file.

Copy all other source files to the new project.

Add the INCLUDE "MCUinit.inc" to the Main.asm file.

 

Now I can specify where I want all my code for my purposes.

 

Thanks all for the help...:smileyhappy:

0 Kudos
1,029 Views
J2MEJediMaster
Specialist I

Check out FAQ-28384 for some information on making projects with absolute assembly. To do that, you have to uncheck the C and C++ options, since those languages generate relocatable code, which can not be mixed with absolute assembly. I do not think you can undo a language choice after the wizard has generated the project. It might be easier to start over and add your source files to the absolute assembly project.

 

---Tom

Message Edited by J2MEJediMaster on 2009-05-28 10:29 AM
0 Kudos