Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

New to RTOS need help (STM32)

Posted by Jacek Kedzior on June 3, 2008
Hello

I have been playing with microprocessor programming for a while and now i am starting to dive into RTOS world. I succesfully ran demo application for ST Primer. Now i would like to create a simples application (1 task) that would toggle a specified PIN on and off on my prototype board (which is tested and works with other code). I have a STM32F101C6T6 processor. I tried to run this code, but it doesn't work.

int main( void )
{

prvSetupHardware();

/* Start the tasks defined within this file/specific to this demo. */
xTaskCreate( prvTestTask, ( signed portCHAR * ) "Test", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );

/* Start the scheduler. */
vTaskStartScheduler();

/* Will only get here if there was not enough heap space to create the
idle task. */
return 0;
}


void prvTestTask( void *pvParameters )
{
portTickType xLastWakeTime;
const portTickType xFrequency = 1;
// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount();
for( ;; )
{
ToggleLed();
vTaskDelayUntil( &xLastWakeTime, xFrequency );
}
}

void ToggleLed(void){
if(GPIO_ReadOutputDataBit(GPIOB, GPIO_Pin_12)==0){
GPIO_SetBits(GPIOB, GPIO_Pin_12);
}
else{
GPIO_ResetBits(GPIOB, GPIO_Pin_12);
}
}

When i run ToggleLed in infinite loop in main (not launch kernel) it seems to work. Any help will be appreciated. One information that may be useful. When i run application and pause it it shows 0x0 address as PC and executes CMP R0, #0x0. I am not an assembler guy (i have some basics, but i always used C as lowest level programming language). IF anyone could provide simplest "toggle the ping" example of task which works on this processor i will be really grateful.

Regards
Jacek

RE: New to RTOS need help (STM32)

Posted by Richard on June 5, 2008
How did you create the project. Was it based on your existing and working primer project, or was it created from scratch? Maybe there is a compiler option problem, there is nothing obviously wrong in your code.

Regards.

RE: New to RTOS need help (STM32)

Posted by Jacek Kedzior on June 5, 2008
Hello

Thank you for reply. By trial and error i noticed that in order to run freeRTOS on Cortex M3 you need to include in the project crt0_STM32x.c which does some things with interrupt vectors etc. Without it scheduling task doesn't work (probably rtos cannot manage interrupts). Now , when i just added this file to my project it works and "hello world" - blinking led is now making me really happy :)


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists