Hi,
how can I check that RT is ready and it is possible to call chHeapAlloc?
how to check that chHeapAlloc can do the job
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: how to check that chHeapAlloc can do the job
Hi,
After calling chSysInit() you can do anything, no need to check.
Giovanni
After calling chSysInit() you can do anything, no need to check.
Giovanni
Re: how to check that chHeapAlloc can do the job
Giovanni,
the problem is that there is no way to call it before:
std::vector<int> v1 = {1, 2};
so I need to check what to call in new operator: malloc or chHeapAlloc
the problem is that there is no way to call it before:
std::vector<int> v1 = {1, 2};
so I need to check what to call in new operator: malloc or chHeapAlloc
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: how to check that chHeapAlloc can do the job
Calling malloc or chHeapAlloc in the same system does not look like a good idea, those share the same heap so problems are to be expected.
Consider that ChibiOS syscall.c uses the memory core allocator, so even using malloc before chSysInit is not going to work. You need to defer those allocations.
Giovanni
Consider that ChibiOS syscall.c uses the memory core allocator, so even using malloc before chSysInit is not going to work. You need to defer those allocations.
Giovanni