Complete large memory model MSP430FR5969 demo - including CLI and run-time stats.

This commit is contained in:
Richard Barry
2015-04-24 11:34:19 +00:00
parent 91b249d24b
commit 34a7b0431b
7 changed files with 1021 additions and 83 deletions

View File

@ -84,11 +84,12 @@
/* The array used as the heap is declared by the application to allow the
__persistent keyword to be used. See http://www.freertos.org/a00111.html#heap_4 */
#define configAPPLICATION_ALLOCATED_HEAP 1
#define configUSE_PREEMPTION 1
#define configMAX_PRIORITIES ( 5 )
#define configCPU_CLOCK_HZ ( 8000000 )
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
#define configTOTAL_HEAP_SIZE ( 5 * 1024 )
#define configTOTAL_HEAP_SIZE ( 20 * 1024 )
#define configMAX_TASK_NAME_LEN ( 15 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
@ -110,22 +111,31 @@ __persistent keyword to be used. See http://www.freertos.org/a00111.html#heap_4
#endif
/* Hook function related definitions. */
#define configUSE_TICK_HOOK 0
#define configUSE_TICK_HOOK 1
#define configUSE_IDLE_HOOK 0
#define configUSE_MALLOC_FAILED_HOOK 1
#define configCHECK_FOR_STACK_OVERFLOW 2
/* Software timer related definitions. */
#define configUSE_TIMERS 0
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH 5
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
/* Event group related definitions. */
#define configUSE_EVENT_GROUPS 0
/* Prevent the following line being included from asm files. */
#ifdef __ICC430__
void vConfigureTimerForRunTimeStats( void );
#endif
/* Run time stats gathering definitions. */
#define configGENERATE_RUN_TIME_STATS 0
extern volatile uint32_t ulRunTimeCounterOverflows;
#define configGENERATE_RUN_TIME_STATS 1
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
/* Return the current timer counter value + the overflow counter. */
#define portGET_RUN_TIME_COUNTER_VALUE() ( ( ( uint32_t ) TA1R ) + ulRunTimeCounterOverflows )
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
@ -147,12 +157,13 @@ left at 1 with no impact on the code size. */
#define INCLUDE_xTaskGetIdleTaskHandle 1
#define INCLUDE_xQueueGetMutexHolder 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xEventGroupSetBitFromISR 0
#define INCLUDE_xTimerPendFunctionCall 0
#define INCLUDE_xEventGroupSetBitFromISR 1
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_pcTaskGetTaskName 1
/* Not using stats, so no need to include the formatting functions. */
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
/* Include functions that format system and run-time stats into human readable
tables. */
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
/* Assert call defined for debug builds. */
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
@ -165,5 +176,22 @@ vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this
case configTICK__VECTOR is set to TIMER0_A0_VECTOR. */
#define configTICK_VECTOR TIMER0_A0_VECTOR
/* The size of the buffer used by the CLI to place output generated by the CLI.
WARNING: By default there is no overflow checking when writing to this
buffer. */
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 1500
/* The __persistent qualifier is needed on the buffer used to hold CLI output,
so the buffer must be declared in application code, rather than in
FreeRTOS_CLI.c. */
#define configAPPLICATION_PROVIDES_cOutputBuffer 1
/* Include the command that queries the amount of free heap remaining in the
CLI. */
#define configINCLUDE_QUERY_HEAP_COMMAND 1
/* The baudrate used for the CLI. */
#define configCLI_BAUD_RATE 19200
#endif /* FREERTOS_CONFIG_H */

View File

@ -0,0 +1,213 @@
/*
FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
#include "msp430.h"
#include "FreeRTOSConfig.h"
#include "data_model.h"
/*
* The definition of the "register test" tasks, as described at the top of
* main.c
*/
IMPORT usRegTest1LoopCounter
IMPORT usRegTest2LoopCounter
IMPORT vPortYield
EXPORT vRegTest1Implementation
EXPORT vRegTest2Implementation
RSEG CODE
EVEN
vRegTest1Implementation:
/* Fill each general purpose register with a known value. */
mov_x #0x4444, r4
mov_x #0x5555, r5
mov_x #0x6666, r6
mov_x #0x7777, r7
mov_x #0x8888, r8
mov_x #0x9999, r9
mov_x #0xaaaa, r10
mov_x #0xbbbb, r11
mov_x #0xcccc, r12
mov_x #0xdddd, r13
mov_x #0xeeee, r14
mov_x #0xffff, r15
prvRegTest1Loop:
/* Test each general purpose register to check that it still contains the
expected known value, jumping to vRegTest1Error if any register contains
an unexpected value. */
cmp_x #0x4444, r4
jne vRegTest1Error
cmp_x #0x5555, r5
jne vRegTest1Error
cmp_x #0x6666, r6
jne vRegTest1Error
cmp_x #0x7777, r7
jne vRegTest1Error
cmp_x #0x8888, r8
jne vRegTest1Error
cmp_x #0x9999, r9
jne vRegTest1Error
cmp_x #0xaaaa, r10
jne vRegTest1Error
cmp_x #0xbbbb, r11
jne vRegTest1Error
cmp_x #0xcccc, r12
jne vRegTest1Error
cmp_x #0xdddd, r13
jne vRegTest1Error
cmp_x #0xeeee, r14
jne vRegTest1Error
cmp_x #0xffff, r15
jne vRegTest1Error
/* This task is still running without jumping to vRegTest1Error, so increment
the loop counter so the check task knows the task is running error free. */
incx.w &usRegTest1LoopCounter
/* Loop again, performing the same tests. */
jmp prvRegTest1Loop
nop
EVEN
vRegTest1Error:
jmp vRegTest1Error
nop
/*-----------------------------------------------------------*/
/* See the comments in vRegTest1Implementation. This task is the same, it just uses
different values in its registers. */
vRegTest2Implementation:
mov_x #0x4441, r4
mov_x #0x5551, r5
mov_x #0x6661, r6
mov_x #0x7771, r7
mov_x #0x8881, r8
mov_x #0x9991, r9
mov_x #0xaaa1, r10
mov_x #0xbbb1, r11
mov_x #0xccc1, r12
mov_x #0xddd1, r13
mov_x #0xeee1, r14
mov_x #0xfff1, r15
prvRegTest2Loop:
cmp_x #0x4441, r4
jne vRegTest2Error
cmp_x #0x5551, r5
jne vRegTest2Error
cmp_x #0x6661, r6
jne vRegTest2Error
cmp_x #0x7771, r7
jne vRegTest2Error
cmp_x #0x8881, r8
jne vRegTest2Error
cmp_x #0x9991, r9
jne vRegTest2Error
cmp_x #0xaaa1, r10
jne vRegTest2Error
cmp_x #0xbbb1, r11
jne vRegTest2Error
cmp_x #0xccc1, r12
jne vRegTest2Error
cmp_x #0xddd1, r13
jne vRegTest2Error
cmp_x #0xeee1, r14
jne vRegTest2Error
cmp_x #0xfff1, r15
jne vRegTest2Error
/* Also perform a manual yield, just to increase the scope of the test. */
calla #vPortYield
incx.w &usRegTest2LoopCounter
jmp prvRegTest2Loop
nop
vRegTest2Error:
jmp vRegTest2Error
nop
/*-----------------------------------------------------------*/
END

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,248 @@
/*
FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
/* BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER.
*
* This is not a proper UART driver. It only supports one port, and is not
* intended to show an efficient implementation as queues are used to pass
* individual characters one at a time! This is ok for a slow interface, such
* as a command line interface (which this driver is used for), but is too
* inefficient for higher bandwidth applications.
*/
/* Standard includes. */
#include <stdlib.h>
/* Scheduler includes. */
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
/* Demo application includes. */
#include "serial.h"
/* TI includes. */
#include "driverlib.h"
/* Misc. constants. */
#define serNO_BLOCK ( ( TickType_t ) 0 )
/* The queue used to hold received characters. */
static QueueHandle_t xRxedChars;
/* The queue used to hold characters waiting transmission. */
static QueueHandle_t xCharsForTx;
/*-----------------------------------------------------------*/
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, UBaseType_t uxQueueLength )
{
unsigned long ulBaudRateCount;
/* Initialise the hardware. */
/* Generate the baud rate constants for the wanted baud rate. */
ulBaudRateCount = configCPU_CLOCK_HZ / ulWantedBaud;
portENTER_CRITICAL();
{
/* Create the queues used by the com test task. */
xRxedChars = xQueueCreate( uxQueueLength, ( UBaseType_t ) sizeof( signed char ) );
xCharsForTx = xQueueCreate( uxQueueLength, ( UBaseType_t ) sizeof( signed char ) );
/* Reset UART. */
UCA0CTL1 |= UCSWRST;
/* Use SMCLK. */
UCA0CTL1 = UCSSEL0 | UCSSEL1;
/* Setup baud rate low byte. */
UCA0BR0 = ( unsigned char ) ( ulBaudRateCount & ( unsigned long ) 0xff );
/* Setup baud rate high byte. */
ulBaudRateCount >>= 8UL;
UCA0BR1 = ( unsigned char ) ( ulBaudRateCount & ( unsigned long ) 0xff );
/* Enable interrupts. */
UCA0IE |= UCRXIE;
/* Take out of reset. */
UCA0CTL1 &= ~UCSWRST;
}
portEXIT_CRITICAL();
/* Note the comments at the top of this file about this not being a generic
UART driver. */
return NULL;
}
/*-----------------------------------------------------------*/
BaseType_t xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, TickType_t xBlockTime )
{
/* Get the next character from the buffer. Return false if no characters
are available, or arrive before xBlockTime expires. */
if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) )
{
return pdTRUE;
}
else
{
return pdFALSE;
}
}
/*-----------------------------------------------------------*/
BaseType_t xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime )
{
BaseType_t xReturn;
/* Send the next character to the queue of characters waiting transmission,
then enable the UART Tx interrupt, just in case UART transmission has already
completed and switched itself off. */
xReturn = xQueueSend( xCharsForTx, &cOutChar, xBlockTime );
UCA0IE |= UCTXIE;
return xReturn;
}
/*-----------------------------------------------------------*/
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
{
UBaseType_t uxChar;
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 100 );
/* The driver only supports one port so the pxPort parameter is not used. */
( void ) pxPort;
for( uxChar = 0; uxChar < usStringLength; uxChar++ )
{
if( xQueueSend( xCharsForTx, &( pcString[ uxChar ] ), xMaxBlockTime ) == pdFALSE )
{
break;
}
else
{
UCA0IE |= UCTXIE;
}
}
}
/*-----------------------------------------------------------*/
/* The implementation of this interrupt is provided to demonstrate the use
of queues from inside an interrupt service routine. It is *not* intended to
be an efficient interrupt implementation. A real application should make use
of the DMA. Or, as a minimum, transmission and reception could use a simple
RAM ring buffer, and synchronise with a task using a semaphore when a complete
message has been received or transmitted. */
#pragma vector=USCI_A0_VECTOR
static __interrupt void prvUSCI_A0_ISR( void )
{
signed char cChar;
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
while( ( UCA0IFG & UCRXIFG ) != 0 )
{
/* Get the character from the UART and post it on the queue of Rxed
characters. */
cChar = UCA0RXBUF;
xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );
}
/* If there is a Tx interrupt pending and the tx interrupts are enabled. */
if( ( UCA0IFG & UCTXIFG ) != 0 )
{
/* The previous character has been transmitted. See if there are any
further characters waiting transmission. */
if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE )
{
/* There was another character queued - transmit it now. */
UCA0TXBUF = cChar;
}
else
{
/* There were no other characters to transmit - disable the Tx
interrupt. */
UCA0IE &= ~UCTXIE;
}
}
__bic_SR_register_on_exit( SCG1 + SCG0 + OSCOFF + CPUOFF );
/* If writing to a queue caused a task to unblock, and the unblocked task
has a priority equal to or above the task that this interrupt interrupted,
then lHigherPriorityTaskWoken will have been set to pdTRUE internally within
xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this
interrupt returns directly to the higher priority unblocked task.
THIS MUST BE THE LAST THING DONE IN THE ISR. */
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}

View File

@ -372,7 +372,7 @@
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>

View File

@ -67,20 +67,20 @@
<option>
<name>Input variant</name>
<version>2</version>
<state>3</state>
<state>7</state>
</option>
<option>
<name>Input description</name>
<state>No specifier n, no float or long long.</state>
<state>No specifier n, no float nor long long, no scan set, no assignment suppressing, without multibyte support.</state>
</option>
<option>
<name>Output variant</name>
<version>2</version>
<state>3</state>
<state>7</state>
</option>
<option>
<name>Output description</name>
<state>No specifier a or A.</state>
<state>No specifier a, A, no specifier n, no float nor long long, without multibytes.</state>
</option>
<option>
<name>GRuntimeLibSelectSlave</name>
@ -101,15 +101,15 @@
</option>
<option>
<name>GStackHeapOverride</name>
<state>0</state>
<state>1</state>
</option>
<option>
<name>GStackSize2</name>
<state>160</state>
<state>100</state>
</option>
<option>
<name>GHeapSize2</name>
<state>160</state>
<state>0</state>
</option>
<option>
<name>RadioDataModelType</name>
@ -117,7 +117,7 @@
</option>
<option>
<name>GHeap20Size</name>
<state>80</state>
<state>0</state>
</option>
<option>
<name>GeneralMisraRules98</name>
@ -220,11 +220,11 @@
<option>
<name>Math variant</name>
<version>0</version>
<state>0</state>
<state>1</state>
</option>
<option>
<name>Math description</name>
<state>Default variants of cos, sin, tan, log, log10, pow, and exp.</state>
<state>Smaller size, higher execution speed, less precision, smaller input range.</state>
</option>
</data>
</settings>
@ -395,6 +395,7 @@
<state>$PROJ_DIR$\..\..\Source\include</state>
<state>$PROJ_DIR$\..\..\Source\portable\IAR\MSP430X</state>
<state>$PROJ_DIR$\..\Common\include</state>
<state>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-CLI</state>
</option>
<option>
<name>CCStdIncCheck</name>
@ -1359,6 +1360,9 @@
<file>
<name>$PROJ_DIR$\..\..\Source\portable\IAR\MSP430X\portext.s43</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\IAR\MSP430X\portmacro.h</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\..\Source\event_groups.c</name>
@ -1376,6 +1380,54 @@
<name>$PROJ_DIR$\..\..\Source\timers.c</name>
</file>
</group>
<group>
<name>Full_Demo</name>
<group>
<name>FreeRTOS+CLI</name>
<file>
<name>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-CLI\FreeRTOS_CLI.c</name>
</file>
</group>
<group>
<name>Standard Demo Tasks</name>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\blocktim.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\countsem.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\EventGroupsDemo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\GenQTest.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\recmutex.c</name>
</file>
<file>
<name>$PROJ_DIR$\Full_Demo\serial.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\TaskNotify.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\Full_Demo\main_full.c</name>
</file>
<file>
<name>$PROJ_DIR$\Full_Demo\RegTest.s43</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Demo\Common\FreeRTOS_Plus_CLI_Demos\Sample-CLI-commands.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Demo\Common\FreeRTOS_Plus_CLI_Demos\UARTCommandConsole.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\FRAMLogMode.c</name>
<excluded>

View File

@ -89,11 +89,9 @@
#include "task.h"
#include "semphr.h"
/* Standard demo includes. */
#include "TimerDemo.h"
#include "QueueOverwrite.h"
/* Standard demo includes, used so the tick hook can exercise some FreeRTOS
functionality in an interrupt. */
#include "EventGroupsDemo.h"
#include "IntSemTest.h"
#include "TaskNotify.h"
#include "ParTest.h" /* LEDs - a historic name for "Parallel Port". */
@ -102,7 +100,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 1
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
/*-----------------------------------------------------------*/
@ -156,51 +154,6 @@ int main( void )
}
/*-----------------------------------------------------------*/
static void prvSetupHardware( void )
{
/* Set all GPIO pins to output and low. */
GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setOutputLowOnPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setOutputLowOnPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setOutputLowOnPin( GPIO_PORT_PJ, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15 );
GPIO_setAsOutputPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setAsOutputPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setAsOutputPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setAsOutputPin( GPIO_PORT_PJ, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15 );
/* Configure P2.0 for UCA0TXD and P2.1 for UCA0RXD. */
GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 );
GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 );
GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P2, GPIO_PIN1, GPIO_SECONDARY_MODULE_FUNCTION );
/* Set PJ.4 and PJ.5 for LFXT. */
GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_PJ, GPIO_PIN4 + GPIO_PIN5, GPIO_PRIMARY_MODULE_FUNCTION );
/* Set DCO frequency to 1 MHz. */
CS_setDCOFreq( CS_DCORSEL_0, CS_DCOFSEL_6 );
/* Set external clock frequency to 32.768 KHz. */
CS_setExternalClockSource( 32768, 0 );
/* Set ACLK = LFXT. */
CS_initClockSignal( CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1 );
/* Set SMCLK = DCO with frequency divider of 1. */
CS_initClockSignal( CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 );
/* Set MCLK = DCO with frequency divider of 1. */
CS_initClockSignal( CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 );
/* Start XT1 with no time out. */
CS_turnOnLFXT( CS_LFXT_DRIVE_0 );
/* Disable the GPIO power-on default high-impedance mode. */
PMM_unlockLPM5();
}
/*-----------------------------------------------------------*/
void vApplicationMallocFailedHook( void )
{
/* Called if a call to pvPortMalloc() fails because there is insufficient
@ -221,7 +174,8 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
/* Run time stack overflow checking is performed if
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
function is called if a stack overflow is detected. */
function is called if a stack overflow is detected.
See http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
/* Force an assert. */
configASSERT( ( volatile void * ) NULL );
@ -248,21 +202,11 @@ volatile size_t xFreeHeapSpace;
void vApplicationTickHook( void )
{
#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0
#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )
{
/* The full demo includes a software timer demo/test that requires
prodding periodically from the tick interrupt. */
vTimerPeriodicISRTests();
/* Call the periodic queue overwrite from ISR demo. */
vQueueOverwritePeriodicISRDemo();
/* Call the periodic event group from ISR demo. */
vPeriodicEventGroupsProcessing();
/* Call the code that uses a mutex from an ISR. */
vInterruptSemaphorePeriodicTest();
/* Call the code that 'gives' a task notification from an ISR. */
xNotifyTaskFromISR();
}
@ -302,3 +246,49 @@ const unsigned short usACLK_Frequency_Hz = 32768;
TA0CTL |= MC_1;
}
/*-----------------------------------------------------------*/
static void prvSetupHardware( void )
{
/* Set all GPIO pins to output and low. */
GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setOutputLowOnPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setOutputLowOnPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setOutputLowOnPin( GPIO_PORT_PJ, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15 );
GPIO_setAsOutputPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setAsOutputPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setAsOutputPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );
GPIO_setAsOutputPin( GPIO_PORT_PJ, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15 );
/* Configure P2.0 - UCA0TXD and P2.1 - UCA0RXD. */
GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 );
GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 );
GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P2, GPIO_PIN1, GPIO_SECONDARY_MODULE_FUNCTION );
GPIO_setAsPeripheralModuleFunctionOutputPin( GPIO_PORT_P2, GPIO_PIN0, GPIO_SECONDARY_MODULE_FUNCTION );
/* Set PJ.4 and PJ.5 for LFXT. */
GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_PJ, GPIO_PIN4 + GPIO_PIN5, GPIO_PRIMARY_MODULE_FUNCTION );
/* Set DCO frequency to 8 MHz. */
CS_setDCOFreq( CS_DCORSEL_0, CS_DCOFSEL_6 );
/* Set external clock frequency to 32.768 KHz. */
CS_setExternalClockSource( 32768, 0 );
/* Set ACLK = LFXT. */
CS_initClockSignal( CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1 );
/* Set SMCLK = DCO with frequency divider of 1. */
CS_initClockSignal( CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 );
/* Set MCLK = DCO with frequency divider of 1. */
CS_initClockSignal( CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 );
/* Start XT1 with no time out. */
CS_turnOnLFXT( CS_LFXT_DRIVE_0 );
/* Disable the GPIO power-on default high-impedance mode. */
PMM_unlockLPM5();
}
/*-----------------------------------------------------------*/