ampage
Tube Amps / Music Electronics
For current discussions, please visit Music Electronics Forum.

ampage archive

Vintage threads from the first ten years

Search for:  Mode:  

 

previous: steve conner Yep I have the "G21" C compiler (ba... -- 7/18/2003 9:57 AM view thread

Re: not DSP chip but machine code is...

7/18/2003 7:45 PM
KursadRe: not DSP chip but machine code is...
[QUOTE]But I have a problem with the big context switching overhead. When I go into the assembler routine all the registers that the C compiler might be using need to be saved onto the stack and restored afterwards. That's pretty much _all_ the registers on the chip, and I might be context switching like 400 times a second :(  
[/QUOTE]  
 
Perhaps instead of a continously running C code, a timer interrupt triggered C routine could solve that problem because instead of interrupting the C code you would be interrupting a loop that actually does nothing, to do:  
 
1) the things that you do in assembly  
2) the things that you do in C  
 
and the main thread would be doing nothing and be using no registers and therefore during context switching you dont need to save registers, assuming that one interrupt cannot break the execution of another (I dont know. Can it?).  
 
If things to be done in C does not need to be done frequently and does not take much time either context switching between the main thread and C routine wouldn't be a problem even though it needed to save all registers, and actually it should not, because the only thread that would be continiously running would be just looping without doing anything.  
 
I dont know if that makes sense because I actually dont know much (or anything) about what you are doing or the hardware you are using. and of course use of the word 'thread' is probably incorrect but I hope at least the meaning is not. To me it sounds like it can work if one interrupt cannot 'interrupt' another interrupt. Probably these things have priority levels to let the harware decide which interrupt can break the execution of another and if the C routine cannot be interrupted by the interrupt running the assembly routines, well maybe, it might work. (Or perhaps I dont know anything about embeded systems and all that sounded crappy... )  
 
Kursad

 
Replies:
stephen conner [QUOTE]To me it sounds like it can ... -- 7/19/2003 5:38 PM