I’d like to run freeRTOS(v10.0.1) on a NEC V850 JH3 (uPD70F3783).
The used IDE is IAR embeedded Workbench with IAR Compiler for V850(v3.80).
I’ve tried to run the demo application, but it doesn’t work.
It seems like the scheduler doesn’t work properly. I’ve set some breackpoints in the interrupt-handler, which should do the increment TimeTick and TaskSwitch, but it doesn’t get called. Obviously the Interrupt-handler doesn’t get triggered.
Has anyone ever had this problem with the demo before?
Thank you for your quick response. The demo runs through initialization until vTaskStartScheduler() is called. Then it crashes the IAR embedded workbench. For this reason, I have commented out the demo tasks and created two separate tasks, which should toggle a LED each as shown below.
Example
static void blink_1(void *pvParameters)
{
while(1)
{
toggleLed1();
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
static void blink_2(void *pvParameters)
{
while(1)
{
toggleLed1();
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
/*-----------------------------------------------------------*/
/* Create all the demo tasks then start the scheduler. */
void main(void)
{
/* Just sets up the LED outputs. */
prvSetupHardware();
xTaskCreate(blink_1, "b1", 80, NULL, tskIDLE_PRIORITY+1, NULL);
xTaskCreate(blink_2, "b2", 80, NULL, tskIDLE_PRIORITY+1, NULL);
vTaskStartScheduler();
/* If this line is reached then vTaskStartScheduler() returned because there
was insufficient heap memory remaining for the idle task to be created. */
for(;;);
}
After that, each task is called once and then it remains in function portTASK_FUNCTION (because the interrupt function for incrementTick and switchContex isn’t called).
There’s also another issue. The Debug log shows a warning “the stackpointer for stack is outside the stack range”. I have increased the stack size to many diffent values, but it didn’t fix the issue.
Thank you for your quick response. The demo runs through initialization until vTaskStartScheduler() is called. Then it crashes the IAR embedded workbench. For this reason, I have commented out the demo tasks and created two separate tasks, which should toggle a LED each as shown below.
Example
static void blink_1(void *pvParameters)
{
while(1)
{
P2 ^= 0x02;
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
static void blink_2(void *pvParameters)
{
while(1)
{
P2 ^= 0x04;
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
/*-----------------------------------------------------------*/
/* Create all the demo tasks then start the scheduler. */
void main(void)
{
/* Just sets up the LED outputs. */
prvSetupHardware();
xTaskCreate(blink_1, "b1", 80, NULL, tskIDLE_PRIORITY+1, NULL);
xTaskCreate(blink_2, "b2", 80, NULL, tskIDLE_PRIORITY+1, NULL);
vTaskStartScheduler();
/* If this line is reached then vTaskStartScheduler() returned because there
was insufficient heap memory remaining for the idle task to be created. */
for(;;);
}
After that, each task is called once and then it remains in function portTASK_FUNCTION (because the interrupt function for incrementTick and switchContex isn’t called).
There’s also another issue. The Debug log shows a warning “the stackpointer for stack is outside the stack range”. I have increased the stack size to many diffent values, but it didn’t fix the issue.
Thank you for your quick response. The demo runs through initialization until vTaskStartScheduler() is called. Then it crashes the IAR embedded workbench. For this reason, I have commented out the demo tasks and created two separate tasks, which should toggle a LED each as shown below.
Example
static void blink_1(void *pvParameters)
{
while(1)
{
P2 ^= 0x02;
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
static void blink_2(void *pvParameters)
{
while(1)
{
P2 ^= 0x04;
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
/*-----------------------------------------------------------*/
/* Create all the demo tasks then start the scheduler. */
void main(void)
{
/* Just sets up the LED outputs. */
prvSetupHardware();
xTaskCreate(blink_1, "b1", 80, NULL, tskIDLE_PRIORITY+1, NULL);
xTaskCreate(blink_2, "b2", 80, NULL, tskIDLE_PRIORITY+1, NULL);
vTaskStartScheduler();
/* If this line is reached then vTaskStartScheduler() returned because there
was insufficient heap memory remaining for the idle task to be created. */
for(;;);
}
After that, each task is called once and then it remains in function portTASK_FUNCTION (because the interrupt function for incrementTick and switchContex isn’t called).
There’s also another issue. The Debug log shows a warning “the stackpointer for stack is outside the stack range”. I have increased the stack size to many diffent values, but it didn’t fix the issue.
I solved the issue regarding the interrupt handler. I checked the port assembler file and saw that the wrong interrupt vector was set.
First it was
; Tick ISR Prototype
;------------------------------------------------------------------------------
PUBWEAK `??MD_INTTM0EQ0??INTVEC 640`
PUBLIC MD_INTTM0EQ0
MD_INTTM0EQ0 SYMBOL "MD_INTTM0EQ0"
`??MD_INTTM0EQ0??INTVEC 640` SYMBOL "??INTVEC 640", MD_INTTM0EQ0
But 0x640 is the interrupt vector for INTDMA1.
It needs to be 0x430 for the needed INTTM0EQ0 interrupt.
I’ve changed it and now it works.
The changes need to be done in portasm.s85
; Tick ISR Prototype
;------------------------------------------------------------------------------
PUBWEAK `??MD_INTTM0EQ0??INTVEC 0x430`
PUBLIC MD_INTTM0EQ0
MD_INTTM0EQ0 SYMBOL "MD_INTTM0EQ0"
`??MD_INTTM0EQ0??INTVEC 0x430` SYMBOL "??INTVEC 0x430", MD_INTTM0EQ0
and
;------------------------------------------------------------------------------
COMMON INTVEC:CODE:ROOT(2)
ORG 0x430
`??MD_INTTM0EQ0??INTVEC 0x430`:
JR MD_INTTM0EQ0