mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2026-09-28 16:16:47 +08:00
Demo/Posix_GCC: add demo application for Posix port using GCC
This is largely a copy of the Windows demo application with a few key changes: - heap_3 (use malloc()/free()) so tools like valgrind "just work". - printf() wrapped in a mutex to prevent deadlocks on the internal pthread mutexes inside printf(). SCons (https://scons.org/) is used as the build system. This will be built as a 64-bit application, but note that the memory allocation trace points only record the lower 32-bits of the address.
This commit is contained in:
committed by
Yuhui Zheng
parent
f78f919b3e
commit
9f316c246b
@@ -0,0 +1,4 @@
|
||||
.sconsign.dblite
|
||||
build/
|
||||
src/FreeRTOS
|
||||
src/FreeRTOS-Plus
|
||||
@@ -0,0 +1,52 @@
|
||||
# FreeRTOS Kernel V10.3.0
|
||||
# Copyright (C) 2020 Cambridge Consultants Ltd.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 AUTHORS OR
|
||||
# COPYRIGHT HOLDERS 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.
|
||||
#
|
||||
# http://www.FreeRTOS.org
|
||||
# http://aws.amazon.com/freertos
|
||||
#
|
||||
# This is the main SCons (https://scons.org/) build file for the
|
||||
# Posix/GCC demo application.
|
||||
|
||||
import os
|
||||
|
||||
# Create a symlink to the FreeRTOS sources.
|
||||
if not os.path.exists("src/FreeRTOS"):
|
||||
os.symlink("../../..", "src/FreeRTOS")
|
||||
if not os.path.exists("src/FreeRTOS-Plus"):
|
||||
os.symlink("../../../../FreeRTOS-Plus", "src/FreeRTOS-Plus")
|
||||
|
||||
AddOption("--simple",
|
||||
action='store_true',
|
||||
help="build the simple 'blinky' demo application")
|
||||
|
||||
AddOption("--coverage",
|
||||
action='store_true',
|
||||
help="enable code coverage")
|
||||
|
||||
env = Environment()
|
||||
Export("env")
|
||||
|
||||
env.Append(CFLAGS = [
|
||||
"-g",
|
||||
"-Wall",
|
||||
"-O2",
|
||||
])
|
||||
|
||||
SConscript("src/SConscript", variant_dir="build", duplicate=0)
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* FreeRTOS Kernel V10.3.0
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. 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.
|
||||
*
|
||||
* 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 AUTHORS OR
|
||||
* COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. See
|
||||
* http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configUSE_DAEMON_TASK_STARTUP_HOOK 1
|
||||
#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 configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 65 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 20
|
||||
#define configUSE_APPLICATION_TASK_TAG 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
/* Software timer related configuration options. The maximum possible task
|
||||
priority is configMAX_PRIORITIES - 1. The priority of the timer task is
|
||||
deliberately set higher to ensure it is correctly capped back to
|
||||
configMAX_PRIORITIES - 1. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define configTIMER_QUEUE_LENGTH 20
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
|
||||
/* Run time stats gathering configuration options. */
|
||||
unsigned long ulGetRunTimeCounterValue( void ); /* Prototype of function that returns run time counter. */
|
||||
void vConfigureTimerForRunTimeStats( void ); /* Prototype of function that initialises the run time counter. */
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
|
||||
/* Co-routine related configuration options. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* This demo can 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 0
|
||||
|
||||
/* Enables the test whereby a stack larger than the total heap size is
|
||||
requested. */
|
||||
#define configSTACK_DEPTH_TYPE uint32_t
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. In most cases the linker will remove unused
|
||||
functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark2 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 1
|
||||
#define INCLUDE_xTaskGetHandle 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
#define INCLUDE_xTaskAbortDelay 1
|
||||
|
||||
#define configINCLUDE_MESSAGE_BUFFER_AMP_DEMO 0
|
||||
#if ( configINCLUDE_MESSAGE_BUFFER_AMP_DEMO == 1 )
|
||||
extern void vGenerateCoreBInterrupt( void * xUpdatedMessageBuffer );
|
||||
#define sbSEND_COMPLETED( pxStreamBuffer ) vGenerateCoreBInterrupt( pxStreamBuffer )
|
||||
#endif /* configINCLUDE_MESSAGE_BUFFER_AMP_DEMO */
|
||||
|
||||
extern void vAssertCalled( unsigned long ulLine, const char * const pcFileName );
|
||||
|
||||
/* projCOVERAGE_TEST should be defined on the command line so this file can be
|
||||
used with multiple project configurations. If it is
|
||||
*/
|
||||
#ifndef projCOVERAGE_TEST
|
||||
#error projCOVERAGE_TEST should be defined to 1 or 0 on the command line.
|
||||
#endif
|
||||
|
||||
#if( projCOVERAGE_TEST == 1 )
|
||||
/* Insert NOPs in empty decision paths to ensure both true and false paths
|
||||
are being tested. */
|
||||
#define mtCOVERAGE_TEST_MARKER() __asm volatile( "NOP" )
|
||||
|
||||
/* Ensure the tick count overflows during the coverage test. */
|
||||
#define configINITIAL_TICK_COUNT 0xffffd800UL
|
||||
|
||||
/* Allows tests of trying to allocate more than the heap has free. */
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
|
||||
/* To test builds that remove the static qualifier for debug builds. */
|
||||
#define portREMOVE_STATIC_QUALIFIER
|
||||
#else
|
||||
/* It is a good idea to define configASSERT() while developing. configASSERT()
|
||||
uses the same semantics as the standard C assert() macro. Don't define
|
||||
configASSERT() when performing code coverage tests though, as it is not
|
||||
intended to asserts() to fail, some some code is intended not to run if no
|
||||
errors are present. */
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __LINE__, __FILE__ )
|
||||
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
|
||||
/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */
|
||||
#include "trcRecorder.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
@@ -0,0 +1,124 @@
|
||||
# FreeRTOS Kernel V10.3.0
|
||||
# Copyright (C) 2020 Cambridge Consultants Ltd.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 AUTHORS OR
|
||||
# COPYRIGHT HOLDERS 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.
|
||||
#
|
||||
# http://www.FreeRTOS.org
|
||||
# http://aws.amazon.com/freertos
|
||||
|
||||
Import("env")
|
||||
|
||||
env.Append(CPPPATH = [
|
||||
".",
|
||||
"FreeRTOS/Source/include",
|
||||
"FreeRTOS/Source/portable/ThirdParty/GCC/Posix",
|
||||
"FreeRTOS/Demo/Common/include",
|
||||
"FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include",
|
||||
])
|
||||
|
||||
env.Append(LIBS = [
|
||||
"pthread",
|
||||
])
|
||||
|
||||
src = [
|
||||
"console.c",
|
||||
"main.c",
|
||||
"main_blinky.c",
|
||||
"main_full.c",
|
||||
"run-time-stats-utils.c",
|
||||
|
||||
# FreeRTOS kernel
|
||||
"FreeRTOS/Source/event_groups.c",
|
||||
"FreeRTOS/Source/list.c",
|
||||
"FreeRTOS/Source/queue.c",
|
||||
"FreeRTOS/Source/stream_buffer.c",
|
||||
"FreeRTOS/Source/tasks.c",
|
||||
"FreeRTOS/Source/timers.c",
|
||||
|
||||
# Memory manager (use malloc()/free()).
|
||||
"FreeRTOS/Source/portable/MemMang/heap_3.c",
|
||||
|
||||
# Posix port.
|
||||
"FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c",
|
||||
|
||||
# Demo library.
|
||||
"FreeRTOS/Demo/Common/Minimal/AbortDelay.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/BlockQ.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/blocktim.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/countsem.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/death.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/dynamic.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/flop.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/GenQTest.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/integer.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/IntSemTest.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/MessageBufferAMP.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/MessageBufferDemo.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/PollQ.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/QPeek.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/QueueOverwrite.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/QueueSet.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/QueueSetPolling.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/recmutex.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/semtest.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/StaticAllocation.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/StreamBufferDemo.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/StreamBufferInterrupt.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/TaskNotify.c",
|
||||
"FreeRTOS/Demo/Common/Minimal/TimerDemo.c",
|
||||
]
|
||||
|
||||
if GetOption("coverage"):
|
||||
env.Append(CPPDEFINES = [
|
||||
"projCOVERAGE_TEST=1",
|
||||
])
|
||||
|
||||
env.Append(CFLAGS = [
|
||||
"-fprofile-arcs",
|
||||
"-ftest-coverage",
|
||||
])
|
||||
env.Append(LINKFLAGS = [
|
||||
"-fprofile-arcs",
|
||||
"-ftest-coverage",
|
||||
])
|
||||
|
||||
src += [
|
||||
"code_coverage_additions.c",
|
||||
]
|
||||
else:
|
||||
env.Append(CPPDEFINES = [
|
||||
"projCOVERAGE_TEST=0",
|
||||
])
|
||||
|
||||
src += [
|
||||
# Trace library.
|
||||
"FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcKernelPort.c",
|
||||
"FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcSnapshotRecorder.c",
|
||||
"FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/trcStreamingRecorder.c",
|
||||
"FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/File/trcStreamingPort.c",
|
||||
]
|
||||
|
||||
# Build the simple "blinky" demo application, or the full test
|
||||
# applicaton?
|
||||
if GetOption("simple"):
|
||||
env.Append(CPPDEFINES = [
|
||||
"mainCREATE_SIMPLE_BLINKY_DEMO_ONLY=1",
|
||||
])
|
||||
|
||||
env.Program("posix_demo", src)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* FreeRTOS Kernel V10.3.0
|
||||
* Copyright (C) 2020 Cambridge Consultants Ltd.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 AUTHORS OR
|
||||
* COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Example console I/O wrappers.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <semphr.h>
|
||||
|
||||
SemaphoreHandle_t xStdioMutex;
|
||||
StaticSemaphore_t xStdioMutexBuffer;
|
||||
|
||||
void console_init(void)
|
||||
{
|
||||
xStdioMutex = xSemaphoreCreateMutexStatic(&xStdioMutexBuffer);
|
||||
}
|
||||
|
||||
void console_print(const char *fmt, ...)
|
||||
{
|
||||
va_list vargs;
|
||||
|
||||
va_start(vargs, fmt);
|
||||
|
||||
xSemaphoreTake(xStdioMutex, portMAX_DELAY);
|
||||
|
||||
vprintf(fmt, vargs);
|
||||
|
||||
xSemaphoreGive(xStdioMutex);
|
||||
|
||||
va_end(vargs);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* FreeRTOS Kernel V10.3.0
|
||||
* Copyright (C) 2020 Cambridge Consultants Ltd.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 AUTHORS OR
|
||||
* COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
#ifndef CONSOLE_H
|
||||
#define CONSOLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Example console I/O wrappers.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
void console_init(void);
|
||||
void console_print(const char *fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONSOLE_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* FreeRTOS Kernel V10.3.0
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. 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.
|
||||
*
|
||||
* 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 AUTHORS OR
|
||||
* COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
* Utility functions required to gather run time statistics. See:
|
||||
* http://www.freertos.org/rtos-run-time-stats.html
|
||||
*
|
||||
* Note that this is a simulated port, where simulated time is a lot slower than
|
||||
* real time, therefore the run time counter values have no real meaningful
|
||||
* units.
|
||||
*
|
||||
* Also note that it is assumed this demo is going to be used for short periods
|
||||
* of time only, and therefore timer overflows are not handled.
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include <FreeRTOS.h>
|
||||
|
||||
/* Time at start of day (in ns). */
|
||||
static unsigned long ulStartTimeNs;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vConfigureTimerForRunTimeStats( void )
|
||||
{
|
||||
struct timespec xNow;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &xNow);
|
||||
ulStartTimeNs = xNow.tv_sec * 1000000000ul + xNow.tv_nsec;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long ulGetRunTimeCounterValue( void )
|
||||
{
|
||||
struct timespec xNow;
|
||||
|
||||
/* Time at start. */
|
||||
clock_gettime(CLOCK_MONOTONIC, &xNow);
|
||||
|
||||
return xNow.tv_sec * 1000000000ul + xNow.tv_nsec - ulStartTimeNs;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user