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

startup edit in lpc2138

hai all,

I m doing rtos programming which is based on osek standard for LPC2138.
In that i need to enter the supervisor mode for running the tasks & all my code must runs under svc mode. but main prog is running in user mode if i use the startup.s in the keil.
so i had changed the startup.s to run the main in svc mode by commenting the usermode stack initialization. Now it is running under SVC mode. but the problem is when i enter into IRQ mode i call some user functions through asm & changing the mode into SVC to save task stack back into IRQ mode , at that time the global variables are changed.Pls give some tech ass regarding this issue.(I need the global variables won't change )

Thanks in advance,

yos

Parents
  • you will need to write a little assembly to switch from IRQ to SVC, manipulating the CPSR register. Check you processor manual to see where the processor mode bits are. Ho, and it is not likely to work as inline assembly. use embedded assembly instead, like this:

    void __asm irq_to_svc(void)
    {
       // assembly code goes here
    .
    .
    .
       BX LR
    }
    

Reply
  • you will need to write a little assembly to switch from IRQ to SVC, manipulating the CPSR register. Check you processor manual to see where the processor mode bits are. Ho, and it is not likely to work as inline assembly. use embedded assembly instead, like this:

    void __asm irq_to_svc(void)
    {
       // assembly code goes here
    .
    .
    .
       BX LR
    }
    

Children