Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


STR912 GCC Tick problem

Posted by bosa on January 31, 2008
I ported FreeRTOS IAR to GCC using Ride.
I can to create a Task for test and run good when I don´t use delay.
So when I use vTaskDelayUntil the scheduler never finish, and the kernel never return to execute the task. In debug mode, I found out the problem occur in WDG_IRQHandler, because in assemble debug the instruction don´t start in begin of the function, but start in the instruction os reset the WDG (WDG->SR &= ~0x0001;) and after execute the vPortEnterCritical and vPortExitCritical and return to WDG Reset, and so on.

My kernel can´t use task delay because this problem.

How to solve this problem?


RE: STR912 GCC Tick problem

Posted by Richard on February 1, 2008
I'm not sure if I understand the description of your problem exactly. I am assuming you are using the watchdog peripheral to generate the tick interrupt. Is this correct?

I've just checked the STR75x RIDE port to see how the interrupt is set up. In this example the file crt0_STR75x_FreeRTOS.s has been updated to place the vPortTickISR handler on the TB peripheral (would be the watchdog peripheral in your case). Also the IRQ handler itself is written as:


portSAVE_CONTEXT/*; Save the context of the current task. */

LDR r0, =EIC_base_addr
LDR r1, =IVR_off_addr
LDR lr, =ReturnAddress /*; Load the return address. */
ADD pc,r0,r1/*; Branch to the IRQ handler. */
LDR r0, =EIC_base_addr
LDR r2, [r0, #CICR_off_addr]/*; Get the IRQ channel number. */
MOV r3,#1
MOV r3,r3,LSL r2
STR r3,[r0, #IPR_off_addr]/*; Clear the corresponding IPR bit. */

portRESTORE_CONTEXT/*; Restore the context of the selected task. */

to ensure the context is saved prior to the branch to vPortTickISR.

This is just one method of doing this, whereby the context is saved and restored by a single IRQ handler before jumping to the peripheral handler. Other examples jump directly to the peripheral handler where the handler can decide if it needs to save and restore the context of not.

vPortTickISR is defined within portISR.c, which must be compiled into ARM mode.

How have you setup your interrupt?


RE: STR912 GCC Tick problem

Posted by Ben on February 1, 2008
I have got a GCC port working for the STR9, although at the moment it is only running 1 task with a vTaskDelayUntil to flash an LED. I based it on a STR75c GCC port.

I have it configured to use any one of the 4 timers, I wanted to keep the watchdog timer free in case I needed to use it as a watchdog.

I am using it with Eclipse, but you are welcome to a copy if it will help you.


RE: STR912 GCC Tick problem

Posted by bosa on February 1, 2008
Hi, my interrupt was setuped using same as port ARM9 IAR.
I use the file boot.s that I got in site st.com in example an2551.

My IRQ handler itself is written as:
LDR r0, [r0]
LDR r1, [r1]
MOV lr, pc
BX r0
STR r0, [r0]
STR r1, [r1]

And the SWIHandler itself is written as:
LDR R0, =vTaskSwitchContext
MOV lr, pc

The instructions in portmacro.h , the portDISABLE_INTERRUPTS() and portENABLE_INTERRUPTS() are the same the port ARM7_STR75x_GCC.

And I didn´t use the portISR.c, because I do everything in the port.c. Maybe here is my problem.

Ben, could you send your port for my email?


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner