heap_usenewlib_NXP confusion

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

heap_usenewlib_NXP confusion

953 Views
Embedded_Noob
Contributor II

Hello,

 

I'm currently trying to set up heap_usenewlib_NXP.c with my project in MCUXpresso. I'm following Nadler's article here https://nadler.com/embedded/newlibAndFreeRTOS.html. What's confusing me is "Exclude from all builds any current sbrk implementation". I'm using NewlibNano and I think it is precompiled. So, is it even possible to exclude sbrk? My use-case is a single FreeRTOS task running tests on a MIMXRT1170-EVK board. Some of the tests I'm running use the STL, which use malloc. I tried overwriting the malloc family of functions to use only FreeRTOS heap management, but this doesn't work as some newlib functions will not use my custom malloc implementation (strong linked?).

 

Since I don't think the sbrk provided in heap_usenewlib_NXP was being used, I tried only using the implementation of FreeRTOS's memory API (the functions at the bottom of https://github.com/DRNadler/FreeRTOS_helpers/blob/master/heap_useNewlib_NXP.c). But, this is resulting in MMARVALID and DACCVIOL errors.

 

All I want is a single FreeRTOS task to run these tests, with a working heap.

 

Any help would be greatly appreciated,

 

Thanks!

0 Kudos
3 Replies

926 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi @Embedded_Noob :

 

I would suggest you refer to Erich's article: Using FreeRTOS with newlib and newlib-nano.

https://mcuoneclipse.com/2017/07/02/using-freertos-with-newlib-and-newlib-nano/

 

Regards

Daniel

0 Kudos

924 Views
Embedded_Noob
Contributor II

My problem with this article is the lack of instructions regarding how to remove any sbrk implementations from Newlib. I see that heap_usenewlib provides a new sbrk implementation, but won't newlib still continue to use its own sbrk implementation, since sbrk is a strong symbol in newlib?

0 Kudos

917 Views
ErichStyger
Senior Contributor V

You might consider rebuilding the library. See https://mcuoneclipse.com/2014/08/23/gnu-libs-with-debug-information-rebuilding-the-gnu-arm-libraries... how this could be done. The article is a bit dated, but the process is still the same.

Good luck!

0 Kudos