This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

declaration link register R14

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

Parents
  • 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.

Reply
  • 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.

Children
  • "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

    Chris

  • To make that, EINT2 interrupt have to be able to be branch to another address in my software.

    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.