sw_apps: FreeRTOS hello world application is added
This patch adds FreeRTOS helloworld application to be built with FreeRTOS BSP for cortex-R5 Signed-off-by: Kinjal Pravinbhai Patel <patelki@xilinx.com>
This commit is contained in:
parent
f71d9971ae
commit
e395d1bf1b
3 changed files with 327 additions and 0 deletions
|
@ -0,0 +1,40 @@
|
|||
#/******************************************************************************
|
||||
#*
|
||||
#* Copyright (C) 2015 Xilinx, Inc. All rights reserved.
|
||||
#*
|
||||
#* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
#* of this software and associated documentation files (the "Software"), to deal
|
||||
#* in the Software without restriction, including without limitation the rights
|
||||
#* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
#* copies of the Software, and to permit persons to whom the Software is
|
||||
#* furnished to do so, subject to the following conditions:
|
||||
#*
|
||||
#* The above copyright notice and this permission notice shall be included in
|
||||
#* all copies or substantial portions of the Software.
|
||||
#*
|
||||
#* Use of the Software is limited solely to applications:
|
||||
#* (a) running on a Xilinx device, or
|
||||
#* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#*
|
||||
#* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
#* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
#* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
#* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
#* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
#* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
#* SOFTWARE.
|
||||
#*
|
||||
#* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
#* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
#* this Software without prior written authorization from Xilinx.
|
||||
#*
|
||||
#******************************************************************************/
|
||||
|
||||
PARAMETER VERSION = 2.2.0
|
||||
|
||||
|
||||
BEGIN OS
|
||||
PARAMETER OS_NAME = freertos820_xilinx
|
||||
PARAMETER STDIN = *
|
||||
PARAMETER STDOUT = *
|
||||
END
|
|
@ -0,0 +1,88 @@
|
|||
#/******************************************************************************
|
||||
#*
|
||||
#* Copyright (C) 2015 Xilinx, Inc. All rights reserved.
|
||||
#*
|
||||
#* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
#* of this software and associated documentation files (the "Software"), to deal
|
||||
#* in the Software without restriction, including without limitation the rights
|
||||
#* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
#* copies of the Software, and to permit persons to whom the Software is
|
||||
#* furnished to do so, subject to the following conditions:
|
||||
#*
|
||||
#* The above copyright notice and this permission notice shall be included in
|
||||
#* all copies or substantial portions of the Software.
|
||||
#*
|
||||
#* Use of the Software is limited solely to applications:
|
||||
#* (a) running on a Xilinx device, or
|
||||
#* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#*
|
||||
#* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
#* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
#* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
#* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
#* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
#* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
#* SOFTWARE.
|
||||
#*
|
||||
#* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
#* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
#* this Software without prior written authorization from Xilinx.
|
||||
#*
|
||||
#******************************************************************************/
|
||||
|
||||
proc swapp_get_name {} {
|
||||
return "FreeRTOS Hello Horld";
|
||||
}
|
||||
|
||||
proc swapp_get_description {} {
|
||||
return " FreeRTOS R5 Hello World application";
|
||||
}
|
||||
|
||||
proc check_standalone_os {} {
|
||||
set oslist [get_os];
|
||||
|
||||
if { [llength $oslist] != 1 } {
|
||||
return 0;
|
||||
}
|
||||
set os [lindex $oslist 0];
|
||||
|
||||
if { $os != "freertos820_xilinx" } {
|
||||
error "This application is supported only on the freertos820_xilinx.";
|
||||
}
|
||||
}
|
||||
|
||||
proc swapp_is_supported_sw {} {
|
||||
return 0;
|
||||
}
|
||||
|
||||
proc swapp_is_supported_hw {} {
|
||||
|
||||
# check processor type
|
||||
set proc_instance [get_sw_processor];
|
||||
set hw_processor [common::get_property HW_INSTANCE $proc_instance]
|
||||
|
||||
set proc_type [common::get_property IP_NAME [get_cells $hw_processor]];
|
||||
|
||||
if { $proc_type != "psu_cortexr5" } {
|
||||
error "This application is supported only for CortexR5 processors.";
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
proc get_stdout {} {
|
||||
return;
|
||||
}
|
||||
|
||||
proc check_stdout_hw {} {
|
||||
return;
|
||||
}
|
||||
|
||||
proc swapp_generate {} {
|
||||
return;
|
||||
}
|
||||
|
||||
proc swapp_get_linker_constraints {} {
|
||||
return "";
|
||||
}
|
199
lib/sw_apps/freertos_hello_world/src/freertos_hello_world.c
Normal file
199
lib/sw_apps/freertos_hello_world/src/freertos_hello_world.c
Normal file
|
@ -0,0 +1,199 @@
|
|||
/*
|
||||
FreeRTOS V8.2.0rc1 - Copyright (C) 2014 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
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?". Have you defined configASSERT()? *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.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 *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Investing in training allows your team to be as productive as *
|
||||
* possible as early as possible, lowering your overall development *
|
||||
* cost, and enabling you to bring a more robust product to market *
|
||||
* earlier than would otherwise be possible. Richard Barry is both *
|
||||
* the architect and key author of FreeRTOS, and so also the world's *
|
||||
* leading authority on what is the world's most popular real time *
|
||||
* kernel for deeply embedded MCU designs. Obtaining your training *
|
||||
* from Richard ensures your team will gain directly from his in-depth *
|
||||
* product knowledge and years of usage experience. Contact Real Time *
|
||||
* Engineers Ltd to enquire about the FreeRTOS Masterclass, presented *
|
||||
* by Richard Barry: http://www.FreeRTOS.org/contact
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* You are receiving this top quality software for free. Please play *
|
||||
* fair and reciprocate by reporting any suspected issues and *
|
||||
* participating in the community forum: *
|
||||
* http://www.FreeRTOS.org/support *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
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!
|
||||
*/
|
||||
|
||||
/* Kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "timers.h"
|
||||
#include "xil_printf.h"
|
||||
#include "xparameters.h"
|
||||
#include "xscugic.h"
|
||||
#include "xttcps.h"
|
||||
|
||||
/* Priorities at which the tasks are created. */
|
||||
#define mainHELLO_WORLD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainGOOD_BYE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
static void prvHelloWorld( void *pvParameters );
|
||||
static void prvGoodBye( void *pvParameters );
|
||||
|
||||
/*
|
||||
* This example creates two tasks were each task prints a statement.
|
||||
* Each task yields after it prints a message which apppears on
|
||||
* console alternatively. Sometimes, due to scheduler algorithm the
|
||||
* task might be pre-empted before print could complete.
|
||||
*/
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
|
||||
xil_printf("Hello Freertos\r\n");
|
||||
/* Start the two tasks */
|
||||
|
||||
xTaskCreate( prvHelloWorld, ( const char * ) "HW",
|
||||
configMINIMAL_STACK_SIZE, NULL,
|
||||
mainHELLO_WORLD_TASK_PRIORITY, NULL );
|
||||
xTaskCreate( prvGoodBye, ( const char * ) "GB",
|
||||
configMINIMAL_STACK_SIZE, NULL,
|
||||
mainGOOD_BYE_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Start the tasks and timer running. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* If all is well, the scheduler will now be running, and the following line
|
||||
will never be reached. If the following line does execute, then there was
|
||||
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
||||
to be created. See the memory management section on the FreeRTOS web site
|
||||
for more details. */
|
||||
|
||||
for( ;; );
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
static void prvHelloWorld( void *pvParameters )
|
||||
{
|
||||
for( ;; )
|
||||
{
|
||||
xil_printf("Hello World\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
static void prvGoodBye( void *pvParameters )
|
||||
{
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
xil_printf("Good Bye\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
void vApplicationMallocFailedHook( void )
|
||||
{
|
||||
/* vApplicationMallocFailedHook() will only be called if
|
||||
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
|
||||
function that will get called if a call to pvPortMalloc() fails.
|
||||
pvPortMalloc() is called internally by the kernel whenever a task, queue or
|
||||
semaphore is created. It is also called by various parts of the demo
|
||||
application. If heap_1.c or heap_2.c are used, then the size of the heap
|
||||
available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
|
||||
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
|
||||
to query the size of free heap space that remains (although it does not
|
||||
provide information on how the remaining heap might be fragmented). */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
/* vApplicationStackOverflowHook() will only be called if
|
||||
configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2. The handle and name
|
||||
of the offending task will be passed into the hook function via its
|
||||
parameters. However, when a stack has overflowed, it is possible that the
|
||||
parameters will have been corrupted, in which case the pxCurrentTCB variable
|
||||
can be inspected directly. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
}
|
Loading…
Add table
Reference in a new issue