ssinfod

HCS12 Disassembler doesn't show constant variable

Discussion created by ssinfod on Aug 7, 2008
Latest reply on Aug 13, 2008 by ssinfod
Hi, I am currently working with a 9S12DP512 MCU.
 
I have the following code in 'C' and I want to see how the assembler is generating the assembly code for the constant variables. (array, struct, etc...)
 
Code:
#include <hidef.h>      /* common defines and macros */#include <mc9s12dp512.h>     /* derivative information */#pragma LINK_INFO DERIVATIVE "mc9s12dp512"const char array[] = {32,32,32,32,32,32,32,32,32,32,32,33,33,33,33,33,33,33,34,34,34,34,35,35,35,35,36,36,36,37,37,37,38,38,39,39,40,40,41,41,42,42,43,44,44,45,46,47,48,49,50,51,52,53,54,56,57,59,60,62,64,66,68,70,73,76,79,82,85,89,94};int val = 0;void mp_dummy(int in_param){    val = array[in_param];}void main(void) {  /* put your own code here */  EnableInterrupts;  mp_dummy(1);    for(;;) {} /* wait forever */}

 
When I use the disassembler, I don't see any "DC.x" declaration for the const array ? Where is it ? Is there an option to display the generated assembly code for the constant ?
 
Code:
ANSI-C/cC++ Compiler for HC12 V-5.0.24 Build 4047, Feb 17 2004    1:  #include <hidef.h>      /* common defines and macros */    2:  #include <mc9s12dp512.h>     /* derivative information */    3:      4:      5:  #pragma LINK_INFO DERIVATIVE "mc9s12dp512"    6:      7:  const char array[] = {32,32,32,32,32,32,32,32,32,32,32,33,33,33,33,33,33,33,34,34,34,34,35,35,35,35,36,36,36,37,37,37,38,38,39,39,40,40,41,41,42,42,43,44,44,45,46,47,48,49,50,51,52,53,54,56,57,59,60,62,64,66,68,70,73,76,79,82,85,89,94};    8:      9:  int val = 0;   10:     11:  void mp_dummy(int in_param)   12:  {Function: mp_dummySource  : C:\Example\Sources\main.cOptions : -D_HCS12 -D__NO_FLOAT__ -Env"GENPATH=C:\Example;C:\Example\bin;C:\Example\prm;C:\Example\cmd;C:\Example\Sources;C:\CodeWarrior CW12_V3.1\lib\HC12c\lib;C:\CodeWarrior CW12_V3.1\lib\HC12c\src;C:\CodeWarrior CW12_V3.1\lib\HC12c\include" -Env"LIBPATH=C:\CodeWarrior CW12_V3.1\lib\HC12c\include" -Env"OBJPATH=C:\Example\bin" -Env"TEXTPATH=C:\Example\bin" -Lasm="C:\Example\Example-Disassemble_Data\Simulator\ObjectCode\main.c.lst" -Mb -ObjN="C:\Example\Example-Disassemble_Data\Simulator\ObjectCode\main.c.o" -WmsgSd1106  0000 3b           PSHD     13:      val = array[in_param];  0001 e681         LDAB  1,SP  0003 ce0000       LDX   #array  0006 a6e5         LDAA  B,X  0008 b705         SEX   A,X  000a 7e0000       STX   val   14:  }  000d 3a           PULD    000e 0a           RTC      15:     16:  void main(void)    17:  {Function: mainSource  : C:\Example\Sources\main.cOptions : -D_HCS12 -D__NO_FLOAT__ -Env"GENPATH=C:\Documents and Settings\phd\Local Settings\Application Data\Example-Disassemble;C:\Example\bin;C:\Example\prm;C:\Example\cmd;C:\Example\Sources;C:\CodeWarrior CW12_V3.1\lib\HC12c\lib;C:\CodeWarrior CW12_V3.1\lib\HC12c\src;C:\CodeWarrior CW12_V3.1\lib\HC12c\include" -Env"LIBPATH=C:\CodeWarrior CW12_V3.1\lib\HC12c\include" -Env"OBJPATH=C:\Example\bin" -Env"TEXTPATH=C:\Example\bin" -Lasm="C:\Example\Example-Disassemble_Data\Simulator\ObjectCode\main.c.lst" -Mb -ObjN="C:\Example\Example-Disassemble_Data\Simulator\ObjectCode\main.c.o" -WmsgSd1106   18:    /* put your own code here */   19:    EnableInterrupts;  0000 10ef         CLI      20:    mp_dummy(1);  0002 c601         LDAB  #1  0004 87           CLRA    0005 4a000000     CALL  mp_dummy,PAGE(mp_dummy)   21:       22:    for(;;) {} /* wait forever */  0009 20fe         BRA   *+0 ;abs = 0009   23:  }   24: 

 
As you see, there is no ASM code for the "const char array[]" variable. The same thing happen for more complex data type.
 
Any idea ?
 
Thanks
 
 
 
 
 
 

Outcomes