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!