We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi everybody,
I actually work on a LPC2103, and I have a problem with a inline assembler.
In fact, I want to modify the Link Register R14, at the end of an interruption, in order to return in Main Programm at an other location.
But when I compile my programm, the compiler print this error:" error #20: identifier "R14" is undifined.
The problem is that I don't know how you can declare this kind of register.
thank in advance
Chris
I'm afraid that you cannot be helped here without referring you to the manual first.
Recent feedback has determined that this is not acceptable. Sorry about that.
http://www.keil.com/forum/docs/thread10151.asp
First, read the topic "ARMCC Virtual registers" in the RealView Compiler's User Guide. This will explain that is not possible to do what you are trying to with in-line assembly.
You will have to do this in normal assembly code.
I'm assuming that you know exactly what you are doing here, that you have no alternatives, that you are very familiar with the LPC2103, that you are proficient with ARM assembly programming and that you know the ARM AAPCS and ABI inside out.
Otherwise you are best advised to try something else unless it is a trivial application.
If you didn't think of any pitfalls of doing this in a C function then maybe you should look again for an alternative.
That said, this is how a task scheduler in an ARM OS might work so it might be the right approach for your problem. You didn't provide any details on that.
"I'm assuming that you know exactly what you are doing here..."
Hmmm... not sure that I'd assume that from the original question...
;-)
Thanks for your answers!!!
My application seems to be simple. Indeed when an EINT2 interrupt occurs on the lpc2103, at any moment, I have to start again my Main from the beginning.
For the moment, my interruption works correctly, but at the end of the interruption, I didn't manage to branch it at the beginning address of my Main.
But it seems to be hard to do it in assembler, so, if you could advise me another solution in order to do it in standard C.
Because I already try with these functions,SETJMP()and LONGJMP(), and my interruption wasn't re-armed.
thank in advance.
"I have to start again my Main from the beginning"
Why do you have to do that? Are you trying to perform some sort of software reset?
It would probably be best if you explained what you're actually trying to achieve here - what is the requirement?
Otherwise, we may just be discussing a fundamentally broken approach...
Ok sorry I resume from the beginning.
My project consists of the development of an embedded software for a test device, which will be manage by the LPC2103.
The aim of this software is to get back some informations through the serial link (UART1). The beginning of the communication is controlled by the EINT2 interruption which is controlled by button. Informations are read on the serial link, and then printed on the test device.
However it's possible that the user don't need all informations and decide to push the button to have new informations.
So it's necessary that my software can be able to go back to the beginning of the communication, in order to begin a new one.
To make that, EINT2 interrupt have to be able to be branch to another address in my software.
It isn't a software reset because the test device doesn't have to resume all from the beginning, but only the communication.
As I already said, I want to know if it's possible doing that with inline assembler, embedded assembler or better if a funtion in C exists (I already try setjmp() and longjmp()).
thank in advence
That's not a strict necessity in your case. Manually messing with the return address should only be considered in very special cases (e.g. you are writing an operating system). This is because in such a case, many more things need to be taken care of than just changing the return address. An interrupt can occur at almost any point in your program - how is the interrupt service routine supposed to know how much stack/etc is being used at the moment ?
In your case, it should be enough to have set/reset a flag in the interrupt service routine which is then evaluated by the regular program. Depending on the status of the flag, the program will either continue its output or start outputting a different set of data.