- basic timer ISR, which sets a binary semaphore 16 times a second
- one task, which waits on the binary semaphore
I am doing a source build -- not a library build.
The program runs for a short while (usually anywhere from 4 to 50 timer
interrrupts, but then gets into a state where the GIE bit is 0, at which point
the timer interrrupt no longer gets serviced.
I am using IAR version 4.10 compiler and Salvo Pro 4.2.0. The problem
occurs with both the C and C++ compilers, and with both the small
and medium data models.
The target is an MSP430FG4618. I am using the FET-USB debug interface.
================== My salvocfg.h file is:
code:#ifndef __SALVOCFG_H
#define __SALVOCFG_H
// *** INCLUDE FILES
#include <io430.h>// *** CONSTANTS
#define OSUSE_LIBRARY FALSE#define OSENABLE_BINARY_SEMAPHORES TRUE
#define OSEVENTS 1
#define OSEVENT_FLAGS 0
#define OSMESSAGE_QUEUES 0
#define OSTASKS 1
#endif // __SALVOCFG_H
================== My source code file is:
code:#include <salvo.h>
#include <assert.h>
#include <io430.h>
#include <in430.h>
#include <intrinsics.h>OStypeErr rtos_error;
void my_task(void)
{
while(true)
{
OS_WaitBinSem(OSECBP(1), OSNO_TIMEOUT);
}
}int main(void)
{
OSInit(); // initialize RTOS// reset the counter to zero
BTCNT12 = 0;// program for interrupting every 62.5 ms
BTCTL = BT_fCLK2_ACLK_DIV256 | BT_fCLK2_DIV8;
rtos_error = OSCreateTask(my_task, OSTCBP(1), 8);
assert(rtos_error == OSNOERR);
rtos_error = OSCreateBinSem(OSECBP(1), 0);
assert(rtos_error == OSNOERR);
// enable basic timer interrupt
RTCCTL &= ~RTCIE;
IE2_bit.BTIE = 1;
__enable_interrupt();while(true)
{
OSSched(); // invoke the RTOS task scheduler
}
}
#pragma vector=BASICTIMER_VECTOR
__interrupt void basic_timer_ISR(void)
{
rtos_error = OSSignalBinSem(OSECBP(1));
assert( (rtos_error == OSNOERR) ||
(rtos_error == OSERR_EVENT_FULL) );
(void)LPM3_EXIT;
}
[This message has been edited by aek (edited April 28, 2008).]