FreeRTOS and Bget

Hello List, I am working with FreeRTOS and LPC1768, I have a problem in accessing a library which uses bget internally. Unfortunately I don’t have library source and library is not giving any error – it’s keep in the loop. Without free RTOS the library works fine, but not after integrating to FreeRTOS. In all the means I can think something wrong with the memory access, but no clues to find out the problem. Can anybody please give a suggestion to find the problem in this ? And, FreeRTOS using normal malloc based allocator, only the library uses bget. Thanks in advance. Regards, Jeshwanth

FreeRTOS and Bget

I’m afraid I’m not familiar with bget (other than what I have just read online). What is the advantage of using it? How does the memory used by bget get allocated? Does the memory come from a statically allocated array? If so the linker will tell you if there is insufficient memory. If not, how can you be sure the memory being returned by bget is not overlapping with other memory?

FreeRTOS and Bget

Hi, The library is using it, I am forced to use bget now :). The memory for bget is allocated using bpool function: Example: bpool((void *)0x10006200, (1024 * 4)); It’s dynamically allocating the memory. So, linker can’t catch :(. Overlapping is one thing I need to consider, but looking at the map file the code not even reaching the base address of the bget. Thanks Regards, Jeshwanth

FreeRTOS and Bget

[this is not really a FreeRTOS issue, but interesting] Where is the heap used by malloc() located? Sometimes linker scripts just give it a start address, so it won’t appear in the memory map other than a single start address symbol. So is bpool just setting a base address, which it expects to find available. If so, perhaps use the linker script to block out that 4K of RAM, or alternatively declare a 4K array and place it at that address, so the linker knows its there. Then in the bpool function use the address of the array rather than a hard coded address so the compiler knows you are using it and doesn’t just optimise it away. Is 4K enough for it? Regards.

FreeRTOS and Bget

HEAP is located here: 0x10000150 0x00001400 Zero RW 350 .bss heap_2.o 0x10001550 0x00001000 Zero RW 1096 HEAP startuplpc17xx.o Yes, created a static array and assigned to bget but same thing happening. Yes, 4k memory is enough for the library. And I also observed now, bpool is executing properly, but the library call not coming out of it. Any other suggestions ?

FreeRTOS and Bget

I’m not sure what else to suggest. Perhaps you could re-implement the bget allocation and free functions locally so they just call the FreeRTOS versions. The linker should take your local version in preference to the library version. Regards.