X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fxa51%2Fmain.c;h=03c72ef30505de72d3f577507518e6c7e9818df7;hb=a6209c13974db8d38261366f3460a920189239b3;hp=03aa0cb5af0bf95994efa11f5a984f9c34ae771a;hpb=a542ffa583670be2588b609cf8fc1ab8c25df48d;p=fw%2Fsdcc diff --git a/src/xa51/main.c b/src/xa51/main.c index 03aa0cb5..03c72ef3 100755 --- a/src/xa51/main.c +++ b/src/xa51/main.c @@ -136,18 +136,24 @@ static void _xa51_genXINIT (FILE * of) { static void _xa51_genAssemblerPreamble (FILE * of) { + symbol *mainExists=newSymbol("main", 0); + mainExists->block=0; + fprintf (of, "_errno\tsfr\t0x00; to keep the fp-lib's happy for now\n\n"); - fprintf (of, "\t.area CSEG\t(CODE)\n"); - fprintf (of, "__interrupt_vect:\n"); - fprintf (of, "\t.dw\t0x8f00\n"); - fprintf (of, "\t.dw\t__sdcc_gsinit_startup\n"); - fprintf (of, "\n"); - fprintf (of, "__sdcc_gsinit_startup:\n"); - fprintf (of, "\tmov\tr7,#0x%04x\n", options.stack_loc); - fprintf (of, "\tcall\t_external_startup\n"); - _xa51_genXINIT(of); - fprintf (of, "\tcall\t_main\n"); - fprintf (of, "\treset\t;main should not return\n"); + + if ((mainExists=findSymWithLevel(SymbolTab, mainExists))) { + fprintf (of, "\t.area CSEG\t(CODE)\n"); + fprintf (of, "__interrupt_vect:\n"); + fprintf (of, "\t.dw\t0x8f00\n"); + fprintf (of, "\t.dw\t__sdcc_gsinit_startup\n"); + fprintf (of, "\n"); + fprintf (of, "__sdcc_gsinit_startup:\n"); + fprintf (of, "\tmov\tr7,#0x%04x\n", options.stack_loc); + fprintf (of, "\tcall\t_external_startup\n"); + _xa51_genXINIT(of); + fprintf (of, "\tcall\t_main\n"); + fprintf (of, "\treset\t;main should not return\n"); + } } /* dummy linker for now */