One can generate the .mem file by running the lm8 deployment tool once you compile and link your source code. The deployment tool is a Perl script that extracts the LatticeMico8 executable program from the .elf file.
Use the following command to generate the .mem file:
#perl lm8-deployer.pl
One must ensure that your present working directory should contain both lm8-deployer.pl and the .elf file.
If the path to bin_to_verilog.exe is not set properly, then .mem file will not be generated.