diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/FreeRTOSConfig.h index 91e32845..68193f52 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/FreeRTOSConfig.h @@ -56,7 +56,7 @@ extern void vAssertCalled( void ); #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 2000 ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 900 ) ) #define configMAX_TASK_NAME_LEN ( 10 ) -#define configUSE_TRACE_FACILITY 1 +#define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 #define configUSE_CO_ROUTINES 0 diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile index 73476fee..21b9a6e0 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile @@ -58,11 +58,17 @@ ifeq ($(FULL_DEMO), 1) INCLUDE_DIRS += -I${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/Include/ CFLAGS := -DmainCREATE_FULL_DEMO_ONLY=1 +else +ifeq ($(INCREASING_DEMO), 1) + SOURCE_FILES += main_increasing.c + + CFLAGS := -DmainCREATE_INCREASING_DEMO=1 else SOURCE_FILES += main_blinky.c CFLAGS := -DmainCREATE_SIMPLE_BLINKY_DEMO_ONLY=1 endif +endif DEFINES := -DQEMU_SOC_MPS2 -DHEAP3 diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main.c index c1418812..b1acde9b 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main.c @@ -63,6 +63,10 @@ int main() { main_full(); } + #elif ( mainCREATE_INCREASING_DEMO == 1 ) + { + main_increasing(); + } #else { #error "Invalid Selection...\nPlease Select a Demo application from the main command" diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_increasing.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_increasing.c new file mode 100644 index 00000000..dabf68cb --- /dev/null +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_increasing.c @@ -0,0 +1,136 @@ +/* + * FreeRTOS V202111.00 + * 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. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +#include +#include +#include +#include + +__attribute__((noinline)) static void trigger_Qemu_break( void ) +{ + puts("Trigger"); +} +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); + +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_LENGTH ( 1 ) +#define mainQUEUE_SEND_FREQUENCY_MS ( 10 / portTICK_PERIOD_MS ) +/* The queue used by both tasks. */ +static QueueHandle_t xQueue = NULL; + +void main_increasing( void ) +{ + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned char ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */ + "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + NULL, /* The parameter passed to the task - not used in this case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, + "TX", + configMINIMAL_STACK_SIZE, + NULL, + mainQUEUE_SEND_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 on the FreeRTOS heap + * http://www.freertos.org/a00111.html. */ + for( ; ; ) + { + } +} + +volatile unsigned char FUZZ_INPUT[4096] = {33}; +volatile uint32_t FUZZ_LENGTH = 32; + +volatile unsigned char last_value = 32; // ascii space + +static void prvQueueSendTask( void * pvParameters ) +{ + unsigned char ulValueToSend = 0; + /* Remove compiler warning about unused parameter. */ + ( void ) pvParameters; + + for(int i=0; i last_value && ulReceivedValue < 127) + { + last_value = ulReceivedValue; + //Some computation which depends on the value recieved + int t = 0; + for (int i=1; i