hello all,
as mentioned elsewhere I am trying to port the STM8-SPL library by STM to SDCC.
Currently I got stuck at a seemingly simple problem. Here’s the technical
background:
1) my target is to modify only the common headers, not the project specific
header
2) all other supported compilers (Cosmic, IAR, Resonance) declare interrupt
routines with the keyword BEFORE the function, e.g. “__interrupt void
ISR(void);"
3) SDCC requires the interrupt keyword AFTER the function name, e.g. “void
ISR(void) __interrupt;”
The SPL library has a common header (-> can be modified) named “stm8s.h”,
which defines a (compiler dependent) macro like
#define INTERRUPT __interrupt
The compiler independent headers for interrupt service routines (-> should not
be modified) uses this define like
INTERRUPT void TIM1_ISR(void);
and this works fine for all supported compilers. But how can I modify the
#define in stm8s.h for SDCC??? So far I tried (and failed with) the following
ideas, sorted by my order of preference:
1) move the keyword to after the function. Unfortunately the original macro
(and hence the project files) doesn’t use brackets like “#define
INTERRUPT(name) __interrupt void name(void);”
2) skip the declaration by a “comment macro” like “#define INTERRUPT /##/”. In
this case the declaration would be skipped, but since an ISR is not actively
called, I figure that would be ok. But apparently this doesn’t work for
gcc/sdcc preprocessor. For reasons e.g. see
http://stackoverflow.com/questions/15545520/how-to-create-a-c-single-line-comment-macro
<http://stackoverflow.com/questions/15545520/how-to-create-a-c-single-line-comment-macro>
3) prompt a warning but compile like ”#define INTERRUPT #warning xxx”. In this
case at least the user could be notified what to change in the respective
project headers. But apparently macros cannot contain preprocessor commands
Now I ran out of ideas of how to solve this issue (without the user fixing
every declaration manually)… But maybe one of you guys has an idea I didn’t
think of!? For any advice on this thanks a lot in advance!!!
Regards,
Georg
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user