I am trying to run the LZO compression algorithm on an MSP430FR5994 launchpad. The version I choose is 2.06.
The program I run is testmini.c, which is an example code for the algorithm.
Here is the error message and corresponding code snippet.
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp))
"../minilzo.c", line 1982: error #95: the size of an array must be greater than zero
static unsigned char __LZO_MMODEL in [ IN_LEN ];
static unsigned char __LZO_MMODEL out [ OUT_LEN ];
.
.
.
static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS);
"../main.c", line 31: error #96: array is too large
I found a similar issue on the TI forum. I change Code Composer Studio compiler from T1 v21.6.0.LTS to GNU v9.3.0.31 (Mitto Systems Limited)
After change the compiler, the code build and load to lauchpad successfully.
The program using miniLZO(LZO) algorithm need to call lzo_init() first.
It failed to run lzo_init() on my launchpad, which mean the return of lzo_init() is not LZO_E_OK.
if (lzo_init() != LZO_E_OK)
{
printf("internal error - lzo_init() failed !!!\n");
printf("(this usually indicates a compiler bug - try recompiling\nwithout optimizations, and enable '-DLZO_DEBUG' for diagnostics)\n");
return 3;
}
In the README.LZO file:
If you are running on a very unusual architecture and lzo_init() fails then
you should first recompile with '-DLZO_DEBUG' to see what causes the failure.
The most probable case is something like 'sizeof(void *) != sizeof(size_t)'.
After identifying the problem you can compile by adding some defines
like '-DSIZEOF_VOID_P=8' to your Makefile.
The best solution is (of course) using Autoconf - if your project uses
Autoconf anyway just add '-DMINILZO_HAVE_CONFIG_H' to your compiler
flags when compiling minilzo.c. See the LZO distribution for an example
how to set up configure.ac.
I don't know how to "enable '-DLZO_DEBUG' for diagnostics", and don't know how to apply the solution mentioned in the README.LZO to Code Composer Studio compiler.
I hope someone knows how to solve it. Thank you very much.