+2003-07-02 Borut Razem <borut.razem@siol.net>
+
+ * src/port.h, src/SDCCmain.c, src/pic/glue.h, src/pic/main.c,
+ src/pic16/glue.h, sdcc/src/pic16/main.c, src/izt/i186.c,
+ src/izt/tlcs900h.c, src/avr/main.c, src/ds390/main.c, src/mcs51/main.c,
+ src/xa51/main.c, src/z80/main.c:
+ virtualization of glue() function: each port has it's own glue function,
+ which is accessed by do_glue function pointer in PORT.general structure
+
2003-07-01 Kevin Vigor <kevin@vigor.nu>
* DS800C400 fun, improved ROM interface and tinibios.
#define NUM_PORTS (sizeof(_ports)/sizeof(_ports[0]))
-#if !OPT_DISABLE_PIC
-extern void picglue ();
-#endif
-#if !OPT_DISABLE_PIC16
-extern void pic16glue();
-#endif
-
/** Sets the port to the one given by the command line option.
@param The name minus the option (eg 'mcs51')
@return 0 on success.
/* printVersionInfo - prints the version info */
/*-----------------------------------------------------------------*/
void
-printVersionInfo ()
+printVersionInfo (void)
{
int i;
/* printUsage - prints command line syntax */
/*-----------------------------------------------------------------*/
void
-printUsage ()
+printUsage (void)
{
int i;
printVersionInfo();
exit (1);
}
- if (TARGET_IS_PIC) {
- /* TSD PIC port hack - if the PIC port option is enabled
- and SDCC is used to generate PIC code, then we will
- generate .asm files in gpasm's format instead of SDCC's
- assembler's format
- */
-#if !OPT_DISABLE_PIC
- picglue ();
-#endif
-
- } else
- if(TARGET_IS_PIC16) {
- /* PIC16 port misc improvements Vangelis Rokas - 6-May-2003
- Generate .asm files for gpasm (just like PIC target) but use
- pic16glue()
- */
-
-#if !OPT_DISABLE_PIC16
- pic16glue();
-#endif
- } else {
- glue ();
- }
+ if (port->general.do_glue != NULL)
+ (*port->general.do_glue)();
+ else
+ {
+ /* this shouldn't happen */
+ assert(FALSE);
+ /* in case of NDEBUG */
+ glue();
+ }
if (!options.c1mode && !noAssemble)
{
"ATMEL AVR", /* Target name */
NULL, /* processor */
{
+ glue,
TRUE, /* Emit glue around main */
MODEL_LARGE | MODEL_SMALL,
MODEL_SMALL},
"DS80C390", /* Target name */
NULL,
{
+ glue,
TRUE, /* Emit glue around main */
MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
MODEL_SMALL
"DS80C400", /* Target name */
NULL,
{
+ glue,
TRUE, /* Emit glue around main */
MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
MODEL_SMALL
"Intel 80186", /* Target name */
NULL,
{
+ glue,
FALSE, /* Emit glue around main */
MODEL_SMALL,
MODEL_SMALL
"Toshiba TLCS-900H", /* Target name */
NULL,
{
+ glue,
TRUE, /* Emit glue around main */
MODEL_SMALL,
MODEL_SMALL
"MCU 8051", /* Target name */
NULL, /* Processor name */
{
+ glue,
TRUE, /* Emit glue around main */
MODEL_SMALL | MODEL_LARGE,
MODEL_SMALL
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
-#include "SDCCglobl.h"
-#include "SDCCmem.h"
-#ifndef SDCCGLUE_H
-#define SDCCGLUE_H 1
+#ifndef PIC_GLUE_H
+#define PIC_GLUE_H
-void glue ();
-/* drdani Jan 30 2000
- This is needed in gen.c of z80 port */
-char *aopLiteral (value *, int);
+void picglue (void);
#endif
#include "ralloc.h"
#include "device.h"
#include "SDCCutil.h"
+#include "glue.h"
//#include "gen.h"
"MCU pic", /* Target name */
"", /* Processor */
{
+ picglue,
TRUE, /* Emit glue around main */
MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
MODEL_SMALL
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
-#include "SDCCglobl.h"
-#include "SDCCmem.h"
-#ifndef SDCCGLUE_H
-#define SDCCGLUE_H 1
+#ifndef PIC16_GLUE_H
+#define PIC16_GLUE_H
-void glue ();
-/* drdani Jan 30 2000
- This is needed in gen.c of z80 port */
-char *aopLiteral (value *, int);
+void pic16glue (void);
#endif
#include "ralloc.h"
#include "device.h"
#include "SDCCutil.h"
+#include "glue.h"
//#include "gen.h"
"MCU PIC16", /* Target name */
"p18f452", /* Processor */
{
+ pic16glue,
TRUE, /* Emit glue around main */
MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
MODEL_SMALL
struct
{
+ /** Pointer to glue function */
+ void (*do_glue)(void);
/** TRUE if all types of glue functions should be inserted into
the file that also defines main.
We dont want this in cases like the z80 where the startup
"MCU 80C51XA", /* Target name */
NULL, /* Processor name */
{
+ glue,
FALSE, /* Emit glue around main */
MODEL_PAGE0,
MODEL_PAGE0
"Zilog Z80", /* Target name */
NULL, /* Processor name */
{
+ glue,
FALSE,
MODEL_MEDIUM | MODEL_SMALL,
MODEL_SMALL
"Gameboy Z80-like", /* Target name */
NULL,
{
+ glue,
FALSE,
MODEL_MEDIUM | MODEL_SMALL,
MODEL_SMALL