This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Question on porting UCOS on MSP430F149

Hi, Champs,

A customer needs to port UCOS on MSP430F419.

After migration and configuration, it passed both compile and link.

But when the software run to  popall, IAR report a error as below:

 The stack pointer for stack 'Stack' (currently Memory:0x3CA) is outside the stack range (Memory:0x8D4 to Memory:0xA00) 

We try to enlarge the stack size, but the stack pointer run too far away.

So do you have any comments or suggestions?

Regards,

Hardy

  •             RSEG ISR_CODE   ;CSTART   ;CODE                    ; Program code
    
    OSStartHighRdy
    ;           calla     #OSTaskSwHook
    
                mov.b    #1, &OSRunning         ; kernel running
    
                mov.w    SP, &OSISRStkPtr       ; save interrupt stack
    
                mov.w    &OSTCBHighRdy, R13     ; load highest ready task stack
                mov.w    @R13, SP
    
                POPALL                          ; pop all registers
    
                reti                            ; emulate return from interrupt

    try that

  • i tried,but IAR report a error as below:   Error[40]: Bad instruction E:\430\project for 430\uCOSII-149\Os_cpu_a.s43 90
                                                                           Error while running Assembler

  • Most OD which support multiple threads will provide independent stacks for each thread. The IAR stack warning applies to the original (main) stack only. If the stack pointer is switched to a different stack, this is of course outside the expected stack range for main(). The debugger cannot possibly know that the application is moving the stack pointer to a different 'stack area', far away from where it is expected to be.
    There is no 'stack object' with start address and size. Just one pointer that points to where the next stack write/read has to happen. The start is assumed to be where the linker has put it, and if the current value is further away from this start (usually the end of ram) than the defined stack size, you'll get the warning. Even if the end of ram is no longer the (OS defined) start of the stack.

  •   thanks for your answer.And how do i slove this problem?

  • borui xiao said:
      thanks for your answer.And how do i slove this problem?

    Not solve (there is no solution), but ignore it. At the risk of missing a real stack overflow.

    The debugger stack warning is designed to warn if the stack pointer moves too far from the initial stack. Since the OS intentionally moves the stack pointer, this will trigger the warning. Unless you can disable the stack warning in the debugger (no idea whether this can be done), you'll get it and have to ignore it (unless you encounter problems that could be caused by a stack overflow - then debugging gets nasty)

**Attention** This is a public forum