albin
albin

Reputation: 783

MSP430 execution banks

I am new to MSP430 architecture and I am porting an RTOS which is written for ARM Cortex M3 into this architecure. In ARM Cortex architecture, there are PSP and MSP registers to hold stack values for execution modes.

As I understand from MSP430 architecture there is only just one stack pointer register (SP).

Here are my questions:

-Is there only one register bank for SP within interrupt/execution context?

-Can I use regular C functions for interrupt handling in MSP430 as in ARM Cortex?

-How does MSP430 handle (save/restore) registers during interrupt execution (specifically SP, SR and PC)?

Upvotes: 0

Views: 430

Answers (1)

Ruslan Gerasimov
Ruslan Gerasimov

Reputation: 1782

  1. There are no banks in terms of MSP430 registers, it is the only one SP register within context. enter image description here

  2. Yes, you can use C functions for interrupt handling link

__interrupt void MyFuncISR(void)

or it also can be like

#pragma vector=TIMER0_A0_VECTOR    
__interrupt void
ta0cc0_isr (void)

in this case compiler will set the proper interrupt vector by the define/name you provide

3. The interrupt logic executes the following: 1. Any currently executing instruction is completed. 2. The PC, which points to the next instruction, is pushed onto the stack. 3. The SR is pushed onto the stack and so on, see below: enter image description here

Upvotes: 1

Related Questions