Skip to content

Commit

Permalink
heap: Remove TLSF related files and replace them with the tlsf submodule
Browse files Browse the repository at this point in the history
As the tlsf implementation is a fork from https://github.com/mattconte/tlsf,
the sources are moved to a separate repository and used as a submodule in the esp-idf instead.

In this commit:
- Removing TLSF related files and using tlsf submodule instead.

- Adding components/heap/tlsf_platform.h header gathering all IDF specifics.

- The multi_heap_poisoning.c provides the declaration of the
function block_absorb_post_hook() definied weak in the TLSF repository.

- The tlsf_platform.h includes the tlsf_common.h file after the definition
of FL_INDEX_MAX_PLATFORM macro to make sure that this macro will be available
in tlsf_common.h without having to include tlaf_platform.h from IDF in the
tlsf_common.h header from the TLSF repository.

- Add missing include from tlsf_block_functions.h in the multi_heap.c file.
Change related to the changes made in TLSF repository (tlsf_block_functions.h
no longer included in tlsf.h)
  • Loading branch information
SoucheSouche committed Aug 2, 2022
1 parent 4d0385d commit 3737bf8
Show file tree
Hide file tree
Showing 18 changed files with 111 additions and 1,453 deletions.
1 change: 1 addition & 0 deletions .gitlab/ci/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
- "components/spiffs/spiffs"
- "components/tinyusb/tinyusb"
- "components/unity/unity"
- "components/heap/tlsf"
- "examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib"
- ".gitmodules"

Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@
[submodule "components/bt/controller/lib_esp32c2/esp32c2-bt-lib"]
path = components/bt/controller/lib_esp32c2/esp32c2-bt-lib
url = ../../espressif/esp32c2-bt-lib.git

[submodule "components/heap/tlsf"]
path = components/heap/tlsf
url = ../../espressif/tlsf.git
13 changes: 11 additions & 2 deletions components/heap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ set(srcs
"heap_caps_init.c"
"multi_heap.c")

set(includes "include")

if(NOT CONFIG_HEAP_TLSF_USE_ROM_IMPL)
list(APPEND srcs "heap_tlsf.c")
set(priv_includes "tlsf")
list(APPEND srcs "tlsf/tlsf.c")
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
set_source_files_properties(tlsf/tlsf.c
PROPERTIES COMPILE_FLAGS
"-include ../tlsf_platform.h")
endif()
endif()

if(NOT CONFIG_HEAP_POISONING_DISABLED)
Expand All @@ -31,7 +39,8 @@ endif()


idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS include
INCLUDE_DIRS ${includes}
PRIV_INCLUDE_DIRS ${priv_includes}
LDFRAGMENTS linker.lf
PRIV_REQUIRES soc)

Expand Down
18 changes: 5 additions & 13 deletions components/heap/heap_private.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once

#include <stdlib.h>
Expand Down
18 changes: 5 additions & 13 deletions components/heap/heap_task_info.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
Expand Down
Loading

0 comments on commit 3737bf8

Please sign in to comment.