FreeRTOS V10.4 Undefined structs

General discussion on mikroC PRO for ARM.
Post Reply
Author
Message
isra123
Posts: 5
Joined: 29 Dec 2021 08:00

FreeRTOS V10.4 Undefined structs

#1 Post by isra123 » 29 Dec 2021 08:13

Hello
I've tried running FreeRTOS v9 on my dspic33ep using the source files from this library [/https://libstock.mikroe.com/projects/vi ... c-examples] I then preceded to upgrade it to v10 following the example of this page[https://magnolia-tech.jp/post-2994/]. I used the port.c files from v9's folder and replaced everything with the v10's source files downloaded from the official FreeRTOS page[https://www.freertos.org/a00104.html]. when running a simple blinking example I get "130 312 Internal error 'Undefined struct' main.c" and it seems to repeat for some other functions too not just main. Case sensitivity is on in my MikroC. Can someone suggest a solution.
Thank you

sgssn
Posts: 36
Joined: 13 Sep 2021 16:24

Re: FreeRTOS V10.4 Undefined structs

#2 Post by sgssn » 29 Dec 2021 09:10

Hello
seems you crashed your project by merging too much different sources. But i don't know your compiler. But in common:
I would now create a new project, like "hello world" and would try to compile that.
If it works i would insert the not-working code step by step into that "hello world" project.

regards
Gerhard

isra123
Posts: 5
Joined: 29 Dec 2021 08:00

Re: FreeRTOS V10.4 Undefined structs

#3 Post by isra123 » 30 Dec 2021 04:40

I am using dsPIC33EP with MikroProg programmer and MikroC compiler. Here is my main code, I've done what you suggested and created a simple blinking program and it was working, then I added FreeRTOS kernal files and the same error showed up. Unfortunately I cannot upload a zip file of the project but here is my main.c code

[// Includes

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>

#include "FreeRTOSConfig.h"
#include "FreeRTOS.h"
#include "projdefs.h"
#include "list.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "croutine.h"

//#define NULL 0
// Public Function Definitions
void InitMain()
{
/*Configure Oscillator to operate the device at 70Mhz
Fosc= Fin*M/(N1*N2), Fcy=Fosc/2
Fosc= 8M*70/(2*2)=140Mhz for 8M input clock */
/* N1 = PLLPRE + 2
N2 = 2 x (PLLPOST + 1)
M = PLLDIV + 2 */

PLLFBD = 68; /* M=70 The PLL Feedback Divisor (PLLFBD) register , the last bit of it is PLLDIV*/

CLKDIVbits.PLLPOST = 0; /* N2=2 PLL clock dividors */
CLKDIVbits.PLLPRE = 0; /* N1=2 used to scale down the input
clock (FIN) to meet the PFD input frequency range of 0.8 MHz to 8 MHz */

OSCTUN = 0; /* The FRC Oscillator Tuning (OSCTUN) register is used to tune the internal FRC oscillator
frequency in software */

}
// Task 1 - Blinks PORTB LEDs.
void task1(void *pvParameters)
{
// Initialize AN pins as digital.
ANSELB = 0;

// Set PORTB pins as digital output.
TRISB = 0;

LATB = 0xFFFF;

// Blink PORTB LEDs with some delay.
while (1)
{
vTaskDelay(pdMS_TO_TICKS(250));
LATB = ~PORTB;
}
}

// Task 2 - Blinks PORTD LEDs.
void task2(void *pvParameters)
{
// Initialize AN pins as digital.
ANSELD = 0;

// Set PORTD pins as digital output.
TRISD = 0;

LATD = 0xFFFF;

// Blink PORTD LEDs with some delay.
while (1)
{
vTaskDelay(pdMS_TO_TICKS(500));
LATD = ~PORTD;
}
}


// Task 3 - Blinks PORTF LEDs.
void task3(void *pvParameters)
{
// Set PORTF pins as digital output.
TRISF = 0;

LATF = 0xFFFF;

// Blink PORTF LEDs with some delay.
while (1)
{
vTaskDelay(pdMS_TO_TICKS(100));
LATF = ~PORTF;
}
}

// Main function, which creates the tasks and starts the scheduler.
void main()
{ // ERROR: Undefined struct here
InitMain();

xTaskCreate(
(TaskFunction_t)task1,"Task 1",configMINIMAL_STACK_SIZE,NULL,1,NULL );

// Create task 2.
xTaskCreate(
(TaskFunction_t)task2,"Task 2", configMINIMAL_STACK_SIZE,NULL,1,NULL );

// Create task 3.
xTaskCreate(
(TaskFunction_t)task3,"Task 3",configMINIMAL_STACK_SIZE,NULL,1,NULL);

// Start the RTOS scheduler.
vTaskStartScheduler();

// Will never reach here.
while (1);
} // ERROR: Undefined struct here
]

Post Reply

Return to “mikroC PRO for ARM General”