Guest User

Untitled

a guest
Dec 23rd, 2019
118
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .thumb_func
  2.  
  3. .type CoOS_InitMainStack,%function
  4.  
  5. CoOS_InitMainStack:
  6.  
  7. //Reset MSP to init
  8.  
  9. ldr r0, =0xE000ED08 //r0 = VTOR Use the VTOR offset register to locate the stack.
  10.  
  11. ldr r0, [r0] //r0 = *VTOR
  12.  
  13. ldr r0, [r0] //r0 = *(e_stack) (stack init)
  14.  
  15. sub r0, #32 //r0 = r0 - 32
  16.  
  17. msr msp, r0 //MSP = r0
  18.  
  19. ldr r1, =_ZN4CoOS16InterruptHandlerEv //r1 = &CoOS::ThreadStart
  20.  
  21. add r1, #2
  22.  
  23. str r1, [r0, #0x14] // MSP.LR = &CoOS::ThreadStart
  24.  
  25. str r1, [r0, #0x18] // MSP.Return Addr = &CoOS::ThreadStart
  26.  
  27. bx lr
RAW Paste Data