Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    移植melis到v833时出现strcpy报错

    RTOS
    3
    5
    3775
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      blackjojo LV 2 last edited by blackjojo

      执行如下代码段时

      logd("IniParserInit");
      char ini_name[25]; 
      printf("ini_name addr  = %p\n",((void *)ini_name));
      strcpy(ini_name,"/data/etc/cedarx.conf");
      

      发现如下报错:
      20b1a6f1-9388-42ae-94a8-07b4e768d096-image.png
      ini_name的地址参数为:0xc064a962 ===>>>0xc064a962%4 = 2
      地址没有按照4字节对齐,在strcpy的时候搬用报错。
      91d7727a-59f0-4536-bfc1-2c61446d3e8f-image.png

      然后通过修改strcpy函数,改为newlibc库中的strcpy函数运行无问题,那么可以提供V833melis中的newlibc库的源码,排查么。或者可以提供v833melis的编译工具链源码么,v833melis的编译工具链和d1s的编译工具链差别在哪里?是否可以用d1s提供的编译工具链编译v833的melis版本么。

      WhycanService 1 Reply Last reply Reply Quote Share 0
      • WhycanService
        WhycanService LV 8 @blackjojo last edited by

        @blackjojo d1s是riscv架构,使用的是glibc,v833是arm架构,使用的是newlib

        N 1 Reply Last reply Reply Quote Share 0
        • N
          njlw315 LV 2 @WhycanService last edited by

          @whycanservice 目前我也是用newlibc,也出现该问题。请问该怎么解决?

          WhycanService 1 Reply Last reply Reply Quote Share 0
          • WhycanService
            WhycanService LV 8 @njlw315 last edited by

            @njlw315 为什么需要移植呢,v833有自己的melis

            N 1 Reply Last reply Reply Quote Share 0
            • N
              njlw315 LV 2 @WhycanService last edited by

              @whycanservice 没有移植。就是使用官方的melis ,在使用的过程中遇到了问题。strcpy 或者 strncpy 非4字节对齐,余数为1的时间,必现错误。

              1 Reply Last reply Reply Quote Share 0
              • 1 / 1
              • First post
                Last post

              Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

              行为准则 | 用户协议 | 隐私权政策