Hi, Philipp. Here's the attached patch. Now the pic14 branch remains backwards compatible with the trunk.
I made a mistake in my explanation: the code to handle the configuration words must be moved to pic14_emitStaticSeg, not to pic14_emitRegularMap. Regards. El Thu, 3 Oct 2019 09:20:17 +0200 Philipp Klaus Krause <p...@spth.de> escribió: > Am 24.07.19 um 20:53 schrieb Gonzalo Pérez de Olaguer Córdoba: > > Hi, Philipp and Don. > > > > The error with the configuration words can be avoided by declaring > > them 'static', as shown (but not explicitly said) in the sdcc manual. > > > > And to make the pic14 branch backwards compatible with the trunk with > > respect to this issue, a change in src/pic14/glue.c should be made: > > > > - The pieces of code that handle the configuration words can be identified > > looking for a call to pic14_assignConfigWordValue. > > > > - In trunk it appears in pic14_constructAbsMap and in emitSymbolSet. > > > > - In the pic14 branch only appears in pic14_constructAbsMap. It should be > > removed from this function and be moved to pic14_emitRegularMap. > > > > I think the right way to go here should be to consider obsolete and > > discourage > > this way to define values for the configuration words and implement it > > through pragmas (as pic16 already does), and extend it to also support > > ID locations. > > Can you provide a patch against the pic14 branch, that implements your > suggestion? > > Philipp > -- Gonzalo Pérez de Olaguer Córdoba s...@gpoc.es -=- buscando empleo desde 1988 -=- www.gpoc.es PGP: 3F87 CCE7 8B35 8C06 E637 2D57 5723 9984 718C A614
Index: src/pic14/glue.c =================================================================== --- src/pic14/glue.c (revisión: 11417) +++ src/pic14/glue.c (copia de trabajo) @@ -275,24 +275,6 @@ DBG_ENTRY (); addr = SPEC_ADDR (sym->etype); - /* handle CONFIG words here */ - if (IS_CONFIG_ADDRESS (addr)) - { - //fprintf( stderr, "%s: assignment to CONFIG@0x%x found\n", __FUNCTION__, addr ); - //fprintf( stderr, "ival: %p (0x%x)\n", sym->ival, (int)list2int( sym->ival ) ); - if (sym->ival) - { - DBG_MSG ("config word addr 0x%04X value 0x%04X", addr, (int) list2int (sym->ival)); - pic14_assignConfigWordValue (addr, (int) list2int (sym->ival)); - } - else - { - fprintf (stderr, "ERROR: Symbol %s, which is covering a __CONFIG word must be initialized!\n", sym->name); - } - DBG_EXIT (); - return; - } - if (absmap_max == -1 || addr > absmap_max) absmap_max = addr; if (absmap_min == -1 || addr < absmap_min) @@ -2257,6 +2239,29 @@ DBG_SYMBOL ("symbol", sym); DBG_ENTRY (); + if (SPEC_ABSA (sym->etype)) + { + int addr = SPEC_ADDR (sym->etype); + + /* handle CONFIG words here */ + if (IS_CONFIG_ADDRESS (addr)) + { + //fprintf( stderr, "%s: assignment to CONFIG@0x%x found\n", __FUNCTION__, addr ); + //fprintf( stderr, "ival: %p (0x%x)\n", sym->ival, (int)list2int( sym->ival ) ); + if (sym->ival) + { + DBG_MSG ("config word addr 0x%04X value 0x%04X", addr, (int) list2int (sym->ival)); + pic14_assignConfigWordValue (addr, (int) list2int (sym->ival)); + } + else + { + fprintf (stderr, "ERROR: Symbol %s, which is covering a __CONFIG word must be initialized!\n", sym->name); + } + DBG_EXIT (); + continue; + } + } + /* if it is "extern" then do nothing */ if (IS_EXTERN (sym->etype) && !sym->ival) {
pgpQOpSccaCk1.pgp
Description: Firma digital OpenPGP
_______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user