Remove coroutines (#874)

* Remove co-routine centric CORTEX_LM3S102_Rowley demos.

Remove CORTEX_LM3S102_Rowley Demo2 and Demo3.
Update Demo1 to no longer use coroutines.

* Remove co-routines from MB91460_Softune demo

* FreeRTOS_96348hs_SK16FX100PMC: Remove co-routine usage.

Remove co-routine usage from FreeRTOS_96348hs_SK16FX100PMC demo.

* MB96350_Softune_Dice_Kit: Remove co-routine usage

Remove co-routines usage from MB96350_Softune_Dice_Kit demo

* AVR_Dx_IAR: Remove co-routine usage

* AVR_Dx_Atmel_Studio: Remove co-routine usage

* PIC24_MPLAB: Remove autogenerated files and add to .gitignore

* PIC24_MPLAB: Remove co-routine usage from demo

* AVR_ATMega323_IAR: Remove co-routine usage

* ColdFire_MCF52221_CodeWarrior: Remove coroutine usage

* AVR_ATMega4809_MPLAB.X: Remove co-routine usage

* AVR_ATMega4809_IAR: Remove co-routine usage

* AVR_ATMega4809_Atmel_Studio: Remove coroutine usage

* AVR_ATMega323_WinAVR: Remove coroutine usage

* AVR_Dx_MPLAB.X: Remove coroutine usage

* dsPIC_MPLAB: Remove coroutine usage

* CORTEX_LM3S102_GCC: Remove coroutines and coroutine centric demos

* CORTEX_LM3S102_GCC: Update makefile to discard unused symbols

Allows fitting in the limited ram/flash for this part.

* CORTEX_LM3S316_IAR: Remove coroutines

* Demos: Remove references to crflash.c, crhook.c, crflash.h, crhook.h

* Remove coroutine options from FreeRTOSConfig.h files

* Xilinx: Remove backup file generated by revup utility

* Demos: Remove Coroutine related config items and references

* Format CBMC FreeRTOSConfig.h

* Update URL from aws.amazon.com/freertos to github.com/FreeRTOS

* Fix copyright year and license text

* Fix license text in demo files

* Update header check excluded path list

* Add configBENCHMARK to lexicon
This commit is contained in:
Paul Bartell 2022-11-21 20:59:53 -08:00 committed by GitHub
parent eb7fd55a49
commit 569c78fd8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1153 changed files with 4875 additions and 12450 deletions

View file

@ -20,7 +20,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://aws.amazon.com/freertos
* https://github.com/FreeRTOS
*
*/
@ -34,7 +34,7 @@
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
@ -50,10 +50,8 @@
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
#define configUSE_CO_ROUTINES 1
#define configMAX_PRIORITIES ( 2 )
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@ -71,6 +69,4 @@ to exclude the API function. */
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xa0, or priority 5. */
#endif /* FREERTOS_CONFIG_H */

View file

@ -20,7 +20,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://aws.amazon.com/freertos
* https://github.com/FreeRTOS
*
*/
@ -73,7 +73,7 @@ unsigned char ucBit = ( unsigned char ) 1;
}
PDCWrite( PDC_LED, ucOutputValue );
}
}
}
xTaskResumeAll();
}

View file

@ -907,9 +907,6 @@
<file>
<name>$PROJ_DIR$\commstest.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\crflash.c</name>
</file>
<file>
<name>$PROJ_DIR$\main.c</name>
</file>
@ -922,9 +919,6 @@
</group>
<group>
<name>FreeRTOS Source</name>
<file>
<name>$PROJ_DIR$\..\..\Source\croutine.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_1.c</name>
</file>
@ -957,5 +951,3 @@
</file>
</group>
</project>

View file

@ -25,7 +25,7 @@
*/
/*
* The comms test Rx and Tx task and co-routine. See the comments at the top
* The comms test Rx and Tx task. See the comments at the top
* of main.c for full information.
*/
@ -34,7 +34,6 @@
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "croutine.h"
/* Demo application include files. */
#include "partest.h"
@ -43,7 +42,7 @@
#include "DriverLib.h"
/* The LED's toggled by the various tasks. */
#define commsFAIL_LED ( 7 )
#define commsFAIL_LED ( 7 )
#define commsRX_LED ( 6 )
#define commsTX_LED ( 5 )
@ -51,7 +50,7 @@
task. */
#define commsRX_QUEUE_LEN ( 5 )
/* The baud rate used by the UART comms tasks/co-routine. */
/* The baud rate used by the UART comms tasks. */
#define commsBAUD_RATE ( 57600 )
/* FIFO setting for the UART. The FIFO is not used to create a better test. */
@ -117,71 +116,6 @@ void vSerialInit( void )
}
/*-----------------------------------------------------------*/
void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
{
TickType_t xDelayPeriod;
static unsigned long *pulRandomBytes = commsFIRST_PROGRAM_BYTES;
/* Co-routine MUST start with a call to crSTART. */
crSTART( xHandle );
for(;;)
{
/* Was the previously transmitted string received correctly? */
if( uxCommsErrorStatus != pdPASS )
{
/* An error was encountered so set the error LED. */
vParTestSetLED( commsFAIL_LED, pdTRUE );
}
/* The next character to Tx is the first in the string. */
cNextChar = commsFIRST_TX_CHAR;
UARTIntDisable( UART0_BASE, UART_INT_TX );
{
/* Send the first character. */
if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) )
{
HWREG( UART0_BASE + UART_O_DR ) = cNextChar;
}
/* Move the variable to the char to Tx on so the ISR transmits
the next character in the string once this one has completed. */
cNextChar++;
}
UARTIntEnable(UART0_BASE, UART_INT_TX);
/* Toggle the LED to show a new string is being transmitted. */
vParTestToggleLED( commsTX_LED );
/* Delay before we start the string off again. A pseudo-random delay
is used as this will provide a better test. */
xDelayPeriod = xTaskGetTickCount() + ( *pulRandomBytes );
pulRandomBytes++;
if( pulRandomBytes > commsTOTAL_PROGRAM_MEMORY )
{
pulRandomBytes = commsFIRST_PROGRAM_BYTES;
}
/* Make sure we don't wait too long... */
xDelayPeriod &= commsMAX_TX_DELAY;
/* ...but we do want to wait. */
if( xDelayPeriod < commsMIN_TX_DELAY )
{
xDelayPeriod = commsMIN_TX_DELAY;
}
/* Block for the random(ish) time. */
crDELAY( xHandle, xDelayPeriod );
}
/* Co-routine MUST end with a call to crEND. */
crEND();
}
/*-----------------------------------------------------------*/
void vUART_ISR( void )
{
unsigned long ulStatus;
@ -204,7 +138,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
blocked on the queue waiting for characters. */
cRxedChar = ( char ) HWREG( UART0_BASE + UART_O_DR );
xQueueSendFromISR( xCommsQueue, &cRxedChar, &xHigherPriorityTaskWoken );
}
}
}
/* Was a Tx interrupt pending? */
@ -220,7 +154,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
cNextChar++;
}
}
/* If a task was woken by the character being received then we force
a context switch to occur in case the task is of higher priority than
the currently executing task (i.e. the task that this interrupt

View file

@ -20,7 +20,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://aws.amazon.com/freertos
* https://github.com/FreeRTOS
*
*/
@ -37,12 +37,6 @@ void vSerialInit( void );
*/
void vCommsRxTask( void * pvParameters );
/*
* The co-routine that periodically initiates the transmission of the string on
* the UART.
*/
void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
unsigned portBASE_TYPE uxGetCommsStatus( void );
#endif

View file

@ -20,20 +20,15 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://aws.amazon.com/freertos
* https://github.com/FreeRTOS
*
*/
/*
* This demo application creates eight co-routines and four tasks (five
* including the idle task). The co-routines execute as part of the idle task
* hook. The application is limited in size to allow its compilation using
/*
* This demo application creates four tasks (five including the idle task).
* The application is limited in size to allow its compilation using
* the KickStart version of the IAR compiler.
*
* Six of the created co-routines are the standard 'co-routine flash'
* co-routines contained within the Demo/Common/Minimal/crflash.c file and
* documented on the FreeRTOS.org WEB site.
*
* The 'LCD Task' waits on a message queue for messages informing it what and
* where to display text. This is the only task that accesses the LCD
* so mutual exclusion is guaranteed.
@ -42,37 +37,19 @@
* the message queue. The strings are rotated to form a short message and
* are written to the top row of the LCD.
*
* The 'ADC Co-routine' periodically reads the ADC input that is connected to
* the light sensor, forms a short message from the value, and then sends this
* message to the LCD Task using the same message queue. The ADC readings are
* displayed on the bottom row of the LCD.
*
* The eighth co-routine and final task control the transmission and reception
* of a string to UART 0. The co-routine periodically sends the first
* character of the string to the UART, with the UART's TxEnd interrupt being
* used to transmit the remaining characters. The UART's RxEnd interrupt
* receives the characters and places them on a queue to be processed by the
* 'COMs Rx' task. An error is latched should an unexpected character be
* received, or any character be received out of sequence.
*
* A loopback connector is required to ensure that each character transmitted
* A loopback connector is required to ensure that each character transmitted
* on the UART is also received on the same UART. For test purposes the UART
* FIFO's are not utalised in order to maximise the interrupt overhead. Also
* a pseudo random interval is used between the start of each transmission in
* order that the resultant interrupts are more randomly distributed and
* a pseudo random interval is used between the start of each transmission in
* order that the resultant interrupts are more randomly distributed and
* therefore more likely to highlight any problems.
*
* The flash co-routines control LED's zero to four. LED five is toggled each
* time the string is transmitted on the UART. LED six is toggled each time
* the string is CORRECTLY received on the UART. LED seven is latched on
* should an error be detected in any task or co-routine.
*
* In addition the idle task makes repetitive calls to
* vSetAndCheckRegisters(). This simply loads the general purpose registers
* with a known value, then checks each register to ensure the held value is
* still correct. As a low priority task this checking routine is likely to
* get repeatedly swapped in and out. A register being found to contain an
* incorrect value is therefore indicative of an error in the task switching
* In addition the idle task makes repetitive calls to
* vSetAndCheckRegisters(). This simply loads the general purpose registers
* with a known value, then checks each register to ensure the held value is
* still correct. As a low priority task this checking routine is likely to
* get repeatedly swapped in and out. A register being found to contain an
* incorrect value is therefore indicative of an error in the task switching
* mechanism.
*
*/
@ -84,11 +61,9 @@
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "croutine.h"
/* Demo application include files. */
#include "partest.h"
#include "crflash.h"
#include "commstest.h"
/* Library include files. */
@ -102,21 +77,9 @@
#define mainADC_DELAY ( 200 / portTICK_PERIOD_MS )
/* The number of flash co-routines to create. */
#define mainNUM_FLASH_CO_ROUTINES ( 5 )
/* The length of the queue used to send messages to the LCD task. */
#define mainLCD_QUEUE_LEN ( 3 )
/* The priority of the co-routine used to initiate the transmission of the
string on UART 0. */
#define mainTX_CO_ROUTINE_PRIORITY ( 1 )
#define mainADC_CO_ROUTINE_PRIORITY ( 2 )
/* Only one of each co-routine is created so its index is not important. */
#define mainTX_CO_ROUTINE_INDEX ( 0 )
#define mainADC_CO_ROUTINE_INDEX ( 0 )
/* The task priorities. */
#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainMSG_TASK_PRIORITY ( mainLCD_TASK_PRIORITY - 1 )
@ -129,8 +92,7 @@ string on UART 0. */
/* Dimension for the buffer into which the ADC value string is written. */
#define mainMAX_ADC_STRING_LEN 20
/* The LED that is lit should an error be detected in any of the tasks or
co-routines. */
/* The LED that is lit should an error be detected in any of the tasks */
#define mainFAIL_LED ( 7 )
/*-----------------------------------------------------------*/
@ -145,12 +107,6 @@ static void prvLCDTask( void * pvParameters );
*/
static void prvLCDMessageTask( void * pvParameters );
/*
* The co-routine that reads the ADC and sends messages for display on the
* bottom row of the LCD.
*/
static void prvADCCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex );
/*
* Function to simply set a known value into the general purpose registers
* then read them back to ensure they remain set correctly. An incorrect value
@ -159,7 +115,7 @@ static void prvADCCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE u
extern void vSetAndCheckRegisters( void );
/*
* Latch the LED that indicates that an error has occurred.
* Latch the LED that indicates that an error has occurred.
*/
void vSetErrorLED( void );
@ -183,7 +139,7 @@ typedef struct
portBASE_TYPE xRow; /*<< The row on which the message should be displayed. */
} xLCDMessage;
/* Error flag set to pdFAIL if an error is encountered in the tasks/co-routines
/* Error flag set to pdFAIL if an error is encountered in the tasks
defined within this file. */
unsigned portBASE_TYPE uxErrorStatus = pdPASS;
@ -193,7 +149,7 @@ static QueueHandle_t xLCDQueue;
/*-----------------------------------------------------------*/
/*
* Setup the hardware, create the tasks/co-routines, then start the scheduler.
* Setup the hardware, create the tasks, then start the scheduler.
*/
void main( void )
{
@ -203,23 +159,15 @@ void main( void )
/* Setup the ports used by the demo and the clock. */
prvSetupHardware();
/* Create the co-routines that flash the LED's. */
vStartFlashCoRoutines( mainNUM_FLASH_CO_ROUTINES );
/* Create the co-routine that initiates the transmission of characters
on the UART and the task that receives them, as described at the top of
this file. */
xCoRoutineCreate( vSerialTxCoRoutine, mainTX_CO_ROUTINE_PRIORITY, mainTX_CO_ROUTINE_INDEX );
xTaskCreate( vCommsRxTask, "CMS", configMINIMAL_STACK_SIZE, NULL, mainCOMMS_RX_TASK_PRIORITY, NULL );
/* Create the task that waits for messages to display on the LCD, plus the
task and co-routine that send messages for display (as described at the top
task that sends messages for display (as described at the top
of this file. */
xTaskCreate( prvLCDTask, "LCD", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainLCD_TASK_PRIORITY, NULL );
xTaskCreate( prvLCDMessageTask, "MSG", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainMSG_TASK_PRIORITY, NULL );
xCoRoutineCreate( prvADCCoRoutine, mainADC_CO_ROUTINE_PRIORITY, mainADC_CO_ROUTINE_INDEX );
/* Start the scheduler running the tasks and co-routines just created. */
/* Start the scheduler running the tasks just created. */
vTaskStartScheduler();
/* Should not get here unless we did not have enough memory to start the
@ -231,7 +179,7 @@ void main( void )
static void prvLCDMessageTask( void * pvParameters )
{
/* The strings that are written to the LCD. */
char *pcStringsToDisplay[] = {
char *pcStringsToDisplay[] = {
"IAR ",
"Stellaris ",
"Demo ",
@ -239,7 +187,7 @@ char *pcStringsToDisplay[] = {
""
};
QueueHandle_t *pxLCDQueue;
QueueHandle_t *pxLCDQueue;
xLCDMessage xMessageToSend;
portBASE_TYPE xIndex = 0;
@ -251,20 +199,20 @@ portBASE_TYPE xIndex = 0;
for( ;; )
{
/* Wait until it is time to move onto the next string. */
vTaskDelay( mainSTRING_WRITE_DELAY );
vTaskDelay( mainSTRING_WRITE_DELAY );
/* Create the message object to send to the LCD task. */
xMessageToSend.ppcMessageToDisplay = &pcStringsToDisplay[ xIndex ];
xMessageToSend.xRow = mainTOP_ROW;
/* Post the message to be displayed. */
if( !xQueueSend( *pxLCDQueue, ( void * ) &xMessageToSend, 0 ) )
{
uxErrorStatus = pdFAIL;
}
/* Move onto the next message, wrapping when necessary. */
xIndex++;
xIndex++;
if( *( pcStringsToDisplay[ xIndex ] ) == 0x00 )
{
xIndex = 0;
@ -282,7 +230,7 @@ unsigned portBASE_TYPE uxIndex;
QueueHandle_t *pxLCDQueue;
xLCDMessage xReceivedMessage;
char *pcString;
const unsigned char ucCFGData[] = {
const unsigned char ucCFGData[] = {
0x30, /* Set data bus to 8-bits. */
0x30,
0x30,
@ -291,7 +239,7 @@ const unsigned char ucCFGData[] = {
0x01, /* Display clear. */
0x06, /* Entry mode [cursor dir][shift]. */
0x0C /* Display on [display on][curson on][blinking on]. */
};
};
/* To test the parameter passing mechanism, the queue on which messages are
received is passed in as a parameter even though it is available as a file
@ -312,10 +260,10 @@ const unsigned char ucCFGData[] = {
/* Clear display. */
vTaskDelay( mainCHAR_WRITE_DELAY );
prvPDCWrite( PDC_LCD_CSR, LCD_CLEAR );
prvPDCWrite( PDC_LCD_CSR, LCD_CLEAR );
uxIndex = 0;
for( ;; )
for( ;; )
{
/* Wait for a message to arrive. */
if( xQueueReceive( *pxLCDQueue, &xReceivedMessage, portMAX_DELAY ) )
@ -325,67 +273,26 @@ const unsigned char ucCFGData[] = {
/* Where is the string we are going to display? */
pcString = *xReceivedMessage.ppcMessageToDisplay;
while( *pcString )
{
/* Don't write out the string too quickly as LCD's are usually
/* Don't write out the string too quickly as LCD's are usually
pretty slow devices. */
vTaskDelay( mainCHAR_WRITE_DELAY );
prvPDCWrite( PDC_LCD_RAM, *pcString );
pcString++;
}
}
}
}
}
/*-----------------------------------------------------------*/
static void prvADCCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex )
{
static unsigned long ulADCValue;
static char cMessageBuffer[ mainMAX_ADC_STRING_LEN ];
static char *pcMessage;
static xLCDMessage xMessageToSend;
/* Co-routines MUST start with a call to crSTART(). */
crSTART( xHandle );
for( ;; )
{
/* Start an ADC conversion. */
ADCProcessorTrigger( ADC_BASE, 0 );
/* Simply delay - when we unblock the result should be available */
crDELAY( xHandle, mainADC_DELAY );
/* Get the ADC result. */
ADCSequenceDataGet( ADC_BASE, 0, &ulADCValue );
/* Create a string with the result. */
sprintf( cMessageBuffer, "ADC = %d ", ulADCValue );
pcMessage = cMessageBuffer;
/* Configure the message we are going to send for display. */
xMessageToSend.ppcMessageToDisplay = ( char** ) &pcMessage;
xMessageToSend.xRow = mainBOTTOM_ROW;
/* Send the string to the LCD task for display. We are sending
on a task queue so do not have the option to block. */
if( !xQueueSend( xLCDQueue, ( void * ) &xMessageToSend, 0 ) )
{
uxErrorStatus = pdFAIL;
}
}
/* Co-routines MUST end with a call to crEND(). */
crEND();
}
/*-----------------------------------------------------------*/
static void prvSetupHardware( void )
{
/* Setup the PLL. */
SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ );
/* Initialise the hardware used to talk to the LCD, LED's and UART. */
PDCInit();
vParTestInitialise();
@ -418,17 +325,11 @@ void vSetErrorLED( void )
void vApplicationIdleHook( void )
{
/* The co-routines are executed in the idle task using the idle task
hook. */
for( ;; )
{
/* Schedule the co-routines. */
vCoRoutineSchedule();
/* Run the register check function between each co-routine. */
vSetAndCheckRegisters();
/* See if the comms task and co-routine has found any errors. */
/* See if the comms task has found any errors. */
if( uxGetCommsStatus() != pdPASS )
{
vParTestSetLED( mainFAIL_LED, pdTRUE );