That assertions indicates that an attempt to release a mutex not owned.
Could you post the stack trace at that point?
Giovanni
chibiOS 3 'chHeapAlloc' usage
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: chibiOS 3 'chHeapAlloc' usage
This is a trace from the main thread.
Code: Select all
#0 chSysHalt (reason=reason@entry=0x80036f0 <__func__.6584> "chMtxUnlock")
at ../../../os/rt/src/chsys.c:164
#1 0x08001262 in chMtxUnlock (mp=mp@entry=0x20001630 <default_heap+16>)
at ../../../os/rt/src/chmtx.c:327
#2 0x080018e2 in chHeapAlloc (heapp=0x20001620 <default_heap>,
heapp@entry=0x0, size=size@entry=64) at ../../../os/rt/src/chheap.c:185
#3 0x08002b40 in initWithSizeAndIncRate (list=0x200007e8,
list@entry=0x200007c8, size=size@entry=16, rate=rate@entry=50)
at ArrayList.c:26
#4 0x08002b68 in initWithSize (size=16, list=list@entry=0x200007c8)
at ArrayList.c:19
#5 init (list=list@entry=0x200007e8) at ArrayList.c:14
#6 0x080001e4 in main () at main.c:96
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: chibiOS 3 'chHeapAlloc' usage
It makes no sense. Heap allocator is used in a lot of places so it cannot just fail that way, there must be something else not so evident.
Giovanni
Giovanni
Re: chibiOS 3 'chHeapAlloc' usage
@Giovanni:
Is the mutex not owned by the thread? How can I check this?
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: chibiOS 3 'chHeapAlloc' usage
It cannot be not taken because chHeapAlloc() does that at very beginning....
This makes me think the problem is not so obvious. Do you use allocator functions in other places of the code? is it possible you have stack overflows?
Giovanni
This makes me think the problem is not so obvious. Do you use allocator functions in other places of the code? is it possible you have stack overflows?
Giovanni
Re: chibiOS 3 'chHeapAlloc' usage
OOOhhhh, I use alloc before halinit and chSysInit. I think this is a bad idea.
My __main_stack_size__=0x400. So I think I'm save here on stack size.
My __main_stack_size__=0x400. So I think I'm save here on stack size.
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times