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.

28335烧写flash搬运到ram,程序出现bug

我通过修改CodeStartBranch.asm将flash的所有程序copy到ram,但是脱机后程序有一个PI函数运行错误,通过can上报信息,举例:分明是5-1=4,的float计算,但是结果一直是0. 请问这会是什么原因?

ram内存是够的,仿真器在线跑ram程序完全正确。堆栈改大或更换flash存储扇区也没用。。

  • 你好,请问你提到的

    Camel Santo 说:
    通过修改CodeStartBranch.asm将flash的所有程序copy到ram

    是如何操作的?

    这里有一篇关于代码从flash复制到ram运行的分享文章,你可以参考一下:

    https://e2echina.ti.com/question_answer/microcontrollers/c2000/f/56/t/185635

  • 通过如下:

    ***********************************************************************

    WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0

    .ref copy_sections
    .global code_start

    ***********************************************************************
    * Function: codestart section
    *
    * Description: Branch to code starting point
    ***********************************************************************

    .sect "codestart"

    code_start:
    .if WD_DISABLE == 1
    LB wd_disable ;Branch to watchdog disable code
    .else
    LB copy_sections ;Branch to start of boot.asm in RTS library
    .endif

    ;end codestart section


    ***********************************************************************
    * Function: wd_disable
    *
    * Description: Disables the watchdog timer
    ***********************************************************************
    .if WD_DISABLE == 1

    .sect "wddisable"
    wd_disable:
    SETC OBJMODE ;Set OBJMODE for 28x object code
    EALLOW ;Enable EALLOW protected register access
    MOVZ DP, #7029h>>6 ;Set data page for WDCR register
    MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
    EDIS ;Disable EALLOW protected register access
    LB copy_sections ;Branch to start of boot.asm in RTS library

    .endif

    ;end wd_disable

    .end

    之前版本程序跑着都好好的,最近一次修改参数后出现的问题。

    后来通过如链接方式将部分代码放入ram,仍然有问题。挂上仿真器就可以 4-1=3。 断开后4-1就等于0.。!

  • 哪里没设置好,用自带的,只增加宏定义看看
  • 您好,是指用#pragma CODE_SECTION这种吗?也试过,给放了几个计算程序到ram,依然有一个计算一脱机就不行。
  • 你好,你提到

    Camel Santo 说:
    之前版本程序跑着都好好的,最近一次修改参数后出现的问题。

    可否明确一下修改的是哪些参数?