Hello
I want to compile the demo examples provided in TIOVX directly on the board. What libraries, header files, or other operations are required?
Based on the demo in the TIOVX User Guide, I have written the following code.
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <VX/vx.h> #include <TI/tivx.h> #define IN_FILE_NAME "./colors.bmp" #define OUT_FILE_NAME "./vx_image_load_save_out.bmp" int main(int argc, char *argv[]) { vx_context context; vx_image image; vx_uint32 width, height; if (appCommonInit() == 0) { tivxInit(); tivxHostInit(); /* Create OpenVX context */ context = vxCreateContext(); /* Create image object */ image = tivx_utils_create_vximage_from_bmpfile(context, IN_FILE_NAME, (vx_bool)vx_false_e); vxSetReferenceName((vx_reference)image, "BMP_IMAGE"); /* Query image object */ vxQueryImage(image, (vx_enum)VX_IMAGE_WIDTH, &width, sizeof(vx_uint32)); vxQueryImage(image, (vx_enum)VX_IMAGE_HEIGHT, &height, sizeof(vx_uint32)); printf("Loaded image of dimensions %dx%d\n", width, height); /* Save image object to bitmap file */ tivx_utils_save_vximage_to_bmpfile(OUT_FILE_NAME, image); /* Release image object */ vxReleaseImage(&image); /* Release context object */ vxReleaseContext(&context); tivxHostDeInit(); tivxDeInit(); appCommonDeInit(); } return EXIT_SUCCESS; }
And I have copied the corresponding header files needed for compilation.
tivx.h tivx_config.h tivx_debug.h tivx_event.h tivx_ext_raw_image.h tivx_ext_super_node.h tivx_kernels.h tivx_log_rt.h tivx_mem.h tivx_mutex.h tivx_nodes.h tivx_obj_desc.h tivx_queue.h tivx_soc.h tivx_soc_j721e.h tivx_target_kernel.h tivx_task.h tivx_tensor.h vx.h vx_api.h vx_compatibility.h vx_kernels.h vx_khr_pipelining.h vx_khr_user_data_object.h vx_nodes.h vx_types.h vx_vendors.h vxu.h
Modified the header file referenced in tivx.h from tivx_soc.h to tivx_soc_j721e.h, and successfully compiled using the following command.
gcc -o save_image save_image.c -ltivision_apps
When I run it, it shows a Segmentation fault, the full log information is as follows.
root@j721e-evm:~# ./save_image APP: Init ... !!! MEM: Init ... !!! MEM: Initialized DMA HEAP (fd=5) !!! MEM: Init ... Done !!! IPC: Init ... !!! IPC: Init ... Done !!! REMOTE_SERVICE: Init ... !!! REMOTE_SERVICE: Init ... Done !!! 8041.782433 s: GTC Frequency = 200 MHz APP: Init ... Done !!! 8041.782517 s: VX_ZONE_INIT:Enabled 8041.782527 s: VX_ZONE_ERROR:Enabled 8041.782536 s: VX_ZONE_WARNING:Enabled 8041.783296 s: VX_ZONE_INIT:[tivxInitLocal:130] Initialization Done !!! 8041.783754 s: VX_ZONE_INIT:[tivxHostInitLocal:101] Initialization Done for HOST !!! Segmentation fault (core dumped)