Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(Other): Use FreeRTOS Heap Allocation Scheme 4, Allow Changing FreeRTOS Heap Allocation Scheme #1052

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Examples/MAX78000/FreeRTOSDemo/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ DEBUG=1

LIB_FREERTOS = 1

# Can provide a value for the FREERTOS heap allocation scheme
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of documenting this here, you can add some info to the UG.

See here for an example for the SDHC library.

The FreeRTOS lib hasn't had any options before, so I'd suggest adding a similar table

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! I'll update once this has been added.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be good now 👍

# Default value is 4
# FREERTOS_HEAP_TYPE := 2
# export FREERTOS_HEAP_TYPE

ifeq ($(BOARD),Aud01_RevA)
$(error ERR_NOTSUPPORTED: This project is not supported for the Audio board)
endif
19 changes: 18 additions & 1 deletion Libraries/FreeRTOS/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,29 @@ SRCS = list.c
SRCS += queue.c
SRCS += tasks.c
SRCS += port.c
SRCS += heap_2.c
SRCS += timers.c
SRCS += croutine.c
SRCS += event_groups.c
SRCS += stream_buffer.c

# Setup a default heap allocation mechanism
# Default val is 4, which is recommended to best avoid heap fragmentation
FREERTOS_HEAP_TYPE ?= 4

ifeq ($(FREERTOS_HEAP_TYPE), 1)
SRCS += heap_1.c
else ifeq ($(FREERTOS_HEAP_TYPE), 2)
SRCS += heap_2.c
else ifeq ($(FREERTOS_HEAP_TYPE), 3)
SRCS += heap_3.c
else ifeq ($(FREERTOS_HEAP_TYPE), 4)
SRCS += heap_4.c
else ifeq ($(FREERTOS_HEAP_TYPE), 5)
SRCS += heap_5.c
else
$(error FREERTOS_HEAP_TYPE must be between 1-5. Default: 4)
endif

# Where to find source files for this project
VPATH = Source/portable/GCC/ARM_CM4F
VPATH += Source/portable/MemMang
Expand Down
6 changes: 6 additions & 0 deletions USERGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2212,6 +2212,12 @@ Once enabled, the following [build configuration variables](#build-configuration

FreeRTOS is supported by all parts in the MSDK. See the `FreeRTOSDemo` example application.

#### FreeRTOS Build Variables

| Configuration Variable | Description | Details |
| ---------------------- | ---------------------------------------------------------- | ------------------------------------------------------------ |
| `FREERTOS_HEAP_TYPE` | Specify the method of heap allocation to use for the FreeRTOS API | FreeRTOS provides options for the heap management alogirthms to optimize for memory size, speed, and risk of heap fragmentation. For more details, visit the [FreeRTOS MemMang Docs](https://www.freertos.org/a00111.html). Acceptable values are `1`, `2`, `3`, `4`, or `5`. The default value is `4` for heap_4. |

#### FreeRTOS-Plus

[FreeRTOS-Plus](https://www.freertos.org/FreeRTOS-Plus/index.html) is an additional library that implements addon functionality for the FreeRTOS kernel. The MSDK maintains support for some, but not all, available addons.
Expand Down
Loading