I’ve looked through the last 4 years of postings on the keywords Autovector and NOIV. After studying that I’m still having problems getting Autovectoring to work for EZ-USB.


My project has two source files VECTOR.ASM and MAIN.C. At the very beginning of MAIN.C I have inserted “#pragma noiv” and all of my interrupt handlers do not specify an interrupt number.


VECTOR.ASM begins with “.area VECTOR” which contains the reset vector and interrupt vector jumps. It is followed by “.area USBJMP” which contains the additional interrupt jump table for Autovectoring of INT2 (USBINT).


In the LNK file I have “-b VECTOR=0x0000”, “-b USBJMP=0x0100”, and “-b CSEG=0x0200”. I went with this approach because I could not find a way to force the vector table to be inserted at the beginning of CSEG.  All of these areas are REL,CON and the resulting .HEX file looks ok.


My immediate problem is that _sdcc_gsinit_startup is unresolved. This startup code seems to be generated by the compiler since I don’t see it in libsdcc.lib. Is there a way to set the reset vector to call this function? Or do I have to write my own reset handler?


Another question is whether I am missing something that would make my life easier? From the .PDF documentation, for pragma noiv, it says:


“This is useful in cases where the interrupt vector table must be defined manually, or when there is a secondary,

manually defined interrupt vector table (e.g. for the autovector feature of the Cypress EZ-USB FX2). More

elegantly this can be achieved by obmitting the optional interrupt number after the interrupt keyword …”


This hints that EZ-USB autovectoring can be achieved without using an assembler module. If so, how?


Finally, using my current approach I see rather large offsets for CSEG functions in the MAIN.RST file (e.g. _sdcc_program_startup is at 0x1035) while the offsets for all global symbols in VECTOR.RST are as expected.

This seems inconsistent with the amount of code in MAIN.C. What would make these offsets so large?