/* defs.h Constants, prototypes and external declarations included from asssembler startup and C-files */ #include "md407.h" #include #include #define MAJOR_VERSION 1 #define MINOR_VERSION 1 #define PROMPTER "\ndbg:" #define DEBUGGER_NAME "dbgARM" #define DEBUGGER_MACHINE "MD407 (ARM Cortex-M4)" #define DATE_VERSION "2021-11-08" /* Default size for memory access commands (1,2 or 4) */ #define DEFSIZ 4 /* Maximum number of breakpoints (table size) */ #define MAXBP 10 /* Size of global input buffer */ #define MAXARGS 4 #define MAXARGLENGTH 20 #define SZOFINBUF MAXARGS*MAXARGLENGTH /* Types */ // todo; arrange so that LDMIS STMIA can be used... typedef struct t_alregs{ int r0; // 0 int r1; // 4 int r2; // 8 int r3; // 12 int r4; // 16 int r5; // 20 int r6; // 24 int r7; // 28 int r8; // 32 int r9; // 36 int r10; // 40 int r11; // 44 int r12; // 48 int sp; // 52 int lr; // 56 int pc; // 60 int apsr; // 64 int stackPSP; // 68 int stackMSP; // 72 }AL_REGS; typedef struct t_fpregs{ int s0; // 0 int s1; // 4 int s2; // 8 int s3; // 12 int s4; // 16 int s5; // 20 int s6; // 24 int s7; // 28 int s8; // 32 int s9; // 36 int s10; // 40 int s11; // 44 int s12; // 48 int s13; // 52 int s14; // 56 int s15; // 60 int fpscr; // 64 int s16; // 68 int s17; // 68 int s18; // 68 int s19; // 68 int s20; // 68 int s21; // 68 int s22; // 68 int s23; // 68 int s24; // 68 int s25; // 68 int s26; // 68 int s27; // 68 int s28; // 68 int s29; // 68 int s30; // 68 int s31; // 68 }FP_REGS; extern AL_REGS alregs; extern FP_REGS fpregs; typedef struct __attribute((packed)) tag_ContextFrame { unsigned long r0; unsigned long r1; unsigned long r2; unsigned long r3; unsigned long r12; unsigned long lr; unsigned long pc_return; unsigned long xpsr; unsigned long s0; unsigned long s1; unsigned long s2; unsigned long s3; unsigned long s4; unsigned long s5; unsigned long s6; unsigned long s7; unsigned long s8; unsigned long s9; unsigned long s10; unsigned long s11; unsigned long s12; unsigned long s13; unsigned long s14; unsigned long s15; unsigned long fpscr; unsigned long Res1; unsigned long Res2; } ContextFrame, *PContextFrame; /* * Global data */ extern unsigned long * g_pfnVectors[]; extern unsigned long * g_pfnVectors_copy[]; extern long system_stack; /* * Prototypes */ /* lowlevel.s */ //void traceone( void ); //void lowgo( unsigned short * ); void restart(void); /* main.c */ void help( int, unsigned char* ); void help_tr( void ); void help_go( void ); void help_mm( void ); void help_reg( void ); void help_dm( void ); void help_bp( void); void restore_vectorbase( int ); void init( void ); void _outchar( unsigned char ); unsigned char _inchar( void ); /* lcd.c */ void graphic_initalize(void); /* 0xDFF0 */ void graphic_clearScreen(void); /* 0xDFF1 */ void pixelset( int x, int y); /* 0xDFF2 */ void pixelclear( int x, int y); /* 0xDFF3 */ /* run.c */ void prstat( void ); /* dasm_XXX.c */ // dasm_hc12.c - Public functions in far segment int Instruction( unsigned long address, int print); void dasm( int argc, char ** argv); /* bp.c */ void breaks( int argc , char **argv ); void inibp( void ); int isbreak( unsigned short * address ); int setbp( unsigned short * address , int new); void rembp( int new ); void enbreak( unsigned short * address ); void disbreak( void ); /* exceptions.c */ void traced( void ); void atbreak( void ); // command routines void mm( int ,char **); void dm( int ,char **); void trace( int argc, char ** argv); void go( int argc, char ** argv); void reg( int argc, char ** argv); void load( void ); void fload(void); /* reg.c */ /* Target dependent routines */ void inireg( void ); void printregs( void ); void printreg( char * ); void setreg( char *, int ); void printallregs( void ); unsigned long getMSPReg( void ); unsigned long getPSPReg( void ); unsigned long getApsrReg( void ); unsigned long getEapsrReg( void ); unsigned long getPsrReg( void ); unsigned long getEpsrReg( void ); unsigned long getPrimaskReg( void ) ; unsigned long getFaultmaskReg( void ) ; unsigned long getBasepriReg( void ); unsigned long getBasepri_MaxReg( void ); unsigned long getControlReg( void ); void setControlReg( unsigned long x ); void setBasepriReg( unsigned long value ); /* util.c */ void smallprintf( char * , ... ); unsigned char atohex( char ); void puthex( char i ); void puthex2( short int i); int decval( char * s ,int complain); int strtoint(char * start, int base, int complain, int *newnum, int *page); void getstring( char *ptr , int max, int hot ); int strcmpi( char *s1 , char *s2 ); //void putsnnl( char *s ); int noteol( char c ); char * skipblanc( char *str ); char * skipnonblanc( char *str ); void printable(char * start, int length); int getsize( char * s, int complain ); /* externals - data.c */ extern unsigned char inbuf[]; extern int hottrace; extern char ready; extern int * vector_base;