AnsweredAssumed Answered

Getting started with HC12 relocatable code SECTIONS.

Question asked by Robert Norman on Sep 2, 2006
Latest reply on Sep 5, 2006 by CompilerGuru
I'm new to HC12 but have used Metrowerks for years, most recently on a 56300E project in mixed and assembly.  I'm just getting acquinted with the HC12 and wanted to model a relocatable assembly project.
 
Starting with the code wizard, I have a nice little main program that calls its own subroutine.
 
Trying to take the next logical step, I've been  unable to put that subroutine in its own assembly file, or even in another section in  main.asm. 
 
I include the MySub.asm by adding the file to the Sources folder and everything compiles fine (using the appropriate XDEFs and XREFs), but the subroutine call fails, and the map shows that its entry point is at  0x388000 rather than in the Cxxx range.
 
Can you point me to a  simple relocatable project or explain what is necessary to add other code modules?  I'm assuming I don't have to change the Link PRM file since it says:
 
/* This is a linker parameter file for the MC9S12E128 */
NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */
 
Here's my subroutine file.

 XDEF   CalcFibo2
; code section

; include derivative specific macros
           INCLUDE 'mc9s12e128.inc'

; code section
MyCode:     SECTION  ; <-----Same as in main.asm
; Function to calculate fibonacci numbers. Argument is in X.
CalcFibo2:
           NOP
            ...
           ....
           RTS                        ; result in D
 
 
I've tried searching the help files and spent some time searching this forum.  This is just such a basic question  -- what have I missed?
 
Rob
 

 

Outcomes