Closed barnatahmed closed 5 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
8622bd5
) 93.64% compared to head (591671b
) 93.64%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hey @barnatahmed, thanks for this contribution, and nice catch on this issue with the CMake system!
This looks good to me, based off what I know about CMake. I've asked @archigup and @paulbartell to take a look at it as well since they're a more knowledgeable with CMake than I am
@barnatahmed I agree fully with your conclusion here. A single static library makes much more sense. However, there is an issue with your implementation. As-is, the objects generated by freertos_kernel_port will not be linked into the freertos_kernel static lib.
Could you do the following:
Thanks much, Paul
Hello @paulbartell and @Skptak, I hope you are feeling great today. Thank you very much for your replies. I checked my implementation and i made sure that the objects of the freertos_port target are actually linked to freertos_kernel static library. I dumped the symbols of freertos_kernel.a in text file and i found the files of freertos_port and its functions actually exist.
Anyway, I am much more convinced with the implementation suggested by @paulbartell. I will test and commit the new changes as soon as possible.
Thank you very much once again. Ahmed BARNAT
text file that contains the symbols of freeRTOS_kernel.a built after my first implementation. nul.txt
Kudos, no new issues were introduced!
0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication
Hello @paulbartell, i hope you are feeling great.
i modifed the /portable/CMakeLists.txt and now the "freertos_kernel_port_headers" is linked to "freertos_kernel_port" via PUBLIC keyword as you requested.
Thank you very much Ahmed BARNAT
I have been working with freeRTOS to integrate it in a project using cmake and i came across an issue that persists while working with FreeRTOS_PORT: GCC_ARM_CM4_MPU.
Host: windows 11 Target : stm32f411retx FreeRTOS_PORT: GCC_ARM_CM4_MPU
Description
I have read the CMakeLists.txt files of FreeRTOS to find out that it is creating two static libraries:
when working with some targets that don't use MPU, the kernel.a lib uses api from the port.a. However; The port.a is independent from the kernel.a. Therefore, in the linking phase would be successful if we link the kernel.a before the port.a. The order would be crutial.
the issue show up when i tried the integration on targets that uses MPU. While building, the project, the linking phase fails reporting that there are undefined refrences to some api's in kernel.a library and here is why:
-> the port.a library now contains "mpu_wrappers.c" source file that uses the apis developped in the kernel.a. As result the two static libraries ( port.a and kernel.a ) now depend from each other and whatever the order we give to linker it will eventually fail.
Proposed solution
All i had to do to fix this issue in my project is changing the target "freertos_kernel_port" from "STATIC" to "OBJECT" . the cmake will create only object files while building its targets. However, in /FreeRTOS_kernel/CMakeLists.txt line 258, the "freertos_kernel_port" target is being linked to "freertos_kernel" target created earlier in the same file (Line 233) which is "STATIC" library.
As conclusion, this modification will result only one final "STATIC" called "freertos_kernel.a" library containing all the sources of the freeRTOS kernel including the "portable" sources. Eventually, the issue is gone.
I tested this modification on other FREERTOS ports like GCC_ARM_CM4_MPU / GCC_ARM_CM4F / GCC_ARM_CM3_MPU / GCC_ARM_CM3 / GCC_ARM_CM0 / GCC_ARM_CM7 and it was working fine.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.