Hi Georg, You forgot the option to modify SDCC so it accepts the __interrupt keyword either before or after the function :)
Maarten > 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