How to create stack underflow exception ?

Status
Not open for further replies.

jani12

Advanced Member level 4
Joined
Oct 30, 2014
Messages
108
Helped
0
Reputation
0
Reaction score
1
Trophy points
1,298
Activity points
2,536
I'm programming Infineon TC29x Aurix Tricore Microcontroller based embedded system in 'C' language.

Consider stack starting at address 0x5000 0000. The stack size is 0x1000.

If I add 0x1000 to current stack pointer(Register A10) and store result in A10, then I should get underflow error.

What might be the code in assembly to change stack pointer? something like following:

stw a10, 0x1000(a10) # I'm not sure if stw is correct opcode ?

what are other options to create stack undeflow exception?
 

Hi,

Simply POP some bytes from stack...without PUSHing them onto stack first.

Klaus
 
Reactions: jani12

    jani12

    Points: 2
    Helpful Answer Positive Rating
Please provide assembly language code to achieve popping from stack.

Our code is written in embedded 'C'. Do I need to do anything special to add assembly langauge, like asm keyword or disable and enable interrupts, etc.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…