FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [April 2010 Threads]
I had a problem getting the H8/S port to run on an H8S/2212 -- it kept crashing, with even the simplest of tasks (flashing an LED). Working through the FreeRTOS code, I finally discovered that as distributed, it supports only Interrupt Control Mode 0. We're using Interrupt Control Mode 2 (prioritized interrupts) in our project. Here's the fix, if anyone else needs it:
In portmacro.h, I added a new #define portINTERRUPT_MODE_2 and then changed the critical section macros as follows:
/* define the following if Interrupt Control Mode 2 is used */
#define portINTERRUPT_MODE_2
/*-----------------------------------------------------------*/
#ifdef portINTERRUPT_MODE_2
/* Critical section handling. */
#define portENABLE_INTERRUPTS()asm volatile( "ANDC#0xF8, EXR" );
#define portDISABLE_INTERRUPTS()asm volatile( "ORC #0x07, EXR" );
/* Push the EXR then disable interrupts. */
#define portENTER_CRITICAL() asm volatile( "STCEXR, @-ER7" ); \
portDISABLE_INTERRUPTS();
/* Pop the EXR to set the interrupt masking back to its previous state. */
#define portEXIT_CRITICAL() asm volatile( "LDC @ER7+, EXR" );
#else
/* Critical section handling. */
#define portENABLE_INTERRUPTS()asm volatile( "ANDC#0x7F, CCR" );
#define portDISABLE_INTERRUPTS()asm volatile( "ORC #0x80, CCR" );
/* Push the CCR then disable interrupts. */
#define portENTER_CRITICAL() asm volatile( "STCCCR, @-ER7" ); \
portDISABLE_INTERRUPTS();
/* Pop the CCR to set the interrupt masking back to its previous state. */
#define portEXIT_CRITICAL() asm volatile( "LDC @ER7+, CCR" );
#endif
/*-----------------------------------------------------------*/
In function pxPortInitialiseStack, in file port.c, I changed the CCR initialization as follows:
/* Followed by the CCR. */
pxTopOfStack--;
*pxTopOfStack = portINITIAL_CCR;
/* If H8S interrupt mode 2 is used, we also need to push EXR */
#ifdef portINTERRUPT_MODE_2
pxTopOfStack--;
*pxTopOfStack = 0;
pxTopOfStack--;
*pxTopOfStack = portINITIAL_EXR;
#endif
with this at the top of the file:
/* If interrupt control mode 2 is used, the interrupt stack is different */
#define portINITIAL_EXR ( ( portSTACK_TYPE ) 0x00 )
Sorry, somehow my "code" tags didn't work, and I don't see how to edit the post. I hope the code fragments are readable.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.