Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12589 Discussions

Issue with Semaphores and Queues

BDufo1
Beginner
592 Views

Hello,

 

I have a problem with the embedded program in the NIOS II/f with µCosII system. Could you please help me ?

 

I have several semaphores but when I initialize more than 5 semaphores with OSemCreate(0) (whatever the semaphores are), the program crashes.

 

To be more precise some tasks will execute normally whereas some others will stop during execution without reason, far after the OSemCreate call.

 

For this Reason, I used the semaphores without initialization (directly with OSSemPost and OSSemPend and it worked

But now I want to create a queue and just adding

OS_EVENT* long_commands_event;

makes the program crash the same way

 

  • All functions about sempahores are allowed in BSP editor
  • The same problem happens by deleting the printf
  • There are six tasks but five are running in the same time (including TaskStart)

 

Here is the main program and don't hesitate to ask me other parts.

Thanks a lot,

Sincerely

BDufo

OS_EVENT *m_ETHRxSemaphore; OS_EVENT *m_ETHTxSemaphore; OS_EVENT *m_RandomSemaphore; OS_EVENT *m_dhcpSemaphore; OS_EVENT *m_AGCSemaphore; OS_EVENT *m_booting; OS_EVENT* m_RandomSemaphore; OS_EVENT* long_commands_event;   /** ... **/     int main(void) { OSInit();   m_ETHRxSemaphore = OSSemCreate(0); m_ETHTxSemaphore = OSSemCreate(0); m_AGCSemaphore = OSSemCreate(0); m_booting = OSSemCreate(0); m_dhcpSemaphore = OSSemCreate(0); m_RandomSemaphore = OSSemCreate(0); //long_commands_event = OSQCreate(&long_commands_fifo[0], LONG_COMMANDS_FIFO_SIZE);   /** ...**/   OSTaskCreateExt(TaskStart, NULL, (void*)&TaskStart_stk[START_TASK_SIZE-1], TASK_TaskStart_PRIORITY, TASK_TaskStart_PRIORITY, (void*)&TaskStart_stk[0], START_TASK_SIZE, &TaskUserData[TASK_TaskStart_ID] , OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);   OSStart(); }

 

0 Kudos
0 Replies
Reply