Linker error when compiling mmfv2_video_example

I’m running into a linker error while trying to build this example: ameba-rtos-pro2/project/realtek_amebapro2_v0_example/src/mmfv2_video_example at c4d145117c9410821aad08f1f1b74a168064a174 · Ameba-AIoT/ameba-rtos-pro2 · GitHub

Error:
[ 90%] Building C object application/CMakeFiles/application.ntz.dir/home/adarsh/Documents/realtek_amb82/ameba-rtos-pro2/component/video/osd2/osd_render.c.obj
/home/adarsh/Documents/realtek_amb82/ameba-rtos-pro2/component/video/osd2/osd_render.c: In function ‘canvas_create_bitmap’:
/home/adarsh/Documents/realtek_amb82/ameba-rtos-pro2/component/video/osd2/osd_render.c:56:6: warning: unused variable ‘pic_idx’ [-Wunused-variable]
56 | int pic_idx = ch * OSD_OBJ_MAX_NUM + available_block_idx[ch][idx];
| ^~~~~~~
/home/adarsh/Documents/realtek_amb82/ameba-rtos-pro2/component/video/osd2/osd_render.c: In function ‘osd_render_task’:
/home/adarsh/Documents/realtek_amb82/ameba-rtos-pro2/component/video/osd2/osd_render.c:162:14: warning: unused variable ‘buff_bmp’ [-Wunused-variable]
162 | uint8_t **buff_bmp = &(obj->bitmap[bimap_index].buff);
| ^~~~~~~~
[ 91%] Linking CXX executable application.ntz
/home/adarsh/Documents/realtek_amb82/asdk-10.3.0/linux/newlib/bin/../lib/gcc/arm-none-eabi/10.3.0/../../../../arm-none-eabi/bin/ld: warning: section .ram.bss' type changed to PROGBITS /home/adarsh/Documents/realtek_amb82/asdk-10.3.0/linux/newlib/bin/../lib/gcc/arm-none-eabi/10.3.0/../../../../arm-none-eabi/bin/ld: warning: section .ddr.bss’ type changed to PROGBITS
/usr/bin/objcopy: Unable to recognise the format of the input file `application.ntz.axf’
gmake[3]: *** [application/CMakeFiles/application.ntz.dir/build.make:3738: application/application.ntz] Error 1
gmake[3]: *** Deleting file ‘application/application.ntz’
gmake[2]: *** [CMakeFiles/Makefile2:474: application/CMakeFiles/application.ntz.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:192: CMakeFiles/flash.dir/rule] Error 2
gmake: *** [Makefile:151: flash] Error 2

Steps I did:

  1. Clone the repo.

  2. Run export PATH=/home/adarsh/Documents/realtek_amb82/asdk-10.3.0/linux/newlib/bin:$PATH

  3. From project/realtek_amebapro2_v0_example/GCC-RELEASE/build run cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DVIDEO_EXAMPLE=on

  4. Run cmake --build . --target flash

Any idea what might be missing from my environment?

Hi @k-adarsh ,

There are a few suggestions to fix this issue,

  1. Ensure that you have given permission for the whole repo, sudo chmod 777 -R .
  2. Verify that the toolchain is extracted properly and completely.
  3. You may choose to add the toolchain export PATH=/home/adarsh/Documents/realtek_amb82/asdk-10.3.0/linux/newlib/bin:$PATH to ~/.bashrc
  4. Perform a clean build, rm -r * on build folder.

Thank you.