I tried the example on TrueStudio and it worked. This was the result of modifying the main file to MikroC
#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:
Members cannot have memory specifier | core_cm4.h
Which refers to lines like this one:
__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.