This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32 RTX Startupfile

Hello,

I am new to STM32 and RTX, and i am following the example:
Modify the device startup file to enable SWI_Handler function:
Comment out the following line from the startup file:
SWI_Handler B SWI_Handler

Add the following line to the startup file:
IMPORT SWI_Handler

But this line is not present in the startup file STM32F10x.s

What do i need to do?

Kasper

  • STM32 is a Cortex-M3 device with completely different exception handling (SWI is replaced with SVC, ...).

    You don't need to modify STM32F10x.s. It works by default with RTX.

    Take a look at the RTX examples in the RealView MDK installation. Folder Keil\ARM\Boards\Keil\MCBSTM32, examples RTX_Blinky, RTX_Traffic.

  • Hello,

    Thank you for your answer.

    I was trying this example from the documentation:

    OS_TID tsk_1, tsk2_1, tsk2_2, tsk2_3;
    int cnt;

    void task2 (void) __task { os_dly_wait (2); cnt++;
    }

    void task1 (void) __task { /* This task will create 3 instances of task2 */ tsk2_1 = os_tsk_create (task2, 0); tsk2_2 = os_tsk_create (task2, 0); tsk2_3 = os_tsk_create (task2, 0); /* The job is done, delete 'task1' */ os_tsk_delete_self ();
    }

    int main (void) {

    os_sys_init(task1); for (;;);
    }

    But when i in the simulator put a breakpoint on this line: cnt++; and runt the program, it breaks first time, but not again and it says that this task is overflow...

    it seems like the processor comes to HardFault_Handler\

    what do i do wrong?

    Kasper aka neewbie

  • please use the 'pre' and '/pre' qualifiers to post code.
    I sounds like your task has too little stack space.

  • Hello Reppy Repzak,

    A task needs always an endless loop. Without it get started and finishes at once. Create your task2 like:

    void task2 (void) __task {
      while (1) {           /* endless loop               */
        cnt++     ;         /* increment counter          */
        os_dly_wait (10);   /* wait for timeout: 10 ticks */
      }
    }
    

    Best Regards,
    Martin Guenther

  • Thanks...

    I acutallu have readed that, strange they do not include in their examples.. maybe to keep them simple

    Kasper