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

Remove default behaviour of FREERTOS_HEAP. #807

Merged
merged 8 commits into from
Oct 23, 2023

Conversation

conara
Copy link
Contributor

@conara conara commented Sep 23, 2023

To build a complete static application (configSUPPORT_DYNAMIC_ALLOCATION set to 0) an ugly workaround is necessary. When FREERTOS_HEAP (CMake variable) is not set, heap 4 is automatically selected in the current CMake. Without this change I got the following error:

/home/boris/workspace/base/external/freertos/portable/MemMang/heap_4.c:51:6: error: #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0 51 | #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0

For additional context, please read: https://forums.freertos.org/t/i-cannot-build-a-complete-static-application-bug-or-feature/9553


I opted to modify the default behavior of the FREERTOS_HEAP CMake variable because I believe it's essential for the user to be conscious of the chosen heap implementation. While another option was to introduce a magic variable to prevent automatic heap implementation selection, I find this approach to be the most straightforward and logical one.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

To build a complete static application (configSUPPORT_DYNAMIC_ALLOCATION
set to 0) an ugly workaround is necessary, because when FREERTOS_HEAP is
not set, heap 4 is automatically selected in the current CMake.
@conara conara requested a review from a team as a code owner September 23, 2023 16:00
@jputcu
Copy link
Contributor

jputcu commented Sep 24, 2023

I'm facing the same issue. Found some older related tickets: #594 and #595

@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7562ebc) 93.64% compared to head (550f0ab) 93.64%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #807   +/-   ##
=======================================
  Coverage   93.64%   93.64%           
=======================================
  Files           6        6           
  Lines        2549     2549           
  Branches      608      608           
=======================================
  Hits         2387     2387           
  Misses        107      107           
  Partials       55       55           
Flag Coverage Δ
unittests 93.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@archigup
Copy link
Member

Hey, thanks for the PR! We're discussing what the best way to solve this issue is, and will get back to you.

@conara
Copy link
Contributor Author

conara commented Oct 12, 2023

Hey, thanks for the PR! We're discussing what the best way to solve this issue is, and will get back to you.

Can you give me an update on this point?

@ActoryOu
Copy link
Member

Hi @conara,
Sorry for late response. We'll get on this by next Friday.

Thanks.

@sonarcloud
Copy link

sonarcloud bot commented Oct 23, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ActoryOu ActoryOu merged commit 9f4a0e3 into FreeRTOS:main Oct 23, 2023
17 checks passed
n9wxu pushed a commit to n9wxu/FreeRTOS-Kernel that referenced this pull request Oct 26, 2023
To build a complete static application (configSUPPORT_DYNAMIC_ALLOCATION
set to 0) an ugly workaround is necessary, because when FREERTOS_HEAP is
not set, heap 4 is automatically selected in the current CMake.

Co-authored-by: kar-rahul-aws <[email protected]>
Co-authored-by: chinglee-iot <[email protected]>
Co-authored-by: Gaurav-Aggarwal-AWS <[email protected]>
Co-authored-by: Soren Ptak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants