Skip to content

Commit

Permalink
Add demo for a simple test which passes
Browse files Browse the repository at this point in the history
  • Loading branch information
kstribrnAmzn committed Mar 27, 2024
1 parent 2c2dfae commit 935a3e3
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ SET(FREERTOS_DEMO_SOURCES
${DEMO_DIR}/source/queue_demo.c
${DEMO_DIR}/source/reg_test.c
${DEMO_DIR}/source/reg_test_GCC.S
${DEMO_DIR}/source/test_passed_task.c
)

# Source files used for the Board Support Package
Expand Down Expand Up @@ -186,17 +187,24 @@ ADD_EXECUTABLE(RM46_FreeRTOS_Notification_Demo.out
${FREERTOS_DEMO_SOURCES}
)

# Create Notification Demo executable
ADD_EXECUTABLE(RM46_FreeRTOS_Test_Passed_Demo.out
${FREERTOS_DEMO_SOURCES}
)

# These options are explained in the demo_tasks.h file
SET_TARGET_PROPERTIES(RM46_FreeRTOS_Full.out PROPERTIES COMPILE_DEFINITIONS "mainDEMO_TYPE=0x1F")
SET_TARGET_PROPERTIES(RM46_FreeRTOS_Register_Demo.out PROPERTIES COMPILE_DEFINITIONS "mainDEMO_TYPE=0x1")
SET_TARGET_PROPERTIES(RM46_FreeRTOS_Queue_Demo.out PROPERTIES COMPILE_DEFINITIONS "mainDEMO_TYPE=0x2")
SET_TARGET_PROPERTIES(RM46_FreeRTOS_MPU_Demo.out PROPERTIES COMPILE_DEFINITIONS "mainDEMO_TYPE=0x4")
SET_TARGET_PROPERTIES(RM46_FreeRTOS_IRQ_Demo.out PROPERTIES COMPILE_DEFINITIONS "mainDEMO_TYPE=0x8")
SET_TARGET_PROPERTIES(RM46_FreeRTOS_Notification_Demo.out PROPERTIES COMPILE_DEFINITIONS "mainDEMO_TYPE=0x10")
SET_TARGET_PROPERTIES(RM46_FreeRTOS_Test_Passed_Demo.out PROPERTIES COMPILE_DEFINITIONS "mainDEMO_TYPE=0x20")

TARGET_LINK_LIBRARIES(RM46_FreeRTOS_Full.out FREERTOS_PORT FREERTOS_KERNEL TI_BOARD_SUPPORT_PACKAGE )
TARGET_LINK_LIBRARIES(RM46_FreeRTOS_Register_Demo.out FREERTOS_PORT FREERTOS_KERNEL TI_BOARD_SUPPORT_PACKAGE )
TARGET_LINK_LIBRARIES(RM46_FreeRTOS_Queue_Demo.out FREERTOS_PORT FREERTOS_KERNEL TI_BOARD_SUPPORT_PACKAGE )
TARGET_LINK_LIBRARIES(RM46_FreeRTOS_MPU_Demo.out FREERTOS_PORT FREERTOS_KERNEL TI_BOARD_SUPPORT_PACKAGE )
TARGET_LINK_LIBRARIES(RM46_FreeRTOS_IRQ_Demo.out FREERTOS_PORT FREERTOS_KERNEL TI_BOARD_SUPPORT_PACKAGE )
TARGET_LINK_LIBRARIES(RM46_FreeRTOS_Notification_Demo.out FREERTOS_PORT FREERTOS_KERNEL TI_BOARD_SUPPORT_PACKAGE )
TARGET_LINK_LIBRARIES(RM46_FreeRTOS_Test_Passed_Demo.out FREERTOS_PORT FREERTOS_KERNEL TI_BOARD_SUPPORT_PACKAGE )
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@
/** @brief Demo that uses the Task Notification APIs */
#define NOTIFICATION_DEMO 0x10

/** @brief Demo which prints out a 'test passed' message on loop */
#define HELLO_WORLD_DEMO 0x20

/** @brief Build Register, Queue, MPU, IRQ, and Notification demos */
#define FULL_DEMO ( REGISTER_DEMO | QUEUE_DEMO | MPU_DEMO | IRQ_DEMO | NOTIFICATION_DEMO )
#define FULL_DEMO ( REGISTER_DEMO | QUEUE_DEMO | MPU_DEMO | IRQ_DEMO | NOTIFICATION_DEMO | HELLO_WORLD_DEMO )

/** @brief Bitfield used to select the Demo Tasks to build and run
*
Expand Down Expand Up @@ -103,6 +106,9 @@
#define demoNOTIFICATION_TASK_PRIORITY \
( configTIMER_TASK_PRIORITY + 1UL ) | portPRIVILEGE_BIT

/** @brief Bogus priority for the 'test passed' task. */
#define demoTEST_PASSED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1UL )

/* ------------------------------- Register Test Tasks ------------------------------- */

/* @brief ASM function in reg_test_GCC.S that tests proper context swaps. */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
* Copyright (C) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
*
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/

/* Standard includes. */
#include <stdint.h>

/* FreeRTOS includes. */
#include "FreeRTOSConfig.h"
#include "FreeRTOS.h"
#include "task.h"
#include "portmacro.h"

/* HalCoGen includes. */
#include "sci.h"

#include "demo_tasks.h"

/** @brief TCB used by the Notification Test Task */
static StaticTask_t xTestPassedTaskTCB;

/** @brief MPU Region Aligned Stack used by the Notification Test Task */
static StackType_t uxTestPassedTaskStack[ configMINIMAL_STACK_SIZE ]
__attribute__( ( aligned( configMINIMAL_STACK_SIZE * 0x4UL ) ) );

static void testPassedTask(void * pvParameters)
{
while(1)
{
sci_print( "Test Passed from task.\r\n" );
vTaskDelay(pdMS_TO_TICKS(250));
}
}

BaseType_t xCreateTestPassedTask( void *)
{
BaseType_t xReturn = pdFAIL;
xReturn = xTaskCreateStatic(testPassedTask, "testPassedTask", configMINIMAL_STACK_SIZE, NULL, demoTEST_PASSED_TASK_PRIORITY | portPRIVILEGE_BIT, uxTestPassedTaskStack, &xTestPassedTaskTCB);
return xReturn;
}

0 comments on commit 935a3e3

Please sign in to comment.