FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [October 2008 Threads] Newbie completely lostPosted by Grant Brown on October 21, 2008 Hi List,
Device / Port : PIC32
My project is copied below for reference.
It got the PIC32 demo running OK but now I have the following problems.
1) - I tried to slim down the project by deleting all of the demo tasks and demo files from the project and now the compiler fails to compile the project copied below.
2) - When I did have the project compiling but with the demo "Main" function commented out and running my own "Main" function I had the following problems.
My task got created - this was confirmed by checking that the return value was pdPASS
However the scheduler did not start. This was confirmed by RD2 started flashing - see code below.
So my questions are,
(a) - What are the minimal files required to compile a PIC32 project with the RTOS and a minimal task such as the one below.
(b) - With only using the task below why did the scheduler not start ?
Many thanks in advance
kind Regards Grant Brown
/* Standard includes. */ #include <plib.h> #include <stdio.h>
/* Scheduler includes. */ #include "FreeRTOS.h" #include "task.h" #include "queue.h"
#pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF #pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_2
static void GrantsTask(void *pvParameters); static void prvSetupHardware( void ); int Cnt = 0; int main( void ) {
// configure the wait states and peripheral bus clock //SYSTEMConfigPerformance(80000000);
prvSetupHardware();
// configure the port registers PORTSetPinsDigitalOut(IOPORT_D, BIT_0|BIT_1|BIT_2); // initialize the port pin states = outputs low mPORTDClearBits(BIT_0|BIT_1|BIT_2);
if(xTaskCreate( &GrantsTask, "GKB_Tsk", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ) == pdPASS) { PORTSetBits(IOPORT_D,BIT_1); } else { PORTSetBits(IOPORT_D,BIT_0); } // start the scheduler. */ vTaskStartScheduler(); // Will only reach here if there is insufficient heap available to start the scheduler while(1) { if(++Cnt == 65000) { mPORTDToggleBits(BIT_2); Cnt = 0; } }
return 0; }
static void GrantsTask(void *pvParameters) { portTickType xLastExecutionTime; const portTickType xFrequency = 500; //PORTWrite(IOPORT_D, 0x05); // 0000 0000 0000 0101 xLastExecutionTime = xTaskGetTickCount(); while(1) { vTaskDelay(xFrequency); mPORTDToggleBits(BIT_2); } }
/*-----------------------------------------------------------*/
static void prvSetupHardware( void ) { /* Set the system and peripheral bus speeds and enable the program cache*/ SYSTEMConfigPerformance( configCPU_CLOCK_HZ - 1 ); mOSCSetPBDIV( OSC_PB_DIV_2 );
/* Setup to use the external interrupt controller. */ INTEnableSystemMultiVectoredInt();
portDISABLE_INTERRUPTS();
/* Setup the digital IO for the LED's. */ //vParTestInitialise(); }
/*-----------------------------------------------------------*/
void vApplicationStackOverflowHook( void ) { /* Look at pxCurrentTCB to see which task overflowed its stack. */ for( ;; ); } /*-----------------------------------------------------------*/
void _general_exception_handler( unsigned portLONG ulCause, unsigned portLONG ulStatus ) { /* This overrides the definition provided by the kernel. Other exceptions should be handled here. */ for( ;; ); }
RE: Newbie completely lostPosted by Dave on October 21, 2008 In the first case you dont say why the code would not compile. I cannot offer advice without knowing the error message the compiler gave.
In the second case you have the code: if(xTaskCreate( &GrantsTask, ________________^___________
remove the &. The first parameter is a pointer to the task function. With the & you are passing in the address of a pointer to the function.
RE: Newbie completely lostPosted by Grant Brown on October 21, 2008 Hi,
Sorroy, here are the error messages
Main.c: In function `main': Main.c:47: error: `configMINIMAL_STACK_SIZE' undeclared (first use in this function) Main.c:47: error: (Each undeclared identifier is reported only once Main.c:47: error: for each function it appears in.) Main.c:47: error: `tskIDLE_PRIORITY' undeclared (first use in this function) Main.c:47: error: `pdPASS' undeclared (first use in this function) Main.c: In function `GrantsTask': Main.c:72: error: `portTickType' undeclared (first use in this function) Main.c:72: error: syntax error before "xLastExecutionTime" Main.c:73: error: syntax error before "xFrequency" Main.c:75: error: `xLastExecutionTime' undeclared (first use in this function) Main.c:78: error: `xFrequency' undeclared (first use in this function) Main.c: In function `prvSetupHardware': Main.c:89: error: `configCPU_CLOCK_HZ' undeclared (first use in this function) Main.c: At top level: Main.c:110: error: syntax error before "ulCause" Main.c:116:64: warning: no newline at end of file Halting build on first failure as requested.
Kind Regards Grant Brown
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|