Invalid memory API call


#1

Hi

I make use of the boost libs. Under certain conditions, I get a “Invalid memory API call” trace. Unfortunately, the backtraces are not much help and I’ve been unable to step to the exact spot where it occurs using the debugger.

I’m pretty sure I’m causing it with a pointer I’m passing to boost, but the pointer looks valid when I pass it.

I cannot find any documentation on the error message I receive. Is it produced by the OS? What exactly does mean?

Any help would be greatly appreciated.

Backtrace:

Invalid memory API call
	Unknown function (67250)
	Unknown function (34387)
	Unknown function (3443d)
	Unknown function (2fee7)
	Unknown function (208d5)
	adlint_trcError+1a
	adlint_errHalt+44
	_sbrk+8
	_sbrk_r+10
	_malloc_r+28a
	_realloc_r+238
	realloc+10
	d_growable_string_callback_adapter+64
	d_demangle_callback+10e

#2

Hi,

I was just curious to know how could you use a C++ lib such as “boost” with OpenAT and what is the need :question:

Regards,
Paruthiv


#3

Boost is mostly just header files, and they work pretty well using the gcc EABI toolchain. I added the following compiler flags (Project settings->C/C++ Build->Settings->Miscellaneous):

-std=gnu++0x -Wno-write-strings  -Wno-comment -Wno-psabi

The only compiled boost lib I use is the serialization, but I built it using the ARM EABI gcc compiler that ships with Developer Studio. I just made sure to mimic the correct compiler flags as per DS. I built the libs as a static lib and then link it into my project like any other one. Boost was pretty easy, as it has a well documented cross-compile method, using the boost.build tool.

I think you should be able to use any third party lib that can be built with gcc/g++.


#4

Hi pierreandre!

It seems you are quite experienced with using third party libs in DS and Sierra Wireless modems.

I need some help, I am trying to use the third party C lib Mosquitto on my FXT009 but I am having some troubles getting it to work.

Is there any standard procedures one have to do to make third party libs work with Open AT OS?

Thanks!


#5

When porting code to Open AT Framework, you need to replace functions like realloc, alloc, free, strdup, exit, printf.
Open AT OS functions like adl_mem
and adl_trc* can be used for that purpose.

Also, functions involving stdio (open, read, write, close, tell, seek) can be replaced using adl_fs* (File System).