This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CCS/PROCESSOR-SDK-DRA8X-TDA4X:读取 tirtos 中的文件

Guru**** 3040340 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/883663/ccs-processor-sdk-dra8x-tda4x-read-file-in-tirtos

器件型号:PROCESSOR-SDK-DRA8X-TDA4X

工具/软件:Code Composer Studio

 您好:

          我    已经   运行  vision_apps\apps\basic_demos\app_tirtos\tirtos_linux\c66x_1

        然后  我  尝试  在      main 中读取一个文件 、如下所示 、   length_file 是正确 的、但   inimg_data[0]、inimg_data[2]、inimg_data[4]、inimg_data[6]   是错误的。

          ////////////////////////////////

   文件* fp_av_nv21_read = fopen ("../input_data.bin"、"rb");
   fseek (fp_av_nv21_read、0、seek_end);
   int   length_file = ftell (fp_av_nv21_read);

   unsigned char* inimg_data =(unsigned char*) appMemAlloc (app_uDMA_heap_ID、length_file、uDMA_CACHELINE_alignment);
   fseek (fp_av_nv21_read、0、seek_set);
   fread (inimg_data、sizeof (char)、length_file、fp_av_nv21_read);
   fclose (fp_av_nv21_read);
   printf ("length_file=%d、p0=%d、p2=%d、p4=%d、P6=%d、"、length_file、inimg_data[0]、inimg_data[2]、inimg_data[4]、 img_data[6]);

谢谢

Shuai

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    使用 printf 的提示之一 可以解决该问题。  如果没有、则需要处理器 SDK 专家的帮助。  我将通知他们有关该主题的信息。

    谢谢、此致、

    乔治

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Shuai、

    当您说错时、它是否全部为 NULL? 还是数据已移位? 是否已确保正确执行了 alloc? 由于您在 C66x 上运行此程序,我建议使用 CCS 并连接到此内核,在调用 fread()后单步执行并检查 inimg_data 变量。 因为在这里、printf 的解释可能会有点混乱、因为类型会变得混合等等。 请使用 CCS 进行调试,并告诉我在执行 fread()后发现了哪些异常。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好:    Anand

            它   printf   open 文件 recfile、 因此  fopen   存在 一些 问题。

    文件* fp_av_nv21_read = fopen ("input_data.bin"、"rb");
       IF (FP_ASV_nv21_read = NULL)
       {
          printf ("打开文件重新文件\n");
       }
       fseek (fp_av_nv21_read、0、seek_end);
       int   length_file = ftell (fp_av_nv21_read);
       unsigned char* inimg_data =(unsigned char*) appMemAlloc (app_MEM_heap_DDR、length_file、32);
       //unsigned char* inimg_data[200000];
       fseek (fp_av_nv21_read、0、seek_set);
       int readCnt = fread (inimg_data、sizeof (char)、length_file、fp_ASV_nv21_read);
       printf ("readCnt =%d\n"、readCnt);
       fclose (fp_av_nv21_read);
       printf ("length_file=%d、p0=%d、p2=%d、p4=%d、P6=%d\n"、length_file、inimg_data[0]、inimg_data[2]、inimg_data[4]、 img_data[6]);
       文件* fp_av_nv21_write = fopen ("output_data.bin"、"w+");
       int   writeCnt = fwrite (inimg_data、length_file、1、fp_av_nv21_write);
       printf ("writeCnt =%d\n"、writeCnt);
       fclose (fp_av_nv21_write);

    谢谢

    Shuai

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Shuai、

    问题可能与错误的文件路径一样简单。 您是否仔细检查过它? 您将文件放在 SD 卡的什么位置?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好: Anand

          我运行  这个  、使用 JTAG

       input_data.bin   与        .out    、I  TYR     文件的路径相同* fp_av_nv21_read = fopen ("input_data.bin"、"rb");   

    和 文件* fp_av_nv21_read = fopen ("../input_data.bin"、"rb");

    两个都失败  了!

    谢谢

    Shuai

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Shuai、

    这是因为我认为您是从 RTOS 内核执行它的。 SD 卡中的数据位于 ext4分区中、仅 Linux 可以看到该分区。 如果要在 RTOS 中读取文件、则需要有一个可由 MMCSD 驱动程序(可能是 FAT32)读取的分区、并且您的应用程序应使用这些 API 从文件中读取数据。 为什么仍然要在 RTOS 代码中读取文件? 您是否未在 A72上运行应用程序、然后使用 C66x DSP 进行处理? 如果您参加提供的任何演示、实际上从 SD 卡读取内容、它们会在 A72中执行此操作。 请告诉我您的确切要求是什么。 我可以给出相应的解决方案。