SimpleIDE and multiple .cogc files
Mark Mara
Posts: 64
I am having a problem using SimpleIDE to build a project that contains three .cogc files. The compiler seems to be only generating a global symbol (_load_start_FILENAME_cog ) for the first .cogc file.
When the project contains only one .cogc file it works fine. When I add a second .cogc file I get an unresolved reference error. For example, if I add a file, cogA.cogc, to the project. I can reference it using _load_start_cogA_cog. However, if I add a second .cogc file, cogB.cogc, I get an unresolved reference error when I try to reference _load_start_cogB_cog.

Is there an example of using SimpleIDE to build a project containing more than one .cogc file?
Thanks.
When the project contains only one .cogc file it works fine. When I add a second .cogc file I get an unresolved reference error. For example, if I add a file, cogA.cogc, to the project. I can reference it using _load_start_cogA_cog. However, if I add a second .cogc file, cogB.cogc, I get an unresolved reference error when I try to reference _load_start_cogB_cog.

Is there an example of using SimpleIDE to build a project containing more than one .cogc file?
Thanks.

Comments
Thanks.
--Steve
Thanks for offering to take a look.
main routine: cog_test.c
/** * This is the main cog_test program file. */ #include <stdio.h> #include <unistd.h> #include <propeller.h> #include "cog_test.h" #include "simpletools.h" // Include simpletools library /* control block for cogA */ struct { unsigned stack[STACK_SIZE_A]; volatile struct cogA_mailbox A; } parA; /* control block for cogB */ struct { unsigned stack[STACK_SIZE_B]; volatile struct cogB_mailbox B; } parB; /* start cogA */ void startA(volatile void *parptr) { extern unsigned int _load_start_cogA_cog[]; #if defined(__PROPELLER_XMM__) || defined(__PROPELLER_XMMC__) load_cog_driver_xmm(_load_start_cogA_cog, 496, (uint32_t *)parptr); #else cognew(_load_start_cogA_cog, parptr); #endif } /* start cogB */ void startB(volatile void *parptr) { extern unsigned int _load_start_cogB_cog[]; #if defined(__PROPELLER_XMM__) || defined(__PROPELLER_XMMC__) load_cog_driver_xmm(_load_start_cogB_cog, 496, (uint32_t *)parptr); #else cognew(_load_start_cogB_cog, parptr); #endif } int main(void) { sleep(2); /* start the A cog */ printf("starting cogA\n"); startA(&parA.A); printf("%s\n",parA.A.cog_message); /* start the B cog */ printf("starting cogB\n"); startB(&parB.B); printf("%s\n",parB.B.cog_message); /* loop forever */ while(1) { sleep(2); printf("cogA: %s\n",parA.A.cog_message); printf("cogB: %s\n",parB.B.cog_message); } return 0; }header file: cog_test.h
#ifndef __COG_TEST_H__ #define __COG_TEST_H__ #define STACK_SIZE_A 16 #define STACK_SIZE_B 16 #define COG_MESSAGE_SIZE 128 struct cogA_mailbox { int data; char cog_message[COG_MESSAGE_SIZE]; }; struct cogB_mailbox { int data; char cog_message[COG_MESSAGE_SIZE]; }; #endiffirst .cogc file: cogA.cogc#include <propeller.h> #include "cog_test.h" _NATIVE void main (struct cogA_mailbox *m) { strcpy(m->cog_message,"cogA started"); for(;;) strcpy(m->cog_message,"cogA running"); }second .cogc file: cogB.cogc#include <propeller.h> #include "cog_test.h" _NATIVE void main (struct cogB_mailbox *m) { strcpy(m->cog_message,"cogB started"); for(;;) strcpy(m->cog_message,"cogB running"); }If I comment out the cogB references it launches cogA and seems to work fine.
Thanks.
I am happy. If it would be of any value to you I could probably restore from a backup and compare the .side files.
Thanks for your help.
Apparently with Create Project Library checked, the .cogc/.cog files do not get linked.
Adding an issue to google code thanks. Do you mind if I attach your example to the issue?
Feel free.
Thanks for your help.
I've added notes regarding this issue here: https://code.google.com/p/propside/issues/detail?id=184
The notes demonstrate what it takes to ensure that the cogc code is included in a library when Create Project Library is selected in SimpleIDE.