This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

#pragma iv

Hello:

I have a project where I use #pragma iv(0x600), with Silabs processor 8051F385.
This processor indicates that interrupt 8 at 0x43 is "special" and when generating HEX file, the address is still at 43h. Why the compiler #pragma won't translate it to 643h?
Thanks !

Parents
  • The thing is that the compiler just doesn't modify the vector to point to this ISR !

    How could it? Nobody passed your choice of compiler flags to their run of the compiler. And unless you get into contact with them and convince them to build your a specialized copy (or give you source code), nobody ever will.

    There's actually no way you can use that option on pre-compiled third-party code. You'll have to make your own vector table entry and then call their interrupt handler. There will be two tricky parts about this:
    1) finding that actual interrupt handler function (the C function their vector table entry points at)
    2) avoiding the disruption their interrupt vector table entry would generate in your program, if it were included.

    On a related note, I really don't believe that IntVector(offset) is a C51 option which one should ever set by #pragma. This is an option that has to be applied uniformly across the entire program, so it really should be set at the top-most level of the build system. Sticking it as a #pragma into some header risks that some modules will not get the news, and thus become incompatible with the rest. Hiding that #pragma in individual .c files would practically guarantee that kind of failure.

Reply
  • The thing is that the compiler just doesn't modify the vector to point to this ISR !

    How could it? Nobody passed your choice of compiler flags to their run of the compiler. And unless you get into contact with them and convince them to build your a specialized copy (or give you source code), nobody ever will.

    There's actually no way you can use that option on pre-compiled third-party code. You'll have to make your own vector table entry and then call their interrupt handler. There will be two tricky parts about this:
    1) finding that actual interrupt handler function (the C function their vector table entry points at)
    2) avoiding the disruption their interrupt vector table entry would generate in your program, if it were included.

    On a related note, I really don't believe that IntVector(offset) is a C51 option which one should ever set by #pragma. This is an option that has to be applied uniformly across the entire program, so it really should be set at the top-most level of the build system. Sticking it as a #pragma into some header risks that some modules will not get the news, and thus become incompatible with the rest. Hiding that #pragma in individual .c files would practically guarantee that kind of failure.

Children
No data