Skip to content

Commit 3e74beb

Browse files
Add CMake configuration and FreeRTOS POSIX simulation config
Co-Authored-By: daniele@wolfssl.com <daniele@wolfssl.com>
1 parent 4275b4e commit 3e74beb

2 files changed

Lines changed: 110 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
project(freertos_wolfssl_demo C)
3+
4+
# Set C standard
5+
set(CMAKE_C_STANDARD 11)
6+
set(CMAKE_C_STANDARD_REQUIRED ON)
7+
8+
# FreeRTOS Kernel source files for POSIX port
9+
set(FREERTOS_PORT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/freertos/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix)
10+
set(FREERTOS_HEAP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/freertos/FreeRTOS-Kernel/portable/MemMang)
11+
12+
# Include directories
13+
include_directories(
14+
${CMAKE_CURRENT_SOURCE_DIR}/include
15+
${CMAKE_CURRENT_SOURCE_DIR}/freertos/FreeRTOS-Kernel/include
16+
${FREERTOS_PORT_DIR}
17+
)
18+
19+
# FreeRTOS source files
20+
set(FREERTOS_SOURCES
21+
${CMAKE_CURRENT_SOURCE_DIR}/freertos/FreeRTOS-Kernel/tasks.c
22+
${CMAKE_CURRENT_SOURCE_DIR}/freertos/FreeRTOS-Kernel/queue.c
23+
${CMAKE_CURRENT_SOURCE_DIR}/freertos/FreeRTOS-Kernel/list.c
24+
${CMAKE_CURRENT_SOURCE_DIR}/freertos/FreeRTOS-Kernel/timers.c
25+
${CMAKE_CURRENT_SOURCE_DIR}/freertos/FreeRTOS-Kernel/event_groups.c
26+
${CMAKE_CURRENT_SOURCE_DIR}/freertos/FreeRTOS-Kernel/stream_buffer.c
27+
${FREERTOS_PORT_DIR}/port.c
28+
${FREERTOS_HEAP_DIR}/heap_3.c
29+
)
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#ifndef FREERTOS_CONFIG_H
2+
#define FREERTOS_CONFIG_H
3+
4+
/* Scheduler Related */
5+
#define configUSE_PREEMPTION 1
6+
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
7+
#define configUSE_TICKLESS_IDLE 0
8+
#define configCPU_CLOCK_HZ ( ( unsigned long ) 60000000 )
9+
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
10+
#define configMAX_PRIORITIES 5
11+
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 4096 )
12+
#define configMAX_TASK_NAME_LEN 16
13+
#define configUSE_16_BIT_TICKS 0
14+
#define configIDLE_SHOULD_YIELD 1
15+
#define configUSE_TASK_NOTIFICATIONS 1
16+
#define configTASK_NOTIFICATION_ARRAY_ENTRIES 3
17+
#define configUSE_MUTEXES 1
18+
#define configUSE_RECURSIVE_MUTEXES 1
19+
#define configUSE_COUNTING_SEMAPHORES 1
20+
#define configQUEUE_REGISTRY_SIZE 10
21+
#define configUSE_QUEUE_SETS 0
22+
#define configUSE_TIME_SLICING 1
23+
#define configUSE_NEWLIB_REENTRANT 0
24+
#define configENABLE_BACKWARD_COMPATIBILITY 0
25+
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5
26+
#define configUSE_MINI_LIST_ITEM 1
27+
28+
/* Memory allocation related definitions. */
29+
#define configSUPPORT_STATIC_ALLOCATION 0
30+
#define configSUPPORT_DYNAMIC_ALLOCATION 1
31+
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 60 * 1024 ) )
32+
#define configAPPLICATION_ALLOCATED_HEAP 0
33+
34+
/* Hook function related definitions. */
35+
#define configUSE_IDLE_HOOK 0
36+
#define configUSE_TICK_HOOK 0
37+
#define configCHECK_FOR_STACK_OVERFLOW 0
38+
#define configUSE_MALLOC_FAILED_HOOK 0
39+
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
40+
41+
/* Run time and task stats gathering related definitions. */
42+
#define configGENERATE_RUN_TIME_STATS 0
43+
#define configUSE_TRACE_FACILITY 0
44+
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
45+
46+
/* Co-routine related definitions. */
47+
#define configUSE_CO_ROUTINES 0
48+
#define configMAX_CO_ROUTINE_PRIORITIES 1
49+
50+
/* Software timer related definitions. */
51+
#define configUSE_TIMERS 1
52+
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
53+
#define configTIMER_QUEUE_LENGTH 10
54+
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
55+
56+
/* Define to trap errors during development. */
57+
#define configASSERT( x )
58+
59+
/* Optional functions - most linkers will remove unused functions anyway. */
60+
#define INCLUDE_vTaskPrioritySet 1
61+
#define INCLUDE_uxTaskPriorityGet 1
62+
#define INCLUDE_vTaskDelete 1
63+
#define INCLUDE_vTaskSuspend 1
64+
#define INCLUDE_xResumeFromISR 1
65+
#define INCLUDE_vTaskDelayUntil 1
66+
#define INCLUDE_vTaskDelay 1
67+
#define INCLUDE_xTaskGetSchedulerState 1
68+
#define INCLUDE_xTaskGetCurrentTaskHandle 1
69+
#define INCLUDE_uxTaskGetStackHighWaterMark 0
70+
#define INCLUDE_xTaskGetIdleTaskHandle 0
71+
#define INCLUDE_eTaskGetState 0
72+
#define INCLUDE_xEventGroupSetBitFromISR 1
73+
#define INCLUDE_xTimerPendFunctionCall 0
74+
#define INCLUDE_xTaskAbortDelay 0
75+
#define INCLUDE_xTaskGetHandle 0
76+
#define INCLUDE_xTaskResumeFromISR 1
77+
78+
/* POSIX Port specific definitions. */
79+
#define configPOSIX_STACK_SIZE ( ( unsigned short ) 8192 )
80+
81+
#endif /* FREERTOS_CONFIG_H */

0 commit comments

Comments
 (0)