MikroC + STM32F4Discovery + FreeRTOS

General discussion on mikroC PRO for ARM.
Post Reply
Author
Message
aussa
Posts: 1
Joined: 28 Feb 2013 22:36

MikroC + STM32F4Discovery + FreeRTOS

#1 Post by aussa » 28 Feb 2013 22:55

Hi, I'm trying to port to MikroC this --> http://fbconsult.dk/DiscoveryF4_RTOS.zip example of FreeRTOS on STM32F4Discovery with CrossWorks compiler.
I tried the example on TrueStudio and it worked.

This was the result of modifying the main file to MikroC

Code: Select all

#include "stm32f4xx.h"
#include "FreeRTOS.h"
#include "task.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

static void TaskA(void *pvParameters)
{
  int A=0;

  pvParameters = pvParameters;
  for(;;)
  {
    A++;
    GPIOD_ODR = 0x00002000;
    vTaskDelay(500);
    GPIOD_ODR = 0x00000000;
    vTaskDelay(500);
  }
}

static void TaskB(void *pvParameters)
{
  int A=0;

  pvParameters = pvParameters;
  for(;;)
  {
    A++;
    GPIOD_ODR = 0x00001000;
    vTaskDelay(200);
    GPIOD_ODR = 0x00000000;
    vTaskDelay(200);
  }
}

static void TaskC(void *pvParameters)
{
  int A=0;

  pvParameters = pvParameters;
  for(;;)
  {
    A++;
    GPIOD_ODR = 0x00004000;
    vTaskDelay(700);
    GPIOD_ODR = 0x00000000;
    vTaskDelay(700);
  }
}

static void TaskD(void *pvParameters)
{
  int A=0;

  pvParameters = pvParameters;
  for(;;)
  {
    A++;
    GPIOD_ODR = 0x00008000;
    vTaskDelay(1000);
    GPIOD_ODR = 0x00000000;
    vTaskDelay(1000);
  }
}

void initx(void)
{
     RCC_AHB1ENRbits.GPIODEN = 1;
     GPIO_Config(&GPIOD_BASE,
                             _GPIO_PINMASK_12 | _GPIO_PINMASK_13 | _GPIO_PINMASK_14 | _GPIO_PINMASK_15,
                             _GPIO_CFG_MODE_OUTPUT | _GPIO_CFG_OTYPE_PP | _GPIO_CFG_SPEED_100MHZ | _GPIO_CFG_PULL_NO
                             );
}

void main() 
{
  initx();

  xTaskCreate(TaskA, (signed char*)"TaskA", 128, NULL, tskIDLE_PRIORITY+1, NULL);
  xTaskCreate(TaskB, (signed char*)"TaskB", 128, NULL, tskIDLE_PRIORITY+1, NULL);
  xTaskCreate(TaskC, (signed char*)"TaskC", 128, NULL, tskIDLE_PRIORITY+1, NULL);
  xTaskCreate(TaskD, (signed char*)"TaskD", 128, NULL, tskIDLE_PRIORITY+1, NULL);
  vTaskStartScheduler();
}
The problem is that when I compile, I'm getting a lot of these errors:

Code: Select all

Members cannot have memory specifier | core_cm4.h
Which refers to lines like this one:

Code: Select all

  __I  uint32_t CPUID;                   /*!< Offset: 0x000 (R/ )  CPUID Base Register                                   */
inside the core_cm4.h file.

I looked for a solution online without any good results. I will appreciate a lot any advice or idea to solve this.

Thank you.

t@rek88
Posts: 24
Joined: 08 Mar 2013 22:44
Location: Kelibia, Tunisia
Contact:

Re: MikroC + STM32F4Discovery + FreeRTOS

#2 Post by t@rek88 » 18 Apr 2013 15:25

Hi,

That seems important but, you need to adapt your code to the MikroC compiller,

you don't need to include "stm32f4xx.h", math, stdio and stdlib because that code was designed for gcc compiller
Bouchkati Tarek
Tunisia
::::::::::::::::::::::::::::::::::::::::::::::::
Electronics & Embedded system engineering

p77
Posts: 10
Joined: 03 Nov 2016 16:33

Re: MikroC + STM32F4Discovery + FreeRTOS

#3 Post by p77 » 17 Jun 2023 08:09

DOES MIKROE SUPPORT TEAM EVER FINISHES ANY ISSUES AND PROBLEMS POSTED BY MEMBERS AND BUYERS?????

WHY YOUR ANSWERS ARE ALWAYS INCONCLUSIVE, NEVER TO THE POINT, AND MAYBE SOLVES SOME ISSUES IN 1-2% OF THE CASES

CAN WE PLEASE GET ADVICE ON THE TOPIC IN FOLLOWING FORM:

__I uint32_t CPUID; - THIS LINE IS BAD, CHANGE IT TO:
dont_32_know_16_what)to_put_here CPUID;

PLEASEEEEE

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: MikroC + STM32F4Discovery + FreeRTOS

#4 Post by filip » 21 Jun 2023 08:21

Hi,

The line of code that you are referring to won't work as the _I is not recognized by the compiler.

Can you please attach minimal project that you are having trouble with ?

Regards,
Filip.

Post Reply

Return to “mikroC PRO for ARM General”