AnsweredAssumed Answered

Absolute Sections in HC(S)12 ASM file

Question asked by Neil Garner on Sep 21, 2008
Latest reply on Sep 21, 2008 by Neil Garner
Hi folks

I'm new, not only to this forum, but to Freescale micros generally.

I have recently designed an embedded controller using S12XDT512 (single-chip mode), including schematic & PCB layout, and will shortly be installing firmware (written by yours truly) to handle system IO & general housekeeping operations. This is where my remit will end, since although I'm an experienced electronic/hardware designer, I'm only a low-level man from a software point of view (as well as socially). I need to hand over the design, complete with said firmware, to others who are expert in the loftier realms of application programming.

Currently I'm trying to get the hang of CW IDE (V4.7 installed), to produce both assembly and C modules. I've been reading the document called Assembler_HC12.pdf (July 2007 revision), in particular the chapter on Sections. I can be a bit muddle-headed at times (as my forum alias suggests), and my present problem is understanding the rationale behind the ORG directive - or at least what that document says about it.

The following example is given:

XDEF entry

ORG $A00          ; Absolute constant data section.
cst1: DC.B $A6
cst2: DC.B $BC
ORG $800          ; Absolute data section.
var: DS.B 1

ORG $C00          ; Absolute code section.

       < assembly instructions >

It then goes on to explain that two bytes of storage are allocated at $A00. The constant variablecst1 will be allocated one byte at address $8000 and another,cst2, will be allocated one byte at $8001.

How does $8000 relate to the ORG $A00 bit? Is it just a case of someone creating a document by cutting and pasting bits from two earlier documents without changing essential details? Or is my brain even more addled than I thought?

(PS: I have taken a look through past postings, in case the answer may already exist somewhere, but no luck).