Hi Bruce,
I have an isr on timer1 that gives me a "data abort" message. I looked at the
asm listing and it is breaking in the while loop in the wait function. I guess
I wrongly assumed that the registers, pc, etc would be automatically pushed onto
the stack. So my question is: how do I save (push) the machine state before my
code in my isr and then pop it back when my isr is done?
I tried saving reg1 and reg2 before my isr code and then restoring them back,
but it still does not work. Thanks in advance for your help.
RB
ARM7 ISR
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: ARM7 ISR
> I have an isr on timer1 that gives me a "data abort" message. I looked at the
asm listing and it is breaking in the while loop in the wait function. I guess
I wrongly assumed that the registers, pc, etc would be automatically pushed onto
the stack. So my question is: how do I save (push) the machine state before my
code in my isr and then pop it back when my isr is done?
>
> I tried saving reg1 and reg2 before my isr code and then restoring them back,
but it still does not work. Thanks in advance for your help.
did you declare your C function as an interrupt??
__attribute__ ((interrupt)) void PWM_ISR(void)
sample in the files section
or our C source is available for purchase
Normally the compiler is pretty good about figuring out what registers need to
be saved. It WILL not know about inline assembly language you use, so if there
are registers altered that way, you need to manually save them.
asm listing and it is breaking in the while loop in the wait function. I guess
I wrongly assumed that the registers, pc, etc would be automatically pushed onto
the stack. So my question is: how do I save (push) the machine state before my
code in my isr and then pop it back when my isr is done?
>
> I tried saving reg1 and reg2 before my isr code and then restoring them back,
but it still does not work. Thanks in advance for your help.
did you declare your C function as an interrupt??
__attribute__ ((interrupt)) void PWM_ISR(void)
sample in the files section
or our C source is available for purchase
Normally the compiler is pretty good about figuring out what registers need to
be saved. It WILL not know about inline assembly language you use, so if there
are registers altered that way, you need to manually save them.
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: ARM7 ISR
Hi Bruce,
Thanks for the response.
1) Yes, my C function is declared as an interrupt, i.e.:
"__attribute__ ((interrupt)) void MS_ISR(void)".
2) Yes, I have already purchased the "C" source.
3) No, I don't have any in-line assembly.
One thing to note, my isr function is in the same file as all of my other
functions including main. Is this a problem? I don't think it would be because
I moved my isr function to it's own file with "ISR" in upper case in the file
name and included it in my main file and it still did the same thing. What am I
missing? Thanks for your help in advance!
RB
Thanks for the response.
1) Yes, my C function is declared as an interrupt, i.e.:
"__attribute__ ((interrupt)) void MS_ISR(void)".
2) Yes, I have already purchased the "C" source.
3) No, I don't have any in-line assembly.
One thing to note, my isr function is in the same file as all of my other
functions including main. Is this a problem? I don't think it would be because
I moved my isr function to it's own file with "ISR" in upper case in the file
name and included it in my main file and it still did the same thing. What am I
missing? Thanks for your help in advance!
RB
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: ARM7 ISR
Hi Bruce,
Nevermind, I figured it out. I put the function in a separate file and made
sure that the suffixes were both lower case "h" and "c" and it works. Thanks
for all your help.
RB
Nevermind, I figured it out. I put the function in a separate file and made
sure that the suffixes were both lower case "h" and "c" and it works. Thanks
for all your help.
RB
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: ARM7 ISR
> Nevermind, I figured it out. I put the function in a separate file and made
sure that the suffixes were both lower case "h" and "c" and it works. Thanks
for all your help.
Someone else mentioned that .C pulls in the C++ compiler, I don't know if that's
a fact or not.
We found at one point we had to turn off optimization for ISR files, which we do
for any file that has ISR (capital letters) in the name. Whether that's still
true, I don't know.
We use gcc extensively, but we did not write, nor have we modified it.
Now that we are supporting sketches, MakeItC looks for cpp files and will use g++ for those
sure that the suffixes were both lower case "h" and "c" and it works. Thanks
for all your help.
Someone else mentioned that .C pulls in the C++ compiler, I don't know if that's
a fact or not.
We found at one point we had to turn off optimization for ISR files, which we do
for any file that has ISR (capital letters) in the name. Whether that's still
true, I don't know.
We use gcc extensively, but we did not write, nor have we modified it.
Now that we are supporting sketches, MakeItC looks for cpp files and will use g++ for those