Hi all I need something like this __addressmod AREA_NAME; AREA_NAME int var[10]; so I can do sdcc -b AREA_NAME=0xA000 ... and place "var" (and possibly other variables) in special area, started at 0xA000. But its is not supported by SDCC so I made some patches to source code and get it to work. I want some expert opinion to make sure that it is not creating any problems in normal working of compiler and maybe add this to the source code, it is a nice feature to have. --- SDCCnaddr.cc 2017-11-13 15:27:56.000000000 +0330 +++ sdcc-3.9.0/src/SDCCnaddr.cc 2020-03-03 19:35:34.326969900 +0330 @@ -66,7 +66,12 @@ create_cfg_naddr(control_flow_graph, ic, ebbi); annotate_cfg_naddr(control_flow_graph, addrspaces); - + { + //mymod + auto itr = addrspaces.begin(); + if(addrspaces.size()>0) + if(!itr->second->addressmod[0]) return -1; + } if(options.dump_graphs) dump_cfg_naddr(control_flow_graph);
--- SDCCopt.c 2019-03-29 09:53:07.000000000 +0430 +++ sdcc-3.9.0/src/SDCCopt.c 2020-03-03 19:16:04.378813000 +0330 @@ -1516,6 +1516,8 @@ switchAddressSpaceAt (iCode *ic, const symbol *const addrspace) { iCode *newic; + //mymod + if(addrspace->addressmod[0] == 0)return; const symbol *const laddrspace = getAddrspaceiCode (ic); wassertl(!laddrspace || laddrspace == addrspace, "Switching to invalid address space."); @@ -3225,6 +3227,7 @@ other support routines, since we can assume that there is no bank switching happening in those other support routines (but assume that it can happen in other functions) */ +//mymod adjustIChain (ebbi->bbOrder, ebbi->count); ic = iCodeLabelOptimize (iCodeFromeBBlock (ebbi->bbOrder, ebbi->count)); if (!currFunc || switchAddressSpacesOptimally (ic, ebbi)) --- SDCC.y 2019-01-28 13:59:40.000000000 +0330 +++ sdcc-3.9.0/src/SDCC.y 2020-03-02 23:26:50.493479000 +0330 @@ -2457,6 +2457,16 @@ SPEC_CONST(type) = 1; sym->type = sym->etype = type; } + | ADDRESSMOD identifier ';' { //mymod + symbol *sym; + if ((sym = findSymWithLevel (AddrspaceTab, $2)) && sym->level == $2->level) + werrorfl (sym->fileDef, sym->lineDef, E_PREVIOUS_DEF); + addSym (AddrspaceTab, $2, $2->name, $2->level, $2->block, 0); + sym = findSymWithLevel (AddrspaceTab, $2); + sym->addressmod[0] = 0; + sym->addressmod[1] = 0; + } + ; identifier
_______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user