Page 1 of 1

issues with memory pool

Posted: Sat Dec 03, 2016 4:22 pm
by golb
hello I am trying to configure a memory pool in chibios,

however I keep getting this error every time I try to build the project:
Description Resource Path Location Type
unknown type name 'MemoryPool' main.c /Proyecto_Micro line 17 C/C++ Problem

this is the section of my code where the error is popping up:

Code: Select all

typedef struct {
  adcsample_t Sample[ADC_NUM_CHAN*ADC_BUFFER_DEPTH];
} ADC_Conversion;

MemoryPool Conv_pool;

ADC_Conversion Conv_Sample[MB_BUFFER_SIZE];


I know from reading other forums that I am supposed to align my structure to the stack, however that too was giving me an error...
I am clueless on how to do this properly, could someone pls help me figure this out.

Re: issues with memory pool

Posted: Sat Dec 03, 2016 4:53 pm
by Marco
Hi,

What version of ChibiOS are you using? In 16.1.5 the type for a memory pool is memory_pool_t, not MemoryPool. I think MemoryPool was renamed to memory_pool_t when moving from version 2.6.x to 3.0.x.

Marco

Re: issues with memory pool

Posted: Sat Dec 03, 2016 5:18 pm
by golb
while looking through the .h on my projects I found: "chmempools.h" and found out that it is indeed as you just pointed out, some function names have also changed..

I fixed the code, and I'm going to try it out now.

thank you very much.

Re: issues with memory pool

Posted: Sat Dec 03, 2016 5:30 pm
by Giovanni
Hi,

Some migration notes from 2.6.x are in this article:

http://www.chibios.org/dokuwiki/doku.ph ... rom_2_to_3

Giovanni

Re: issues with memory pool

Posted: Sun Dec 04, 2016 1:35 pm
by golb
Thank you for you help yesterday guys.

I was wondering if there was a function that allowed me to know the amount of free objects in the pool...
I've been trying to check this using sizeof, but thinking about it more deeply, it wouldnt really give me any useful information regarding the amount of
free objects in the pool.

thanks in advance for you help.