anonymous wrote on Saturday, July 17, 2010:
I already seen some discussions about LPC2368 in the forum, I didn’t
find it for IAR at the new versions of IAR, so I suppose that “work”
it’s not so easy that they don’t share or not possible :-).
I had bought books trying to understand better the process, but in
fact, I can’t go ahead, and I already use the project, try to combine
the .S file, already ported the TIMER, use the LPC23 GCC example and
files, and up to know, the timer goes OK, the main it’s called in
supervisor mode, but sometimes it end’s in a data_abort, or other
errors…
When I change the ASM ( port SAVE and port RESTORE ) it change the
result, but in fact, I can go far with it.
The big issue is that in IAR there is no possible to call the code
like in GCC ( because of naked attribute - that’s why the code use ASM
MACRO )
So how to make SAVE and RESTORE totaly compatible calling this 2 lines :
( void ) ulCriticalNesting; \
( void ) pxCurrentTCB; \
Like in GCC project port, or even better, does anybode has a project ported to IAR?
One another question, trying to work in the IRQ for timer interruption , at the preempitive mode, the code says that we can user directives like __arm __irq , but when I try this interruptions without this directives the code generate some instable result, it’s really unecessary? there is problem to use? like this :
void prvSetupTimerInterrupt( void )
{
unsigned portLONG ulCompareMatch;
//PCLKSEL0 = (PCLKSEL0 & (~(0x3<<2))) | (0x01 << 2);
T0TCR |= 2; /* Stop and reset the timer */
T0CTCR = 0; /* Timer mode */
/* A 1ms tick does not require the use of the timer prescale. This is
defaulted to zero but can be used if necessary. */
T0PR = portPRESCALE_VALUE;
/* Calculate the match value required for our wanted tick rate. */
ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
/* Protect against divide by zero. Using an if() statement still results
in a warning - hence the #if. */
#if portPRESCALE_VALUE != 0
{
ulCompareMatch /= ( portPRESCALE_VALUE + 1 );
}
#endif
//
T0MR0 = ulCompareMatch;
/* Generate tick with timer 0 compare match. */
T0MCR = 3;//(3 << 3); /* Reset timer on match and generate interrupt */
/* Setup the VIC for the timer. */
VICINTENABLE = 0x00000010;
/* The ISR installed depends on whether the preemptive or cooperative
scheduler is being used. */
#if configUSE_PREEMPTION == 1
{
extern void ( vPreemptiveTick )( void );
VICVECTADDR4 = ( portLONG ) vPortPreemptiveTick;
}
#else
{
extern void ( vNonPreemptiveTick )( void );
VICVECTADDR4 = ( portLONG ) vPortNonPreemptiveTick;
}
#endif
VICVECTPRIORITY4 = 1;
/* Start the timer - interrupts are disabled when this function is called
so it is okay to do this here. */
T0TCR = 1;
}
__arm __irq void vPortPreemptiveTick( void );
__arm __irq void vPortPreemptiveTick( void )
{
/* Increment the tick counter. */
//vTaskIncrementTick();
/* The new tick value might unblock a task. Ensure the highest task that
is ready to execute is the task that will execute when the tick ISR
exits. */
//vTaskSwitchContext();
/* Ready for the next interrupt. */
__disable_interrupt();
T0IR = 1;
VICADDRESS = 0;
__enable_interrupt();
}
Best regards