From a5f9748975ff6cc5e185e62079519b67b8bd51fd Mon Sep 17 00:00:00 2001 From: rtel Date: Mon, 27 Apr 2015 11:14:11 +0000 Subject: [PATCH] Change some data types in heap_4.c to allow it to be used on hardware that has 16-bit pointers without generating compiler warnings. Add a small data model configuration to the MSP43FR5969 IAR demo. Correct some code comments in the SAMA5D4 demo. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2347 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../Sample-CLI-commands.c | 6 +- .../Demo/CORTEX_A5_SAMA5D4x_EK_IAR/6119.inf | 101 ++ .../Blinky_Demo/main_blinky.c | 64 +- .../Demo/CORTEX_A5_SAMA5D4x_EK_IAR/main.c | 2 +- .../FreeRTOSConfig.h | 3 +- .../RTOSDemo.ewd | 412 +++++- .../RTOSDemo.ewp | 1155 ++++++++++++++++- .../MSP430X_MSP430FR5969_LaunchPad/main.c | 15 +- FreeRTOS/Source/portable/MemMang/heap_4.c | 24 +- 9 files changed, 1701 insertions(+), 81 deletions(-) create mode 100644 FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/6119.inf diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c index 5c5e03c76..ee4b655cb 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c @@ -227,7 +227,7 @@ void vRegisterSampleCLICommands( void ) static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) { -const char *const pcHeader = " State Priority Stack #\r\n************************************************\r\n"; +const char *const pcHeader = " State Priority Stack #\r\n************************************************\r\n"; BaseType_t xSpacePadding; /* Remove compile time warnings about unused parameters, and check the @@ -300,8 +300,8 @@ BaseType_t xSpacePadding; pcWriteBuffer += strlen( pcWriteBuffer ); /* Pad the string "task" with however many bytes necessary to make it the - length of a task name. Minus three for the null terminator and half the - number of characters in "Task" so the column lines up with the centre of + length of a task name. Minus three for the null terminator and half the + number of characters in "Task" so the column lines up with the centre of the heading. */ for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ ) { diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/6119.inf b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/6119.inf new file mode 100644 index 000000000..b04272b0f --- /dev/null +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/6119.inf @@ -0,0 +1,101 @@ +; +; Windows USB CDC Driver Setup File for ATMEL AT91SAM products +; +; On Windows 7, right click to update driver software. It may take a while to +; get this option, even if you cancel the auto driver search. +; choose "browse my computer for driver software", +; choose "let me pick from a list of device drivers on my computer", +; Click "have disk" and browse to this .inf file +; If there is a problem, right click and uninstall, checking delete driver software. + +;------------------------------------------------------------------------------ + +[Version] +Signature="$Windows NT$" +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Provider=%ATMEL% +LayoutFile=layout.inf + +DriverVer= 03/09/2011,2.0.0.0 + +[Manufacturer] +%ATMEL%=DeviceList,NTamd64 + +[DestinationDirs] +DefaultDestDir=12 + + +;------------------------------------------------------------------------------ +; Windows 2000/XP/Vista32 Support +;------------------------------------------------------------------------------ +[DriverInstall.nt] +include=mdmcpq.inf +CopyFiles=DriverCopyFiles.nt +AddReg=DriverInstall.nt.AddReg + +[DriverCopyFiles.nt] +usbser.sys,,,0x20 + +[DriverInstall.nt.AddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,usbser.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[DriverInstall.nt.Services] +AddService=usbser, 0x00000002, DriverService.nt + +[DriverService.nt] +DisplayName=%USBtoSerialConverter% +ServiceType=1 +StartType=3 +ErrorControl=1 +ServiceBinary=%12%\usbser.sys + +;------------------------------------------------------------------------------ +; Windows Vista64 Support +;------------------------------------------------------------------------------ + +[DriverInstall.NTamd64] +include=mdmcpq.inf +CopyFiles=DriverCopyFiles.NTamd64 +AddReg=DriverInstall.NTamd64.AddReg + +[DriverCopyFiles.NTamd64] +usbser.sys,,,0x20 + +[DriverInstall.NTamd64.AddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,usbser.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + + +[DriverInstall.NTamd64.Services] +AddService=usbser, 0x00000002, DriverService.NTamd64 + +[DriverService.NTamd64] +DisplayName=%USBtoSerialConverter% +ServiceType=1 +StartType=3 +ErrorControl=1 +ServiceBinary=%12%\usbser.sys + + +;------------------------------------------------------------------------------ +; VID/PID Settings +;------------------------------------------------------------------------------ +[SourceDisksFiles] +[SourceDisksNames] +[DeviceList] +%USBtoSerialConverter%=DriverInstall, USB\VID_03EB&PID_6119 + +[DeviceList.NTamd64] +%USBtoSerialConverter%=DriverInstall, USB\VID_03EB&PID_6119 + +;------------------------------------------------------------------------------ +; String Definitions +;------------------------------------------------------------------------------ +[Strings] + +ATMEL="ATMEL Corp." ; String value for the ATMEL symbol +USBtoSerialConverter="AT91 USB to Serial Converter" ; String value for the USBtoSerialConverter symbol diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Blinky_Demo/main_blinky.c index a60914b72..0550e79ab 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Blinky_Demo/main_blinky.c @@ -1,60 +1,64 @@ /* - FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. + 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. - *************************************************************************** - * * - * FreeRTOS provides completely free yet professionally developed, * - * robust, strictly quality controlled, supported, and cross * - * platform software that has become a de facto standard. * - * * - * Help yourself get started quickly and support the FreeRTOS * - * project by purchasing a FreeRTOS tutorial book, reference * - * manual, or both from: http://www.FreeRTOS.org/Documentation * - * * - * Thank you! * - * * - *************************************************************************** - 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 from the following + FOR A PARTICULAR PURPOSE. Full license text is available on the following link: http://www.freertos.org/a00114.html - 1 tab == 4 spaces! - *************************************************************************** * * - * Having a problem? Start by reading the FAQ "My application does * - * not run, what could be wrong?" * + * 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. * * * - * http://www.FreeRTOS.org/FAQHelp.html * + * 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 - Documentation, books, training, latest versions, - license and Real Time Engineers Ltd. contact details. + 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.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High - Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS - licenses offer ticketed support, indemnification and middleware. + 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 @@ -64,10 +68,10 @@ */ /****************************************************************************** - * NOTE 1: This project provides three demo applications. A simple blinky - * style project, a more comprehensive test and demo application, and an - * lwIP example. The mainSELECTED_APPLICATION setting in main.c is used to - * select between the three. See the notes on using mainSELECTED_APPLICATION + * NOTE 1: This project provides two demo applications. A simple blinky style + * project, and a more comprehensive test and demo application. The + * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select + * between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY * in main.c. This file implements the simply blinky style version. * * NOTE 2: This file only contains the source code that is specific to the diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/main.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/main.c index 23c5ddbae..2e1ad5197 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/main.c @@ -114,7 +114,7 @@ static void prvSetupHardware( void ); * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1. * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0. */ -#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 +#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) extern void main_blinky( void ); #else extern void main_full( void ); diff --git a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/FreeRTOSConfig.h b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/FreeRTOSConfig.h index 27ca94777..f531c5e35 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/FreeRTOSConfig.h @@ -84,7 +84,6 @@ /* 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 ) @@ -112,7 +111,7 @@ __persistent keyword to be used. See http://www.freertos.org/a00111.html#heap_4 /* Hook function related definitions. */ #define configUSE_TICK_HOOK 1 -#define configUSE_IDLE_HOOK 0 +#define configUSE_IDLE_HOOK 1 #define configUSE_MALLOC_FAILED_HOOK 1 #define configCHECK_FOR_STACK_OVERFLOW 2 diff --git a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/RTOSDemo.ewd b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/RTOSDemo.ewd index a3b2aa435..4de54d6c6 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/RTOSDemo.ewd +++ b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/RTOSDemo.ewd @@ -3,7 +3,417 @@ 2 - Debug + Debug_Large_Data_Model + + MSP430 + + 1 + + C-SPY + 5 + + 27 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 430FET + 1 + + 29 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SIM430 + 1 + + 4 + 1 + 1 + + + + + + + + + + + $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + Debug_Small_Data_Model MSP430 diff --git a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/RTOSDemo.ewp b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/RTOSDemo.ewp index 99c193774..7d80e25d0 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/RTOSDemo.ewp +++ b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/RTOSDemo.ewp @@ -3,7 +3,7 @@ 2 - Debug + Debug_Large_Data_Model MSP430 @@ -21,15 +21,15 @@ + + Debug_Small_Data_Model + + MSP430 + + 1 + + General + 17 + + 33 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICC430 + 4 + + 37 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A430 + 5 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + 0 + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 4 + + 29 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 4 + + 0 + 1 + 1 + + + + + + + ULP430 + 1 + + 1 + 1 + 1 + + + + + + + + + BILINK + 0 + + + Blinky_Demo @@ -1428,27 +2560,12 @@ $PROJ_DIR$\..\..\..\FreeRTOS-Plus\Demo\Common\FreeRTOS_Plus_CLI_Demos\UARTCommandConsole.c - - $PROJ_DIR$\FRAMLogMode.c - - Debug - - - - $PROJ_DIR$\FRAMLogMode.h - $PROJ_DIR$\FreeRTOSConfig.h $PROJ_DIR$\LEDs.c - - $PROJ_DIR$\LiveTempMode.c - - - $PROJ_DIR$\LiveTempMode.h - $PROJ_DIR$\low_level_init_iar.c diff --git a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/main.c b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/main.c index 7aaf5331e..6fcd16dca 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/main.c +++ b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/main.c @@ -184,19 +184,8 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + __bis_SR_register( LPM4_bits + GIE ); + __no_operation(); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/MemMang/heap_4.c b/FreeRTOS/Source/portable/MemMang/heap_4.c index 089ff86ce..cdce55af0 100644 --- a/FreeRTOS/Source/portable/MemMang/heap_4.c +++ b/FreeRTOS/Source/portable/MemMang/heap_4.c @@ -368,20 +368,20 @@ static void prvHeapInit( void ) { BlockLink_t *pxFirstFreeBlock; uint8_t *pucAlignedHeap; -uint32_t ulAddress; +size_t uxAddress; size_t xTotalHeapSize = configTOTAL_HEAP_SIZE; /* Ensure the heap starts on a correctly aligned boundary. */ - ulAddress = ( uint32_t ) ucHeap; + uxAddress = ( size_t ) ucHeap; - if( ( ulAddress & portBYTE_ALIGNMENT_MASK ) != 0 ) + if( ( uxAddress & portBYTE_ALIGNMENT_MASK ) != 0 ) { - ulAddress += ( portBYTE_ALIGNMENT - 1 ); - ulAddress &= ~( ( uint32_t ) portBYTE_ALIGNMENT_MASK ); - xTotalHeapSize -= ulAddress - ( uint32_t ) ucHeap; + uxAddress += ( portBYTE_ALIGNMENT - 1 ); + uxAddress &= ~( ( size_t ) portBYTE_ALIGNMENT_MASK ); + xTotalHeapSize -= uxAddress - ( size_t ) ucHeap; } - pucAlignedHeap = ( uint8_t * ) ulAddress; + pucAlignedHeap = ( uint8_t * ) uxAddress; /* xStart is used to hold a pointer to the first item in the list of free blocks. The void cast is used to prevent compiler warnings. */ @@ -390,17 +390,17 @@ size_t xTotalHeapSize = configTOTAL_HEAP_SIZE; /* pxEnd is used to mark the end of the list of free blocks and is inserted at the end of the heap space. */ - ulAddress = ( ( uint32_t ) pucAlignedHeap ) + xTotalHeapSize; - ulAddress -= xHeapStructSize; - ulAddress &= ~( ( uint32_t ) portBYTE_ALIGNMENT_MASK ); - pxEnd = ( void * ) ulAddress; + uxAddress = ( ( size_t ) pucAlignedHeap ) + xTotalHeapSize; + uxAddress -= xHeapStructSize; + uxAddress &= ~( ( size_t ) portBYTE_ALIGNMENT_MASK ); + pxEnd = ( void * ) uxAddress; pxEnd->xBlockSize = 0; pxEnd->pxNextFreeBlock = NULL; /* To start with there is a single free block that is sized to take up the entire heap space, minus the space taken by pxEnd. */ pxFirstFreeBlock = ( void * ) pucAlignedHeap; - pxFirstFreeBlock->xBlockSize = ulAddress - ( uint32_t ) pxFirstFreeBlock; + pxFirstFreeBlock->xBlockSize = uxAddress - ( size_t ) pxFirstFreeBlock; pxFirstFreeBlock->pxNextFreeBlock = pxEnd; /* Only one block exists - and it covers the entire usable heap space. */ -- 2.39.2