Pumpkin, Inc.

Pumpkin User Forums

message queue

For issues specific to the PIC24 MCU and dsPIC DSC line of microcontrollers from Microchip, including compiler (e.g. MCC 30) and IDE (e.g. MPLAB) issues.

message queue

Postby michago8 » Thu Aug 20, 2009 8:29 am

Hi,

I have the pro edition. I'm trying to use message queues without success in compiling the project.

Here is a try based of the tut5

I'm working with MPLAB (build 8.33), Compiler C-30 (build 3.12). salvo (build 4.2.2) library: C:PumpkinSalvoLibMCC30-v3libsalvolmcc30it,

I marked the changes that I have done with green color. I'm trying to do the same in my project, working with source file not library, facing the same error.

Please Advice,

Michael David.

Configuration:

code:

#define OSUSE_LIBRARY TRUE

#define OSLIBRARY_TYPE OSL

#define OSLIBRARY_CONFIG OST

#define OSENABLE_MESSAGE_QUEUES TRUE

#define OSEVENTS 2

#define OSEVENT_FLAGS 0

#define OSMESSAGE_QUEUES 1

#define OSTASKS 3

main :

#include <salvo.h>

#include "p24HJ256GP610.h"

#define LOOPS_PER_TICK 100 /* <64K */

#define TASK_COUNT_P OSTCBP(1) /* task #1 */

#define TASK_SHOW_P OSTCBP(2) /* "" #2 */

#define TASK_BLINK_P OSTCBP(3) /* "" #3 */

#define PRIO_COUNT 10 /* task priorities*/

#define PRIO_SHOW 10 /* "" */

#define PRIO_BLINK 2 /* "" */

#define BINSEM_UPDATE_PORT_P OSECBP(1) /* binSem #1 */

#define MSGQ1_P OSECBP(2)

#define MQCB1_P OSMQCBP(1)

#define SIZEOF_MSGQ1 7

/* allocate memory for buffers */

OSgltypeMsgQP MsgQBuff1[SIZEOF_MSGQ1];

unsigned int counter;

void TaskCount (void)

{

for (; ;)

{

counter++;

/* Every time bit 8 of counter rolls over, signal the binSem. */

if (!(counter & 0x01FF))

{

OSSignalBinSem(BINSEM_UPDATE_PORT_P);

}

/* Context-switch so other tasks can run. */

OS_Yield();

}

}

void TaskShow (void)

{

for (; ;)

{

/* Context-switch and wait for TaskCount() to signal that 512 */

/* counts have elapsed. */

OS_WaitBinSem(BINSEM_UPDATE_PORT_P, OSNO_TIMEOUT);

/* Write upper 7 bits of 16-bit counter PORTA:[7..1]. */

PORTA = (PORTA & ~0xFE) | ((counter >> 8) & 0xFE);

}

}

void TaskBlink (void)

{

/* Set PORTA to all-outputs, initialize to 0x00. This only happens */

/* when the tasks starts. */

TRISA = 0x00;

PORTA = 0xAA;

LATA = 0xAA;

for (; ;)

{

/* Toggle PORTA:0 */

PORTA ^= 0x01;

/* Context-switch and return in 50 ticks. */

OS_Delay(50);

}

}

int main (void)

{

unsigned int ticks;

OSInit();

OSCreateTask(TaskCount, TASK_COUNT_P, PRIO_COUNT);

OSCreateTask(TaskShow, TASK_SHOW_P, PRIO_SHOW );

OSCreateTask(TaskBlink, TASK_BLINK_P, PRIO_BLINK);

OSCreateBinSem(BINSEM_UPDATE_PORT_P, 0);

/* create message queues from existing */

/* buffers and mqcbs. */

OSCreateMsgQ(MSGQ1_P, MQCB1_P, MsgQBuff1,SIZEOF_MSGQ1);

counter = 0;

ticks = LOOPS_PER_TICK;

__asm__ volatile("disi #0x0000");

for (; ;)

{

/* synthesize a system tick rate without having to use interrupts. */

if (ticks-- == 0)

{

OSTimer();

ticks = LOOPS_PER_TICK;

}

OSSched();

}

}

Compilation result:

----------------------------------------------------------------------

Debug build of project `C:PumpkinSalvoExamplePICPIC24SimulatorTutTut6MCC30 ut5pro-lib.mcp' started.

Language tool versions: pic30-as.exe v3.12, pic30-gcc.exe v3.12, pic30-ld.exe v3.12, pic30-ar.exe v3.12

Preprocessor symbol `__DEBUG' is defined.

Thu Aug 20 13:18:57 2009

----------------------------------------------------------------------

Clean: Deleting intermediary and output files.

Clean: Deleted file "C:PumpkinSalvoSrcsalvomem.o".

Clean: Deleted file "C:PumpkinSalvoSrcMCC30salvohook_interrupt_PIC24_IRQ.o".

Clean: Deleted file "C:PumpkinSalvoSrcsalvohook_wdt.o".

Clean: Done.

Executing: "C:Program FilesMicrochipMPLAB C30inpic30-gcc.exe" -mcpu=24HJ256GP610 -x c -c "salvomem.c" -o"salvomem.o" -I"C:PumpkinSalvoExamplePICPIC24SimulatorTutTut5MCC30Pro-lib" -I"C:PumpkinSalvoInc" -D__DEBUG -g

Executing: "C:Program FilesMicrochipMPLAB C30inpic30-gcc.exe" -mcpu=24HJ256GP610 -x c -c "salvohook_interrupt_PIC24_IRQ.c" -o"salvohook_interrupt_PIC24_IRQ.o" -I"C:PumpkinSalvoExamplePICPIC24SimulatorTutTut5MCC30Pro-lib" -I"C:PumpkinSalvoInc" -D__DEBUG -g

Executing: "C:Program FilesMicrochipMPLAB C30inpic30-gcc.exe" -mcpu=24HJ256GP610 -x c -c "salvohook_wdt.c" -o"salvohook_wdt.o" -I"C:PumpkinSalvoExamplePICPIC24SimulatorTutTut5MCC30Pro-lib" -I"C:PumpkinSalvoInc" -D__DEBUG -g

Executing: "C:Program FilesMicrochipMPLAB C30inpic30-gcc.exe" -mcpu=24HJ256GP610 -x c -c "main.c" -o"main.o" -I"C:PumpkinSalvoExamplePICPIC24SimulatorTutTut5MCC30Pro-lib" -I"C:PumpkinSalvoInc" -D__DEBUG -g

main.c: In function 'main':

main.c:107: error: 'OSmqcbArea' undeclared (first use in this function)

main.c:107: error: (Each undeclared identifier is reported only once

main.c:107: error: for each function it appears in.)

Halting build on first failure as requested.

----------------------------------------------------------------------

Debug build of project `C:PumpkinSalvoExamplePICPIC24SimulatorTutTut6MCC30 ut5pro-lib.mcp' failed.

Language tool versions: pic30-as.exe v3.12, pic30-gcc.exe v3.12, pic30-ld.exe v3.12, pic30-ar.exe v3.12

Preprocessor symbol `__DEBUG' is defined.

Thu Aug 20 13:19:01 2009

----------------------------------------------------------------------

BUILD FAILED



[This message has been edited by aek (edited August 20, 2009).]

michago8
 
Posts: 1
Joined: Tue Jun 26, 2007 11:00 pm

Re: message queue

Postby aek » Thu Aug 20, 2009 10:42 am

Hello.

I believe your project is misconfigured, because when I build it, I get

code:
C:/Pumpkin/Salvo/Inc/salvolbo.h:160:2: error: #error salvolbo.h: salvocfg.h: Illegal configuration option for library build: OSENABLE_MESSAGE_QUEUES.

which is correct for your salvocfg.h and Salvo 4.

Your salvocfg.h should only be:

code:
#define OSUSE_LIBRARY TRUE
#define OSLIBRARY_TYPE OSL
#define OSLIBRARY_CONFIG OST
#define OSEVENTS 2
#define OSEVENT_FLAGS 0
#define OSMESSAGE_QUEUES 1
#define OSTASKS 3

Also, in your original file you had a C continuation character at the end of one of the lines ... With that fixed, I can build it fine:

code:
Debug build of project `C:PumpkinCubeSatKitExamplePIC24	est.mcp' started.
Language tool versions: pic30-as.exe v3.12, pic30-gcc.exe v3.12, pic30-ld.exe v3.12, pic30-ar.exe v3.12
Preprocessor symbol `__DEBUG' is defined.
Target debug platform is `__MPLAB_DEBUGGER_ICD2=1'.
Debug platform options are: `__ICD2RAM=1'.
Thu Aug 20 12:11:30 2009
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:PumpkinCubeSatKitExamplePIC24main.o".
Clean: Deleted file "C:PumpkinCubeSatKitExamplePIC24salvomem.o".
Clean: Deleted file "C:PumpkinCubeSatKitExamplePIC24 est.cof".
Clean: Deleted file "C:PumpkinCubeSatKitExamplePIC24 est.hex".
Clean: Done.
Executing: "C:Program FilesMicrochipMPLAB C30inpic30-gcc.exe" -mcpu=24FJ256GA110 -x c -c "main.c" -o"main.o" -I"C:PumpkinCubeSatKitExamplePIC24" -I"C:PumpkinSalvoInc" -I"C:Program FilesMicrochipMPLAB C30supporth" -D__DEBUG -D__MPLAB_DEBUGGER_ICD2=1 -g -Wall
Microchip MPLAB C30 License Manager Version v3.12 (Build Date Jan 30 2009).
Copyright (c) 2008 Microchip Technology Inc. All rights reserved.
main.c: In function 'main':
main.c:84: warning: passing argument 1 of 'OSCreateTask' makes integer from pointer without a cast
main.c:85: warning: passing argument 1 of 'OSCreateTask' makes integer from pointer without a cast
main.c:87: warning: passing argument 1 of 'OSCreateTask' makes integer from pointer without a cast
Executing: "C:Program FilesMicrochipMPLAB C30inpic30-gcc.exe" -mcpu=24FJ256GA110 -x c -c "C:PumpkinSalvoSrcsalvomem.c" -o"salvomem.o" -I"C:PumpkinCubeSatKitExamplePIC24" -I"C:PumpkinSalvoInc" -I"C:Program FilesMicrochipMPLAB C30supporth" -D__DEBUG -D__MPLAB_DEBUGGER_ICD2=1 -g -Wall
Microchip MPLAB C30 License Manager Version v3.12 (Build Date Jan 30 2009).
Copyright (c) 2008 Microchip Technology Inc. All rights reserved.
Executing: "C:Program FilesMicrochipMPLAB C30inpic30-gcc.exe" -mcpu=24FJ256GA110 "main.o" "salvomem.o" "C:PumpkinSalvoLibMCC30-v3libsalvolmcc30it.a" -o"test.cof" -Wl,--script="........Program FilesMicrochipMPLAB C30supportPIC24Fgldp24FJ256GA110.gld",--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__MPLAB_DEBUGGER_ICD2=1,--defsym=__ICD2RAM=1,-Map="test.map",--report-mem


Program Memory [Origin = 0x200, Length = 0x2a9f8]

section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.text 0x200 0x94 0xde (222)
.text 0x294 0x1b6 0x291 (657)
.text 0x44a 0x156 0x201 (513)
.text 0x5a0 0x112 0x19b (411)
.text 0x6b2 0xec 0x162 (354)
.text 0x79e 0xe6 0x159 (345)
.text 0x884 0xbe 0x11d (285)
.text 0x942 0xb6 0x111 (273)
.text 0x9f8 0x92 0xdb (219)
.text 0xa8a 0x6a 0x9f (159)
.text 0xaf4 0x2a 0x3f (63)
.text 0xb1e 0x24 0x36 (54)
.text 0xb42 0x22 0x33 (51)
.text 0xb64 0x10 0x18 (24)
.dinit 0xb74 0xe 0x15 (21)
.text 0xb82 0x6 0x9 (9)
.isr 0xb88 0x2 0x3 (3)

Total program memory used (bytes): 0xe4f (3663) 1%


Data Memory [Origin = 0x800, Length = 0x4000]

section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.icd 0x800 0x50 0x50 (80)
.nbss 0x850 0 0x76 (118)

Total data memory used (bytes): 0xc6 (198) 1%


Dynamic Memory Usage

region address maximum length (dec)
------ ------- ---------------------
heap 0 0 (0)
stack 0x8c6 0x3f3a (16186)

Maximum dynamic memory (bytes): 0x3f3a (16186)

Executing: "C:Program FilesMicrochipMPLAB C30inpic30-bin2hex.exe" "C:PumpkinCubeSatKitExamplePIC24 est.cof"
Loaded C:PumpkinCubeSatKitExamplePIC24 est.cof.
----------------------------------------------------------------------
Debug build of project `C:PumpkinCubeSatKitExamplePIC24 est.mcp' succeeded.
Language tool versions: pic30-as.exe v3.12, pic30-gcc.exe v3.12, pic30-ld.exe v3.12, pic30-ar.exe v3.12
Preprocessor symbol `__DEBUG' is defined.
Target debug platform is `__MPLAB_DEBUGGER_ICD2=1'.
Debug platform options are: `__ICD2RAM=1'.
Thu Aug 20 12:11:33 2009
----------------------------------------------------------------------
BUILD SUCCEEDED


------------------

[This message has been edited by aek (edited August 20, 2009).]

[This message has been edited by aek (edited August 20, 2009).]

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: message queue

Postby aek » Thu Aug 20, 2009 10:47 am

The fact that you are not getting that error suggests that your project is actually using a different salvocfg.h, and that is the likely cause of your problems.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to PIC24 & dsPIC

Who is online

Users browsing this forum: No registered users and 1 guest

cron