Hi slava,
Here is an idea for you to try. The original error you got was:
Error: command "quartus_map --generate_hdl_interface=C:/projects/NIOS_JPEG/ce_temp_directory/avalon_adv202.v ce_temp_directory/ce_temp_quartus_project" returned 3
quartus_map is one of the Quartus II commandline exe scripts when you run Quartus II in a dos prompt (make sure you have the quartus bin dir in your path).
Why not make a copy of your design avalon_adv202.v and run the exact command that is failing.
i.e.
quartus_map --generate_hdl_interface=C:/projects/NIOS_JPEG/test_dir/avalon_adv202.v C:/projects/NIOS_JPEG/test_dir/avalon_adv202
Perhaps it might show some errors that the GUI is not displaying.
You can pass your finding to the Altera support center - perhaps there is some incompatability in your verilog code that 5.1 is catching like `include or recurisive parameters.
I hope this helps.
Regards,
-ATJ