No PUSH or POP assembler e200z4d PPC instructions :(

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

No PUSH or POP assembler e200z4d PPC instructions :(

Jump to solution
1,038 Views
peteradamcik
Contributor III

Hi Guys, just started PPC assembler programming and I wrote a subroutine that jumps to another subroutine which YES jumps to another subroutine using the BL (branch and link) instruction. I assumed it automatically saves the link return address on to the stack and on every BLR it grabs the last return address from the stack and returns program execution to that address. Well guess what? LOL. It doesn't.... so it looks like I have to manually write the return address to a user stack. This is just like the MIPS CPU, no PUSH or POP instructions. Yet the Texas Instruments F28377D DOES have PUSH and POP. 

Ok, is there a special way ( in assembler ) to write to the system stack or do I have to manually create a user stack in internal SRAM and use that?

Any help or assembler snippets would be greatly appreciated.

Thanks guys, hope to hear from you soon. Pete

0 Kudos
1 Solution
1,030 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, assembler does not have PUSH/POP istructions, because PowerArch does not exclicitly define stack. r1 is defined as stack pointer by EABI but it is only convention.

Stack frame is needed to create manually, as it is for istance in the IntcInterrupts.c file if nesting is used.

View solution in original post

0 Kudos
2 Replies
1,031 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, assembler does not have PUSH/POP istructions, because PowerArch does not exclicitly define stack. r1 is defined as stack pointer by EABI but it is only convention.

Stack frame is needed to create manually, as it is for istance in the IntcInterrupts.c file if nesting is used.

0 Kudos
1,023 Views
peteradamcik
Contributor III

Hi David, thanks for that muchly appreciated. All I need to do is save the LR to a user stack in user allocated ram space and increment or decrement the pointer to simulate PUSH and POP. 

All good, thanks for that.

Peter

 

0 Kudos