X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fpic16%2Fdevice.c;h=8878ed0799935e17bef44c6935179b32d819da93;hb=fc9f8d30f7f7ee34e195357753de502eb429a585;hp=9420f969fc3feb439416df66f214cc1062c7e57e;hpb=62545f9d9b181697e88bff60ef297132b6eee4f6;p=fw%2Fsdcc diff --git a/src/pic16/device.c b/src/pic16/device.c index 9420f969..8878ed07 100644 --- a/src/pic16/device.c +++ b/src/pic16/device.c @@ -42,421 +42,11 @@ static PIC16_device Pics16[] = { -// { -// {"p18f242", "18f242", "pic18f242", "f242"}, // aliases -// 0, -// 0x300, // RAMsize -// 0, -// { 0xf80, 0xfff }, /* PIC18F242 range of SFR's */ -// { -// /* PIC18F242 configuration words */ -// 0x300001, -// 0x30000d, -// { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , -// { -1, 0, 0xff } /* 4 */ , { 0x01, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , -// { -1, 0, 0xff } /* 7 */ , { 0x03, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , -// { 0x03, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x03, 0, 0xff } /* c */ , -// { 0x40, 0, 0xff } /* d */ } -// } -// }, - - { - {"p18f242", "18f242", "pic18f242", "f242"}, - 0, - 0x300, /* 768 */ - 0x80, - 0, - { 0xf80, 0xfff }, /* PIC18F242 range of SFR's */ - { - /* PIC18F242 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { 0x01, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x03, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x03, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x03, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f248", "18f248", "pic18f248", "f248"}, - 0, - 0x300, /* 768 */ - 0x60, - 0, - { 0xf00, 0xfff }, /* PIC18F248 range of SFR's */ - { - /* PIC18F248 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { -1, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x03, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x03, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x03, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f252", "18f252", "pic18f252", "f252"}, - 0, - 0x600, /* 1536 */ - 0x80, - 0, - { 0xf80, 0xfff }, /* PIC18F252 range of SFR's */ - { - /* PIC18F252 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { 0x01, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x0f, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x0f, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x0f, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f258", "18f258", "pic18f258", "f258"}, - 0, - 0x600, /* 1536 */ - 0x60, - 0, - { 0xf00, 0xfff }, /* PIC18F258 range of SFR's */ - { - /* PIC18F258 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { -1, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x0f, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x0f, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x0f, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f442", "18f442", "pic18f442", "f442"}, - 0, - 0x300, /* 768 */ - 0x80, - 0, - { 0xf80, 0xfff }, /* PIC18F442 range of SFR's */ - { - /* PIC18F442 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { 0x01, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x03, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x03, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x03, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f448", "18f448", "pic18f448", "f448"}, - 0, - 0x300, /* 768 */ - 0x60, - 0, - { 0xf00, 0xfff }, /* PIC18F448 range of SFR's */ - { - /* PIC18F448 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { -1, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x03, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x03, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x03, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f452", "18f452", "pic18f452", "f452"}, - 0, - 0x600, /* 1536 */ - 0x80, - 0, - { 0xf80, 0xfff }, /* PIC18F452 range of SFR's */ - { - /* PIC18F452 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { 0x01, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x0f, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x0f, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x0f, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f458", "18f458", "pic18f458", "f458"}, - 0, - 0x600, /* 1536 */ - 0x60, - 0, - { 0xf00, 0xfff }, /* PIC18F458 range of SFR's */ - { - /* PIC18F458 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { -1, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x0f, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x0f, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x0f, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f1220", "18f1220", "pic18f1220", "f1220"}, - 0, - 0x100, /* 256 */ - 0x80, - 0, - { 0xf80, 0xfff }, /* PIC18F1220 range of SFR's */ - { - /* PIC18F1220 configuration words */ - 0x300001, - 0x30000d, - { { 0xcf, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x1f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { 0x80, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x03, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x03, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x03, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f2220", "18f2220", "pic18f2220", "f2220"}, - 0, - 0x200, /* 512 */ - 0x80, - 0, - { 0xf80, 0xfff }, /* PIC18F2220 range of SFR's */ - { - /* PIC18F2220 configuration words */ - 0x300001, - 0x30000d, - { { 0xcf, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x1f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { 0x83, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x03, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x03, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x03, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f6520", "18f6520", "pic18f6520", "f6520"}, - 0, - 0x800, /* 2048 */ - 0x60, - 0, - { 0xf6b, 0xfff }, /* PIC18F6520 range of SFR's */ - { - /* PIC18F6520 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { 0x80, 0, 0xff } /* 4 */ , { 0x88, 0, 0xff } /* 5 */ , { -1, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x0f, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x0f, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x0f, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f6620", "18f6620", "pic18f6620", "f6620"}, - 0, - 0xf00, /* 3840 */ - 0x60, - 0, - { 0xf6b, 0xfff }, /* PIC18F6620 range of SFR's */ - { - /* PIC18F6620 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { 0x01, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x0f, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x0f, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x0f, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f6680", "18f6680", "pic18f6680", "f6680"}, - 0, - 0xf00, /* 3840 */ - 0x60, - 0, - { 0xf00, 0xfff }, /* PIC18F6680 range of SFR's */ - { - /* PIC18F6680 configuration words */ - 0x300001, - 0x30000d, - { { 0x2f, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x1f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { 0x83, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x0f, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x0f, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x0f, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f6720", "18f6720", "pic18f6720", "f6720"}, - 0, - 0xf00, /* 3840 */ - 0x60, - 0, - { 0xf6b, 0xfff }, /* PIC18F6720 range of SFR's */ - { - /* PIC18F6720 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { -1, 0, 0xff } /* 4 */ , { 0x01, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0xff, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0xff, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0xff, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f8520", "18f8520", "pic18f8520", "f8520"}, - 0, - 0x800, /* 2048 */ - 0x60, - 1, - { 0xf6b, 0xfff }, /* PIC18F8520 range of SFR's */ - { - /* PIC18F8520 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { 0x83, 0, 0xff } /* 4 */ , { 0x88, 0, 0xff } /* 5 */ , { -1, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x0f, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x0f, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x0f, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f8620", "18f8620", "pic18f8620", "f8620"}, - 0, - 0xf00, /* 3840 */ - 0x60, - 1, - { 0xf6b, 0xfff }, /* PIC18F8620 range of SFR's */ - { - /* PIC18F8620 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { 0x83, 0, 0xff } /* 4 */ , { 0x01, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x0f, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x0f, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x0f, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f8680", "18f8680", "pic18f8680", "f8680"}, - 0, - 0xf00, /* 3840 */ - 0x60, - 0, - { 0xf00, 0xfff }, /* PIC18F8680 range of SFR's */ - { - /* PIC18F8680 configuration words */ - 0x300001, - 0x30000d, - { { 0x2f, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x1f, 0, 0xff } /* 3 */ , - { 0x83, 0, 0xff } /* 4 */ , { 0x83, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0x0f, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0x0f, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0x0f, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - }, - { - {"p18f8720", "18f8720", "pic18f8720", "f8720"}, - 0, - 0xf00, /* 3840 */ - 0x60, - 1, - { 0xf6b, 0xfff }, /* PIC18F8720 range of SFR's */ - { - /* PIC18F8720 configuration words */ - 0x300001, - 0x30000d, - { { 0x27, 0, 0xff } /* 1 */ , { 0x0f, 0, 0xff } /* 2 */ , { 0x0f, 0, 0xff } /* 3 */ , - { 0x83, 0, 0xff } /* 4 */ , { 0x01, 0, 0xff } /* 5 */ , { 0x85, 0, 0xff } /* 6 */ , - { -1, 0, 0xff } /* 7 */ , { 0xff, 0, 0xff } /* 8 */ , { 0xc0, 0, 0xff } /* 9 */ , - { 0xff, 0, 0xff } /* a */ , { 0xe0, 0, 0xff } /* b */ , { 0xff, 0, 0xff } /* c */ , - { 0x40, 0, 0xff } /* d */ } - }, - { 0x200000, 0x200007, - { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, { 0, 0 }, { 0, 0 } } - } - } - +/* Device descriptions are now generated by scripts. + * For simplicities sake we just include them here. + * Manual overrides may be inserted on top of devices.inc + * or right here BEFORE inclusion of devices.inc. */ +#include "devices.inc" }; static int num_of_supported_PICS = sizeof(Pics16)/sizeof(PIC16_device); @@ -469,8 +59,6 @@ PIC16_device *pic16=NULL; unsigned int stackPos = 0; unsigned int stackLen = 0; -extern regs* newReg(short type, short pc_type, int rIdx, char *name, int size, int alias, operand *refop); - void pic16_setMaxRAM(int size) { pic16->maxRAMaddress = size; @@ -564,12 +152,14 @@ int symCompare(const void *a, const void *b) void pic16_dump_usection(FILE *of, set *section, int fix) { static int abs_usection_no=0; + static unsigned int usection_no=0; regs *r, *rprev; unsigned int init_addr, i; regs **rlist; regs *r1; /* put all symbols in an array */ + if (!elementsInSet(section)) return; rlist = Safe_calloc(elementsInSet(section), sizeof(regs *)); r = rlist[0]; i = 0; for(rprev = setFirstItem(section); rprev; rprev = setNextItem(section)) { @@ -577,7 +167,7 @@ void pic16_dump_usection(FILE *of, set *section, int fix) } if(!i) { - if(rlist)free(rlist); + if(rlist)Safe_free(rlist); return; } @@ -595,7 +185,8 @@ void pic16_dump_usection(FILE *of, set *section, int fix) } #else for(r = setFirstItem(section); r; r = setNextItem(section)) { - fprintf(of, "\nudata_%s_%s\tudata\n", moduleName, r->name); + //fprintf(of, "\nudata_%s_%s\tudata\n", moduleName, r->name); + fprintf(of, "\nudata_%s_%u\tudata\n", moduleName, usection_no++); fprintf(of, "%s\tres\t%d\n", r->name, r->size); statistics.udsize += r->size; } @@ -631,7 +222,7 @@ void pic16_dump_usection(FILE *of, set *section, int fix) rprev = r; } } - free(rlist); + Safe_free(rlist); } void pic16_dump_gsection(FILE *of, set *sections) @@ -667,6 +258,7 @@ void pic16_dump_isection(FILE *of, set *section, int fix) symbol **slist; /* put all symbols in an array */ + if (!elementsInSet(section)) return; slist = Safe_calloc(elementsInSet(section), sizeof(symbol *)); s = slist[0]; i = 0; for(sprev = setFirstItem(section); sprev; sprev = setNextItem(section)) { @@ -674,7 +266,7 @@ void pic16_dump_isection(FILE *of, set *section, int fix) } if(!i) { - if(slist)free(slist); + if(slist)Safe_free(slist); return; } @@ -740,7 +332,7 @@ void pic16_dump_isection(FILE *of, set *section, int fix) sprev = s; } } - free(slist); + Safe_free(slist); } @@ -751,6 +343,7 @@ void pic16_dump_int_registers(FILE *of, set *section) regs **rlist; /* put all symbols in an array */ + if (!elementsInSet(section)) return; rlist = Safe_calloc(elementsInSet(section), sizeof(regs *)); r = rlist[0]; i = 0; for(rprev = setFirstItem(section); rprev; rprev = setNextItem(section)) { @@ -761,7 +354,7 @@ void pic16_dump_int_registers(FILE *of, set *section) qsort(rlist, elementsInSet(section), sizeof(regs *), regCompare); if(!i) { - if(rlist)free(rlist); + if(rlist)Safe_free(rlist); return; } @@ -773,7 +366,7 @@ void pic16_dump_int_registers(FILE *of, set *section) statistics.intsize += r->size; } - free(rlist); + Safe_free(rlist); } @@ -783,8 +376,6 @@ void pic16_dump_int_registers(FILE *of, set *section) #define _ENDIAN(x) (x) #endif -#define BYTE_IN_LONG(x,b) ((x>>(8*_ENDIAN(b)))&0xff) - /*-----------------------------------------------------------------* * void pic16_list_valid_pics(int ncols, int list_alias) @@ -1103,11 +694,14 @@ void pic16_assignConfigWordValue(int address, unsigned int value) (pic16->cwInfo.crInfo[i].mask) & (~value)); #endif +#if 0 if((((pic16->cwInfo.crInfo[i].mask) & (~value))&0xff) != ((~value)&0xff)) { fprintf(stderr, "%s:%d a wrong value has been given for configuration register 0x%x\n", __FILE__, __LINE__, address); return; } +#endif + pic16->cwInfo.crInfo[i].value = value; pic16->cwInfo.crInfo[i].emit = 1; return;