mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-01 11:53:53 -04:00
Preparing for maintenance release -
Bug fix - issue introduced in V8.2.2 when the current timer list is empty and the overflow timer list is not empty. Add PIC32MZ EF (floating point) support and update the MZ demo project to test the flop context switching. Improve efficiency of the stack overflow checking. Add CLI to RX71M demo. General tidy up of new RZ and RX projects - including ensuring the UART driver copes with 0 length strings. Add stack overflow checking to the [old] PIC24 demo.
This commit is contained in:
parent
38cb08133d
commit
57cc3389a5
84 changed files with 4972 additions and 1813 deletions
|
@ -41,6 +41,7 @@
|
|||
<option id="com.renesas.cdt.renesas.Compiler.option.deviceShortName.2099068857" name="DeviceShortName" superClass="com.renesas.cdt.renesas.Compiler.option.deviceShortName" value="R5F571MLCxFC" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.renesas.Compiler.option.incFileDirectories.1186627023" name="Include file directories" superClass="com.renesas.cdt.renesas.Compiler.option.incFileDirectories" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${TCINSTALL}/include""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/Full_Demo/FreeRTOS-Plus-CLI}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/Full_Demo/Standard_Demo_Tasks/Include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/FreeRTOS_Source/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/FreeRTOS_Source/portable/Renesas/RX600v2}""/>
|
||||
|
|
|
@ -30,11 +30,26 @@
|
|||
<type>2</type>
|
||||
<locationURI>FREERTOS_ROOT/FreeRTOS/Source</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>src/Full_Demo/FreeRTOS-Plus-CLI</name>
|
||||
<type>2</type>
|
||||
<locationURI>FREERTOS_ROOT/FreeRTOS-Plus/Source/FreeRTOS-Plus-CLI</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>src/Full_Demo/Sample-CLI-commands.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>FREERTOS_ROOT/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>src/Full_Demo/Standard_Demo_Tasks</name>
|
||||
<type>2</type>
|
||||
<locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>src/Full_Demo/UARTCommandConsole.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>FREERTOS_ROOT/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UARTCommandConsole.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>src/Full_Demo/Standard_Demo_Tasks/Include</name>
|
||||
<type>2</type>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<stringAttribute key="com.renesas.cdt.core.optionInitCommands" value=""/>
|
||||
<intAttribute key="com.renesas.cdt.core.portNumber" value="61234"/>
|
||||
<stringAttribute key="com.renesas.cdt.core.runCommands" value=""/>
|
||||
<stringAttribute key="com.renesas.cdt.core.serverParam" value="-g E1 -t R5F571ML -p 61234 -d 61236 -uClockSrcHoco= 0 -uInputClock= 27.0 -uAllowClockSourceInternal= 1 -uUseFine= 0 -uJTagClockFreq= 16.5 -w 0 -z 0 -uRegisterSetting= 0 -uModePin= 0 -uDebugMode= 0 -uExecuteProgram= 0 -uIdCode= FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -b -n 0 -uWorkRamAddress= 1000 -uProgReWriteIRom= 0 -uProgReWriteDFlash= 0 -uPTimerClock= 120000000 -uhookWorkRamAddr= 0x1000 -uhookWorkRamSize= 0x230"/>
|
||||
<stringAttribute key="com.renesas.cdt.core.serverParam" value="-g E1 -t R5F571ML -p 61234 -d 61236 -uClockSrcHoco= 0 -uInputClock= 27.0 -uAllowClockSourceInternal= 1 -uUseFine= 0 -uJTagClockFreq= 16.5 -w 1 -z 0 -uRegisterSetting= 0 -uModePin= 0 -uDebugMode= 0 -uExecuteProgram= 0 -uIdCode= FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -b -n 0 -uWorkRamAddress= 1000 -uProgReWriteIRom= 0 -uProgReWriteDFlash= 0 -uPTimerClock= 120000000 -uhookWorkRamAddr= 0x1000 -uhookWorkRamSize= 0x230"/>
|
||||
<booleanAttribute key="com.renesas.cdt.core.startServer" value="true"/>
|
||||
<stringAttribute key="com.renesas.cdt.core.targetDevice" value="R5F571ML"/>
|
||||
<booleanAttribute key="com.renesas.cdt.core.useRemoteTarget" value="true"/>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<booleanAttribute key="com.renesas.hardwaredebug.e1.allow.clock.source.internal" value="true"/>
|
||||
<intAttribute key="com.renesas.hardwaredebug.e1.clock_source" value="0"/>
|
||||
<stringAttribute key="com.renesas.hardwaredebug.e1.connection.mode" value="0"/>
|
||||
<booleanAttribute key="com.renesas.hardwaredebug.e1.e1_pwr" value="false"/>
|
||||
<booleanAttribute key="com.renesas.hardwaredebug.e1.e1_pwr" value="true"/>
|
||||
<booleanAttribute key="com.renesas.hardwaredebug.e1.enable.hot.plug" value="false"/>
|
||||
<booleanAttribute key="com.renesas.hardwaredebug.e1.enable_external_flash" value="false"/>
|
||||
<booleanAttribute key="com.renesas.hardwaredebug.e1.execute.program" value="false"/>
|
||||
|
@ -84,7 +84,7 @@
|
|||
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="3"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\RX700_RX71M_Renesas_e2studio\HardwareDebug\RTOSDemo.x"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\RX700_RX71M_RSK_Renesas_e2studio\HardwareDebug\RTOSDemo.x"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value="0"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true"/>
|
||||
|
@ -95,7 +95,7 @@
|
|||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\RX700_RX71M_Renesas_e2studio\HardwareDebug\RTOSDemo.x"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value="C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\RX700_RX71M_RSK_Renesas_e2studio\HardwareDebug\RTOSDemo.x"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value="0"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
|
||||
|
|
|
@ -84,24 +84,14 @@
|
|||
*
|
||||
* The Queue Send Task:
|
||||
* The queue send task is implemented by the prvQueueSendTask() function in
|
||||
* this file. prvQueueSendTask() sits in a loop that causes it to repeatedly
|
||||
* block for 200 milliseconds, before sending the value 100 to the queue that
|
||||
* was created within main_blinky(). Once the value is sent, the task loops
|
||||
* back around to block for another 200 milliseconds...and so on.
|
||||
* this file. It sends the value 100 to the queue every 200 milliseconds.
|
||||
*
|
||||
* The Queue Receive Task:
|
||||
* The queue receive task is implemented by the prvQueueReceiveTask() function
|
||||
* in this file. prvQueueReceiveTask() sits in a loop where it repeatedly
|
||||
* blocks on attempts to read data from the queue that was created within
|
||||
* main_blinky(). When data is received, the task checks the value of the
|
||||
* data, and if the value equals the expected 100, toggles an LED. The 'block
|
||||
* time' parameter passed to the queue receive function specifies that the
|
||||
* task should be held in the Blocked state indefinitely to wait for data to
|
||||
* be available on the queue. The queue receive task will only leave the
|
||||
* Blocked state when the queue send task writes to the queue. As the queue
|
||||
* send task writes to the queue every 200 milliseconds, the queue receive
|
||||
* task leaves the Blocked state every 200 milliseconds, and therefore toggles
|
||||
* the LED every 200 milliseconds.
|
||||
* in this file. It blocks on the queue to wait for data to arrive from the
|
||||
* queue send task - toggling the LED each time it receives the value 100. The
|
||||
* queue send task writes to the queue every 200ms, so the LED should toggle
|
||||
* every 200ms.
|
||||
*/
|
||||
|
||||
/* Kernel includes. */
|
||||
|
@ -120,7 +110,7 @@
|
|||
|
||||
/* The rate at which data is sent to the queue. The 200ms value is converted
|
||||
to ticks using the portTICK_PERIOD_MS constant. */
|
||||
#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS )
|
||||
#define mainQUEUE_SEND_FREQUENCY_MS ( pdMS_TO_TICKS( 200UL ) )
|
||||
|
||||
/* The number of items the queue can hold. This is 1 as the receive task
|
||||
will remove items as they are added, meaning the send task should always find
|
||||
|
|
|
@ -88,11 +88,11 @@
|
|||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configCPU_CLOCK_HZ ( 120000000UL ) /*_RB_ guess cg shows 240 and 120*/
|
||||
#define configPERIPHERAL_CLOCK_HZ ( 60000000UL ) /*_RB_ guess*/
|
||||
#define configCPU_CLOCK_HZ ( 120000000UL )
|
||||
#define configPERIPHERAL_CLOCK_HZ ( 60000000UL )
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 140 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 40 * 1024 ) )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 120 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 50 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
|
@ -110,6 +110,12 @@
|
|||
#define configMAX_PRIORITIES ( 7 )
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
format the raw data provided by the uxTaskGetSystemState() function in to human
|
||||
readable ASCII form. See the notes in the implementation of vTaskList() within
|
||||
FreeRTOS/Source/tasks.c for limitations. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
||||
/* Software timer definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
|
@ -148,6 +154,12 @@ to exclude the API function. */
|
|||
void vAssertCalled( void );
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) { brk(); taskDISABLE_INTERRUPTS(); for( ;; ); }
|
||||
|
||||
/* The buffer into which output generated by FreeRTOS+CLI is placed. This must
|
||||
be at least big enough to contain the output of the task-stats command, as the
|
||||
example implementation does not include buffer overlow checking. */
|
||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 3500
|
||||
#define configINCLUDE_QUERY_HEAP_COMMAND 1
|
||||
|
||||
/* Override some of the priorities set in the common demo tasks. This is
|
||||
required to ensure flase positive timing errors are not reported. */
|
||||
#define bktPRIMARY_PRIORITY ( configMAX_PRIORITIES - 3 )
|
||||
|
@ -155,28 +167,4 @@ required to ensure flase positive timing errors are not reported. */
|
|||
#define intqHIGHER_PRIORITY ( configMAX_PRIORITIES - 3 )
|
||||
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Ethernet configuration.
|
||||
*-----------------------------------------------------------*/
|
||||
|
||||
/* MAC address configuration. */
|
||||
#define configMAC_ADDR0 0x00
|
||||
#define configMAC_ADDR1 0x12
|
||||
#define configMAC_ADDR2 0x13
|
||||
#define configMAC_ADDR3 0x10
|
||||
#define configMAC_ADDR4 0x15
|
||||
#define configMAC_ADDR5 0x11
|
||||
|
||||
/* IP address configuration. */
|
||||
#define configIP_ADDR0 192
|
||||
#define configIP_ADDR1 168
|
||||
#define configIP_ADDR2 0
|
||||
#define configIP_ADDR3 200
|
||||
|
||||
/* Netmask configuration. */
|
||||
#define configNET_MASK0 255
|
||||
#define configNET_MASK1 255
|
||||
#define configNET_MASK2 255
|
||||
#define configNET_MASK3 0
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
|
|
|
@ -68,9 +68,9 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* This file contains the non-portable and therefore RX62N specific parts of
|
||||
* the IntQueue standard demo task - namely the configuration of the timers
|
||||
* that generate the interrupts and the interrupt entry points.
|
||||
* This file contains the non-portable and therefore RX specific parts of the
|
||||
* IntQueue standard demo task - namely the configuration of the timers that
|
||||
* generate the interrupts and the interrupt entry points.
|
||||
*/
|
||||
|
||||
/* Scheduler includes. */
|
||||
|
@ -92,6 +92,7 @@ void vInitialiseTimerForIntQueueTest( void )
|
|||
/* Ensure interrupts do not start until full configuration is complete. */
|
||||
portENTER_CRITICAL();
|
||||
{
|
||||
/* Give write access. */
|
||||
SYSTEM.PRCR.WORD = 0xa502;
|
||||
|
||||
/* Cascade two 8bit timer channels to generate the interrupts.
|
||||
|
@ -130,11 +131,9 @@ void vInitialiseTimerForIntQueueTest( void )
|
|||
TMR0.TCR.BIT.CMIEA = 1;
|
||||
TMR2.TCR.BIT.CMIEA = 1;
|
||||
|
||||
/* Map TMR0 CMIA0 interrupt to vector slot B number 128 and set
|
||||
priority above the kernel's priority, but below the max syscall
|
||||
priority. */
|
||||
ICU.SLIBXR128.BYTE = 3; /* Three is TMR0 compare match A. */
|
||||
IPR( PERIB, INTB128 ) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 1;
|
||||
/* Set priority and enable interrupt. */
|
||||
ICU.SLIBXR128.BYTE = 3; /* Three is TMR0 compare match A. */
|
||||
IPR( PERIB, INTB128 ) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 1;
|
||||
IEN( PERIB, INTB128 ) = 1;
|
||||
|
||||
/* Ensure that the flag is set to 0, otherwise the interrupt will not be
|
||||
|
@ -142,8 +141,8 @@ void vInitialiseTimerForIntQueueTest( void )
|
|||
IR( PERIB, INTB128 ) = 0;
|
||||
|
||||
/* Do the same for TMR2, but to vector 129. */
|
||||
ICU.SLIBXR129.BYTE = 9; /* Nine is TMR2 compare match A. */
|
||||
IPR( PERIB, INTB129 ) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 2;
|
||||
ICU.SLIBXR129.BYTE = 9; /* Nine is TMR2 compare match A. */
|
||||
IPR( PERIB, INTB129 ) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 2;
|
||||
IEN( PERIB, INTB129 ) = 1;
|
||||
IR( PERIB, INTB129 ) = 0;
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@
|
|||
#define INT_QUEUE_TIMER_H
|
||||
|
||||
void vInitialiseTimerForIntQueueTest( void );
|
||||
portBASE_TYPE xTimer0Handler( void );
|
||||
portBASE_TYPE xTimer1Handler( void );
|
||||
BaseType_t xTimer0Handler( void );
|
||||
BaseType_t xTimer1Handler( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* main_full() creates all the demo application tasks and software timers, then
|
||||
* main_full() creates a set of demo application tasks and software timers, then
|
||||
* starts the scheduler. The web documentation provides more details of the
|
||||
* standard demo application tasks, which provide no particular functionality,
|
||||
* but do provide a good example of how to use the FreeRTOS API.
|
||||
|
@ -89,6 +89,12 @@
|
|||
* In addition to the standard demo tasks, the following tasks and tests are
|
||||
* defined and/or created within this file:
|
||||
*
|
||||
* "FreeRTOS+CLI command console" - The command console uses SCI1 for its
|
||||
* input and output. The baud rate is set to 19200. Type "help" to see a list
|
||||
* of registered commands. The FreeRTOS+CLI license is different to the
|
||||
* FreeRTOS license, see http://www.FreeRTOS.org/cli for license and usage
|
||||
* details.
|
||||
*
|
||||
* "Reg test" tasks - These fill both the core and floating point registers with
|
||||
* known values, then check that each register maintains its expected value for
|
||||
* the lifetime of the task. Each task uses a different set of values. The reg
|
||||
|
@ -97,19 +103,17 @@
|
|||
* error in the context switching mechanism.
|
||||
*
|
||||
* "Check" task - The check task period is initially set to three seconds. The
|
||||
* task checks that all the standard demo tasks, and the register check tasks,
|
||||
* are not only still executing, but are executing without reporting any errors.
|
||||
* If the check task discovers that a task has either stalled, or reported an
|
||||
* error, then it changes its own execution period from the initial three
|
||||
* seconds, to just 200ms. The check task also toggles an LED each time it is
|
||||
* called. This provides a visual indication of the system status: If the LED
|
||||
* toggles every three seconds, then no issues have been discovered. If the LED
|
||||
* toggles every 200ms, then an issue has been discovered with at least one
|
||||
* task.
|
||||
* task checks that all the standard demo tasks are not only still executing,
|
||||
* but are executing without reporting any errors. If the check task discovers
|
||||
* that a task has either stalled, or reported an error, then it changes its own
|
||||
* execution period from the initial three seconds, to just 200ms. The check
|
||||
* task also toggles an LED on each iteration of its loop. This provides a
|
||||
* visual indication of the system status: If the LED toggles every three
|
||||
* seconds, then no issues have been discovered. If the LED toggles every
|
||||
* 200ms, then an issue has been discovered with at least one task.
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <rskrx71mdef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Kernel includes. */
|
||||
|
@ -139,6 +143,7 @@
|
|||
#include "IntSemTest.h"
|
||||
|
||||
/* Renesas includes. */
|
||||
#include <rskrx71mdef.h>
|
||||
#include "r_cg_macrodriver.h"
|
||||
#include "r_cg_userdefine.h"
|
||||
|
||||
|
@ -148,30 +153,26 @@
|
|||
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3UL )
|
||||
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainUART_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3UL )
|
||||
#define mainCOM_TEST_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY )
|
||||
|
||||
/* The priority used by the UART command console task. */
|
||||
#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
|
||||
|
||||
/* A block time of zero simply means "don't block". */
|
||||
#define mainDONT_BLOCK ( 0UL )
|
||||
|
||||
/* The period after which the check timer will expire, in ms, provided no errors
|
||||
have been reported by any of the standard demo tasks. ms are converted to the
|
||||
equivalent in ticks using the portTICK_PERIOD_MS constant. */
|
||||
#define mainNO_ERROR_CHECK_TASK_PERIOD ( 3000UL / portTICK_PERIOD_MS )
|
||||
#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 3000UL )
|
||||
|
||||
/* The period at which the check timer will expire, in ms, if an error has been
|
||||
reported in one of the standard demo tasks. ms are converted to the equivalent
|
||||
in ticks using the portTICK_PERIOD_MS constant. */
|
||||
#define mainERROR_CHECK_TASK_PERIOD ( 200UL / portTICK_PERIOD_MS )
|
||||
#define mainERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 200UL )
|
||||
|
||||
/* Parameters that are passed into the register check tasks solely for the
|
||||
purpose of ensuring parameters are passed into tasks correctly. */
|
||||
#define mainREG_TEST_1_PARAMETER ( ( void * ) 0x12121212UL )
|
||||
#define mainREG_TEST_2_PARAMETER ( ( void * ) 0x12345678UL )
|
||||
#define mainREG_TEST_1_PARAMETER ( ( void * ) 0x12121212UL )
|
||||
#define mainREG_TEST_2_PARAMETER ( ( void * ) 0x12345678UL )
|
||||
|
||||
/* The base period used by the timer test tasks. */
|
||||
#define mainTIMER_TEST_PERIOD ( 50 )
|
||||
|
@ -212,6 +213,17 @@ static void prvRegTest2Implementation( void );
|
|||
*/
|
||||
static void prvPseudoRandomiser( void *pvParameters );
|
||||
|
||||
/*
|
||||
* Register commands that can be used with FreeRTOS+CLI. The commands are
|
||||
* defined in CLI-Commands.c and File-Related-CLI-Command.c respectively.
|
||||
*/
|
||||
extern void vRegisterSampleCLICommands( void );
|
||||
|
||||
/*
|
||||
* The task that manages the FreeRTOS+CLI input and output.
|
||||
*/
|
||||
extern void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The following two variables are used to communicate the status of the
|
||||
|
@ -220,9 +232,6 @@ then the register check tasks have not discovered any errors. If a variable
|
|||
stops incrementing, then an error has been found. */
|
||||
volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;
|
||||
|
||||
/* String for display in the web server. It is set to an error message if the
|
||||
check task detects an error. */
|
||||
const char *pcStatusMessage = "All tasks running without error";
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void main_full( void )
|
||||
|
@ -250,7 +259,14 @@ void main_full( void )
|
|||
xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );
|
||||
|
||||
/* Create the task that just adds a little random behaviour. */
|
||||
xTaskCreate( prvPseudoRandomiser, "Rnd", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
|
||||
xTaskCreate( prvPseudoRandomiser, "Rnd", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 2, NULL );
|
||||
|
||||
/* Start the tasks that implements the command console on the UART, as
|
||||
described above. */
|
||||
vUARTCommandConsoleStart( mainUART_COMMAND_CONSOLE_STACK_SIZE, mainUART_COMMAND_CONSOLE_TASK_PRIORITY );
|
||||
|
||||
/* Register the standard CLI commands. */
|
||||
vRegisterSampleCLICommands();
|
||||
|
||||
/* Create the task that performs the 'check' functionality, as described at
|
||||
the top of this file. */
|
||||
|
@ -404,7 +420,6 @@ unsigned long ulErrorFound = pdFALSE;
|
|||
gone wrong (it might just be that the loop back connector required
|
||||
by the comtest tasks has not been fitted). */
|
||||
xDelayPeriod = mainERROR_CHECK_TASK_PERIOD;
|
||||
pcStatusMessage = "Error found in at least one task.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -412,7 +427,7 @@ unsigned long ulErrorFound = pdFALSE;
|
|||
|
||||
static void prvPseudoRandomiser( void *pvParameters )
|
||||
{
|
||||
const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL, ulMinDelay = ( 35 / portTICK_PERIOD_MS );
|
||||
const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL, ulMinDelay = pdMS_TO_TICKS( 35 );
|
||||
volatile uint32_t ulNextRand = ( uint32_t ) &pvParameters, ulValue;
|
||||
|
||||
/* This task does nothing other than ensure there is a little bit of
|
||||
|
|
|
@ -30,6 +30,16 @@
|
|||
Pragma directive
|
||||
***********************************************************************************************************************/
|
||||
/* Start user code for pragma. Do not edit comment generated here */
|
||||
|
||||
|
||||
/*
|
||||
* This file originated from an example project for the RSK - it has been
|
||||
* adapted to allow it to be used in the FreeRTOS demo. Functions required by
|
||||
* UARTCommandConsole.c have been added.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
|
@ -38,6 +48,11 @@ Includes
|
|||
#include "r_cg_macrodriver.h"
|
||||
#include "r_cg_sci.h"
|
||||
/* Start user code for include. Do not edit comment generated here */
|
||||
#include "rskrx71mdef.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "serial.h"
|
||||
/* End user code. Do not edit comment generated here */
|
||||
#include "r_cg_userdefine.h"
|
||||
|
||||
|
@ -50,7 +65,6 @@ extern uint8_t * gp_sci7_rx_address; /* SCI7 receive buffer addre
|
|||
extern uint16_t g_sci7_rx_count; /* SCI7 receive data number */
|
||||
extern uint16_t g_sci7_rx_length; /* SCI7 receive data length */
|
||||
/* Start user code for global. Do not edit comment generated here */
|
||||
/* Flag used locally to detect transmission complete */
|
||||
|
||||
/* Global used to receive a character from the PC terminal */
|
||||
uint8_t g_rx_char;
|
||||
|
@ -58,8 +72,21 @@ uint8_t g_rx_char;
|
|||
/* Flag used to control transmission to PC terminal */
|
||||
volatile uint8_t g_tx_flag = FALSE;
|
||||
|
||||
/* Flag used locally to detect transmission complete */
|
||||
static volatile uint8_t sci6_txdone;
|
||||
/* Characters received from the UART are stored in this queue, ready to be
|
||||
received by the application. ***NOTE*** Using a queue in this way is very
|
||||
convenient, but also very inefficient. It can be used here because characters
|
||||
will only arrive slowly. In a higher bandwidth system a circular RAM buffer or
|
||||
DMA should be used in place of this queue. */
|
||||
static QueueHandle_t xRxQueue = NULL;
|
||||
|
||||
/* When a task calls vSerialPutString() its handle is stored in xSendingTask,
|
||||
before being placed into the Blocked state (so does not use any CPU time) to
|
||||
wait for the transmission to end. The task handle is then used from the UART
|
||||
transmit end interrupt to remove the task from the Blocked state. */
|
||||
static TaskHandle_t xSendingTask = NULL;
|
||||
|
||||
/* Flag used locally to detect transmission complete. This is used by the
|
||||
auto generated API only. */
|
||||
static volatile uint8_t sci7_txdone;
|
||||
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
@ -98,7 +125,7 @@ static void r_sci7_transmit_interrupt(void)
|
|||
***********************************************************************************************************************/
|
||||
void r_sci7_transmitend_interrupt(void)
|
||||
{
|
||||
/* Set TXD7 pin */
|
||||
MPC.P90PFS.BYTE = 0x00U;
|
||||
PORT9.PMR.BYTE &= 0xFEU;
|
||||
SCI7.SCR.BIT.TIE = 0U;
|
||||
SCI7.SCR.BIT.TE = 0U;
|
||||
|
@ -158,8 +185,20 @@ void r_sci7_receiveerror_interrupt(void)
|
|||
static void r_sci7_callback_transmitend(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
/* The sci7_txdone flag is used by the auto generated API only. */
|
||||
sci7_txdone = TRUE;
|
||||
|
||||
if( xSendingTask != NULL )
|
||||
{
|
||||
/* A task is waiting for the end of the Tx, unblock it now.
|
||||
http://www.freertos.org/vTaskNotifyGiveFromISR.html */
|
||||
vTaskNotifyGiveFromISR( xSendingTask, &xHigherPriorityTaskWoken );
|
||||
xSendingTask = NULL;
|
||||
|
||||
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||
}
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
|
@ -171,15 +210,30 @@ static void r_sci7_callback_transmitend(void)
|
|||
static void r_sci7_callback_receiveend(void)
|
||||
{
|
||||
/* Start user code. Do not edit comment generated here */
|
||||
/* Check the contents of g_rx_char */
|
||||
if (('c' == g_rx_char) || ('C' == g_rx_char))
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
configASSERT( xRxQueue );
|
||||
|
||||
/* Transmitting generates an interrupt for each character, which consumes
|
||||
CPU time, and can cause standard demo RTOS tasks that monitor their own
|
||||
performance to fail asserts - so don't receive new CLI commands if a
|
||||
transmit is not already in progress. */
|
||||
if( sci7_txdone == TRUE )
|
||||
{
|
||||
//_RB_ g_adc_trigger = TRUE;
|
||||
/* Characters received from the UART are stored in this queue, ready to be
|
||||
received by the application. ***NOTE*** Using a queue in this way is very
|
||||
convenient, but also very inefficient. It can be used here because
|
||||
characters will only arrive slowly. In a higher bandwidth system a circular
|
||||
RAM buffer or DMA should be used in place of this queue. */
|
||||
xQueueSendFromISR( xRxQueue, &g_rx_char, &xHigherPriorityTaskWoken );
|
||||
}
|
||||
|
||||
/* Set up SCI7 receive buffer and callback function again */
|
||||
/* Set up SCI7 receive buffer again */
|
||||
R_SCI7_Serial_Receive((uint8_t *)&g_rx_char, 1);
|
||||
|
||||
/* See http://www.freertos.org/xQueueOverwriteFromISR.html for information
|
||||
on the semantics of this ISR. */
|
||||
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||
/* End user code. Do not edit comment generated here */
|
||||
}
|
||||
/***********************************************************************************************************************
|
||||
|
@ -228,5 +282,91 @@ MD_STATUS R_SCI7_AsyncTransmit (uint8_t * const tx_buf, const uint16_t tx_num)
|
|||
* End of function R_SCI7_AsyncTransmit
|
||||
*******************************************************************************/
|
||||
|
||||
/* Function required in order to link UARTCommandConsole.c - which is used by
|
||||
multiple different demo application. */
|
||||
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||
{
|
||||
( void ) ulWantedBaud;
|
||||
( void ) uxQueueLength;
|
||||
|
||||
/* Characters received from the UART are stored in this queue, ready to be
|
||||
received by the application. ***NOTE*** Using a queue in this way is very
|
||||
convenient, but also very inefficient. It can be used here because
|
||||
characters will only arrive slowly. In a higher bandwidth system a circular
|
||||
RAM buffer or DMA should be used in place of this queue. */
|
||||
xRxQueue = xQueueCreate( uxQueueLength, sizeof( char ) );
|
||||
configASSERT( xRxQueue );
|
||||
|
||||
/* Set up SCI1 receive buffer */
|
||||
R_SCI7_Serial_Receive((uint8_t *) &g_rx_char, 1);
|
||||
|
||||
/* Ensure the interrupt priority is at or below
|
||||
configMAX_SYSCALL_INTERRUPT_PRIORITY. */
|
||||
IPR(SCI7, RXI7) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 1;
|
||||
IPR(SCI7, TXI7) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 1;
|
||||
IPR(ICU,GROUPBL0) = configMAX_SYSCALL_INTERRUPT_PRIORITY - 1;
|
||||
|
||||
/* Enable SCI1 operations */
|
||||
R_SCI7_Start();
|
||||
|
||||
/* Only one UART is supported, so it doesn't matter what is returned
|
||||
here. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Function required in order to link UARTCommandConsole.c - which is used by
|
||||
multiple different demo application. */
|
||||
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
|
||||
{
|
||||
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 5000 );
|
||||
|
||||
/* Only one port is supported. */
|
||||
( void ) pxPort;
|
||||
|
||||
/* Clear the flag before initiating a new transmission */
|
||||
sci7_txdone = FALSE;
|
||||
|
||||
/* Don't send the string unless the previous string has been sent. */
|
||||
if( ( xSendingTask == NULL ) && ( usStringLength > 0 ) )
|
||||
{
|
||||
/* Ensure the calling task's notification state is not already
|
||||
pending. */
|
||||
vTaskNotifyStateClear( NULL );
|
||||
|
||||
/* Store the handle of the transmitting task. This is used to unblock
|
||||
the task when the transmission has completed. */
|
||||
xSendingTask = xTaskGetCurrentTaskHandle();
|
||||
|
||||
/* Send the string using the auto-generated API. */
|
||||
R_SCI7_Serial_Send( ( uint8_t * ) pcString, usStringLength );
|
||||
|
||||
/* Wait in the Blocked state (so not using any CPU time) until the
|
||||
transmission has completed. */
|
||||
ulTaskNotifyTake( pdTRUE, xMaxBlockTime );
|
||||
}
|
||||
}
|
||||
|
||||
/* Function required in order to link UARTCommandConsole.c - which is used by
|
||||
multiple different demo application. */
|
||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, TickType_t xBlockTime )
|
||||
{
|
||||
/* Only one UART is supported. */
|
||||
( void ) pxPort;
|
||||
|
||||
/* Return a received character, if any are available. Otherwise block to
|
||||
wait for a character. */
|
||||
return xQueueReceive( xRxQueue, pcRxedChar, xBlockTime );
|
||||
}
|
||||
|
||||
/* Function required in order to link UARTCommandConsole.c - which is used by
|
||||
multiple different demo application. */
|
||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime )
|
||||
{
|
||||
/* Just mapped to vSerialPutString() so the block time is not used. */
|
||||
( void ) xBlockTime;
|
||||
|
||||
vSerialPutString( pxPort, &cOutChar, sizeof( cOutChar ) );
|
||||
return pdPASS;
|
||||
}
|
||||
|
||||
/* End user code. Do not edit comment generated here */
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
|
||||
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
|
||||
or 0 to run the more comprehensive test and demo application. */
|
||||
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
|
||||
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -141,6 +141,7 @@ int main( void )
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Should never get reached. */
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -202,6 +203,7 @@ volatile size_t xFreeHeapSpace;
|
|||
|
||||
void vApplicationTickHook( void )
|
||||
{
|
||||
/* The tick hook is not used by the blinky demo, but is by the full demo. */
|
||||
#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0
|
||||
{
|
||||
extern void vFullDemoTickHook( void );
|
||||
|
@ -213,7 +215,9 @@ void vApplicationTickHook( void )
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The RX port uses this callback function to configure its tick interrupt.
|
||||
This allows the application to choose the tick interrupt source. */
|
||||
This allows the application to choose the tick interrupt source.
|
||||
***NOTE***: configTICK_VECTOR must be set in FreeRTOSConfig.h to be correct for
|
||||
whichever vector is used. */
|
||||
void vApplicationSetupTimerInterrupt( void )
|
||||
{
|
||||
const uint32_t ulEnableRegisterWrite = 0xA50BUL, ulDisableRegisterWrite = 0xA500UL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue