how to use full chip simulator of hc908

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

how to use full chip simulator of hc908

3,490 Views
tongjifres
Contributor I
hi all,
 
I never used simulator of codewarrior before, seems l had some problems.
 
I am using hc908ab32 and codewarrior v3.1, and I didnt use the new project wizard to creat the project but hco8 stationery-legacy-simulator-c generic. After I debug it, i find there is no memory at frome 0x0000 to 0x0040, where should be the image of i/o and i/o register.ect.  I defined it in my own reg.h as
 
 #define  PORTA_REG  (*(volatile unsigned char*)(0x0003))
 
 like this.
I think its right. why  no memory  when i start it in simulator?
 
And I also creat project use wizard, i found the memory was ok.
 
can anyone kindly tell me the reason, or tell me how can i find the information or book of codewarrior's simulator.
 
Thanks
 
warm regards
 
tongjifres
 
 
 
 
Labels (1)
0 Kudos
Reply
9 Replies

1,084 Views
CrasyCat
Specialist III
Hello
 
 The HC08 Legacy Simulator stationery are creating projects for instruction set simulator only.
  It does not enable Full Chip Simulator.
 
   In order to be able to use full chip simulator, you need to create your project using the wizard.
 
CrasyCat
0 Kudos
Reply

1,084 Views
tongjifres
Contributor I
thank you for your kindness
 
And the remain questions:
is it right tha no memory at 0x0000 to 0x0040, where I defined the I/O port and i/o reg?
how instruction set simulator works? can anyone give me an example kindly, i totally have no idea how to make it. Since i cant creat project use wizard, I have to use this way.
 
regards
 
thanks again.
 
 
0 Kudos
Reply

1,084 Views
CrasyCat
Specialist III
Hello
 
If you create your project using the wizard, it will set up the simulator to load the memory map from the specified MCU.
 
Why can't you use the wizard to create your project?
  
CrasyCat
0 Kudos
Reply

1,084 Views
tongjifres
Contributor I
Hello CrasyCat
 
Thanks for your help!
 
The sw code I am focsing on is written by one German guy 6 years ago, and my job is to simplify one part of it. I have done some job to make it can be compiled by codewarrior, caz I did not use codewarrior too much before, I just created the project without wizard. If I use wizard, too many change should be done of the code, and I dont understanding codewarrior very well too. So i just wanna to use the simulator without hardware to find out whether the code can works well or not.
 
Is there any good idea by chance?
 
By the way , the project is used for MCU in vehicle for theftproof.
 
cheers
 
0 Kudos
Reply

1,084 Views
tongjifres
Contributor I
hi,I wanna have a try. 
 
And one question about using wizard to creat project, is it ok if i change the hc908ab32.h to my own one? and also i have my own startup08.c too, if i change them, can FCS works?
In fact, I have all h and c file the project needs, so i just wonder if i use wizard and dont use the system auto-set h and c file-like main.c and startup08.c, can FCS work?
 
so appreciate your answer.
 
0 Kudos
Reply

1,084 Views
CrasyCat
Specialist III
Hello
 
After you have created the project with the wizard you can modify it as you wish.
You can remove all source and include file in there and replace them by your own files.
 
This should work as well and should not prevent the FCS from working.
 
CrasyCat
0 Kudos
Reply

1,084 Views
CrasyCat
Specialist III
Hello
 
And to close the loop here (and if you really want to keep your project and switch the connection to FCS), this can be done as follows:
  - Start the debugger as usual.
  - Select "Component" -> "Set Target". The "Set Target" dialog is opened.
  - Select "P&E Target Interface"
  - Click on OK to close the dialog.
  - In the "PEDebug" menu make sure "Mode" is set to "Full Chip Simulation"
  - Select "PEDebug" -> "Device" and  select the part you want to simulate
  - Select File -> "Save Configuration" to save the configuration for next time
 
This should be it.
Note that the steps above only work for CodeWarrior HC08 V3.1.
The name of the connection /dialog did change in V5.0 and higher.
 
CrasyCat
0 Kudos
Reply

1,084 Views
tongjifres
Contributor I
Hi CrasyCat,
 
Thanks for your support!
 
I did reset the project using wizard, and i used my own files, but after i debugged it, there was error "starup.c.o should contain DWARF information", how did this problem come ?
 
Here are the startup header file and c file, plz check it
--c file------------------------------------------------------------------------------------------------------------------------------
#include "start08.h"
#include "clr_mem.h"
#include "microdef.h"
#include "basicmac.h"
/**********************************************************************/
/**************************/
/* StartupData Descriptor */
/**************************/
/*typedef struct
{
  T_UBYTE dummy;
}_tagStartupData;
_tagStartupData _startupData ;
extern NEAR_FCT void main(void);
*/
struct _tagStartup _startupData;    /* read-only: _startupData is allocated in ROM and
                                       initialized by the linker */

#pragma SAFE_OPT_ONLY
#ifdef __cplusplus
  extern "C"
#endif
void _Startup (void)
/*
    purpose:    1)  initialize the stack
                2)  initialize the RAM
                3)  call main;
*/
{
    /* Mask All Interrupts  */
    DISABLE_INTERRUPTS;
    INIT_STACK;
    clr_mem();
//    main();
    (* _startupData.main) ();
}
--------------------h file-------------------------------------------------------------------------------------------------------
#ifndef START08_H
#define START08_H
#ifdef __cplusplus
extern "C" {
#endif
/*
  the following datastructures contain the data needed to
  initialize the processor and memory
*/
typedef struct{
  unsigned char *beg;
  int size;      /* [beg..beg+size] */
} _Range;
typedef struct _Copy{
  int size;
  unsigned char * dest;
} _Copy;
typedef void (*_PFunc)(void);
typedef struct _LibInit{
  _PFunc  *startup;      /* address of startup desc */
} _LibInit;
typedef struct _Cpp{
  _PFunc  initFunc;      /* address of init function */
} _Cpp;
#define STARTUP_FLAGS_NONE          0
#define STARTUP_FLAGS_ROM_LIB       (1<<0)  /* if module is a ROM library */
#define STARTUP_FLAGS_NOT_INIT_SP   (1<<1)  /* if stack pointer has not to be initialized */
#ifdef __ELF_OBJECT_FILE_FORMAT__
/* ELF/DWARF object file format */
/* attention: the linker scans the debug information for this structures */
/* to obtain the available fields and their sizes. */
/* So dont change the names in this file. */
extern struct _tagStartup {
     unsigned char   flags;           /* STARTUP_FLAGS_xxx */
     _PFunc          main;            /* top level procedure of user program */
     unsigned short  stackOffset;     /* initial value of the stack pointer */
     unsigned short  nofZeroOuts;     /* number of zero out ranges */
     _Range          *pZeroOut;       /* vector of ranges with nofZeroOuts elements */
     _Copy           *toCopyDownBeg;  /* rom-address where copydown-data begins */
     unsigned short  nofLibInits;     /* number of library startup descriptors */
     _LibInit        *libInits;       /* vector of pointers to library startup descriptors */
     unsigned short  nofInitBodies;   /* number of init functions for C++ constructors */
     _Cpp            *initBodies;     /* vector of function pointers to init functions for C++ constructors */
} _startupData;   
#else
extern struct _tagStartup{
     unsigned   flags;            
    _PFunc      main;            /* top procedure of user program */
     unsigned   dataPage;        /* page where data allocation begins */
     long       stackOffset;
     int        nofZeroOuts;
    _Range      *pZeroOut;       /* pZeroOut is a vector of ranges with nofZeroOuts elements */
     long       toCopyDownBeg;   /* rom-address where copydown-data begins */
    _PFunc      *mInits;         /* mInits is a vector of function pointers, terminated by 0 */
    _PFunc      *libInits;       /* libInits is a vector of function pointers, terminated by 0x0000FFFF */
} _startupData; 
#endif 
extern void _Startup(void);    /* execution begins in this procedure */  
/*--------------------------------------------------------------------*/
#ifdef __cplusplus
 }
#endif
#endif
--------------------------------------------------------------------------------------------------------------------------------------
 
and I dont make it clear that how does the mcu load entry point startup firstly, should i put VECTOR 0 _startup in prm file? I didnt put that vector in my project created without wizard, seems it can be compiled well, and in map file, the entry point is 0xBE00, and in prm file, i put .text into rom1(0xBE00 to 0xF7C).
 
regards!
 
0 Kudos
Reply

1,084 Views
CrasyCat
Specialist III
Hello
 
I looks like you are not generating debug information when building the source files.
 
Please search for FAQ-27442 on Freescale Web page to see how to activate generation of debug information when you build source files.
 
I hope that help. 
 
CrasyCat
0 Kudos
Reply