Quantcast
Channel: Infineon Forums
Viewing all articles
Browse latest Browse all 9892

Default IRQ

$
0
0
Quote:

Originally Posted by Mike_FN View Post
Hi, I have now gotten this completely working in my project and its brilliant!
I thought about the __vector_table and fill but wouldn't have had time for the asm. This should really be the default, as for XC processors. Especially since the previous default setup fills gaps and unused vectors in the vector table with random stuff, which could then get executed due to miss config.

Just one question is there a cunning way to use a #define inside the _Pragma("") for the number. Since the vector number is used three times and needs to be unique it would be cleaner. E.g. _Pragma("alias _vector_" ##MY_FUNC_PRIORITY "=my_func") ?
Many thanks

Hi Mike,

Good to hear you got it to work!

Your second question should be solved using this construct:

Code:

   
    #define STRING(n) #n
    #define STRING_ID(n) STRING(n)

    _Pragma("alias _vector_" STRING_ID(0) "=default_handler");
    _Pragma("alias _vector_" STRING_ID(1) "=regular_handler");

However, it appears to trip the parser, resulting in this error message:

_Pragma argument should be a single string literal

Somehow the parser doesn't work out that it must concatenated the three strings, like it will for a normal C function call:

Code:

printf("alias _vector_" STRING_ID(0) "=default_handler");
It's something I need to pick up with development, as well as your preference to replace the current vector table implementation with the more versatile one that we've been discussing here.

Dealing with the above restriction might be a bit of a challenge. The assembler supports a string operator that, when used in an assembler macro, can turn its argument into a string. So that might do just what you want. However you'd need to think about either using it in a separate assembly module or use __asm to both create and call the macro from C. For the latter I recall having done that a long long time ago. It did eventually work, but it was a bit of a struggle.

Best regards,

Henk-Piet Glas
Technical Product Specialist

Viewing all articles
Browse latest Browse all 9892

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>