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.

编译无语法错误,有一个Fatal error: cannot open source file "MEMORY"

Other Parts Discussed in Thread: CONTROLSUITE

**** Build of configuration Debug for project Example_2833xEPwmUpDownAQ ****

"E:\\ProfessionalSoftware\\CCS6.0\\install\\ccsv6\\utils\\bin\\gmake" -k all
'Building file: ../Example_2833xEPwmUpDownAQ.c'
'Invoking: C2000 Compiler'
"E:/ProfessionalSoftware/CCS6.0/install/ccsv6/tools/compiler/c2000_6.2.5/bin/cl2000" --cmd_file="D:\ccs_workspace_v6_0\Example_2833xEPwmUpDownAQ\cmd\28335_RAM_lnk.cmd" --cmd_file="D:\ccs_workspace_v6_0\Example_2833xEPwmUpDownAQ\cmd\F28335.cmd" -v28 -ml -mt --float_support=fpu32 --include_path="E:/ProfessionalSoftware/CCS6.0/install/ccsv6/tools/compiler/c2000_6.2.5/include" --include_path="C:/ti/controlSUITE/device_support/f2833x/v141/DSP2833x_common/include" --include_path="C:/ti/controlSUITE/device_support/f2833x/v141/DSP2833x_headers/include" -g --define="_DEBUG" --define="LARGE_MODEL" --quiet --verbose_diagnostics --diag_warning=225 --diag_suppress=10063 --issue_remarks --output_all_syms --cdebug_asm_data --preproc_with_compile --preproc_dependency="Example_2833xEPwmUpDownAQ.pp" "../Example_2833xEPwmUpDownAQ.c"
>> WARNING: more than one source file is specified; preprocessor output will be generated for last file only
Fatal error: cannot open source file "MEMORY"

1 catastrophic error detected in the compilation of "MEMORY".
Compilation terminated.

>> Compilation failure
gmake: *** [Example_2833xEPwmUpDownAQ.obj] Error 1
gmake: Target `all' not remade because of errors.

**** Build Finished ****

  • 为什么会有两个.cmd文件\28335_RAM_lnk.cmd和F28335.cmd?你到底是需要将程序加载到RAM还是FLASH上运行?这两个文件是否有同时操作同一片内存区域,或者是否存在一个段映射到两个不同的内存?

    MEMORY是你程序里的一个文件,还是.cmd文件里的关键字?如果是前者,那你要看看这个文件有什么问题,如果是后者,比较倾向于跟上面的问题内存映射有关。

  • 现在将.cmd文件换为DSP2833x_Headers_nonBIOS.cmd和F28335.cmd也还是同样的错误,MEMEOR不是程序文件。

    **** Build of configuration Debug for project Example_2833xEPwmUpDownAQ ****

    "E:\\ProfessionalSoftware\\CCS6.0\\install\\ccsv6\\utils\\bin\\gmake" -k all
    'Building file: ../Example_2833xEPwmUpDownAQ.c'
    'Invoking: C2000 Compiler'
    "E:/ProfessionalSoftware/CCS6.0/install/ccsv6/tools/compiler/c2000_6.2.5/bin/cl2000" --cmd_file="D:\ccs_workspace_v6_0\Example_2833xEPwmUpDownAQ\cmd\DSP2833x_Headers_nonBIOS.cmd" --cmd_file="D:\ccs_workspace_v6_0\Example_2833xEPwmUpDownAQ\cmd\F28335.cmd" -v28 -ml -mt --float_support=fpu32 --include_path="E:/ProfessionalSoftware/CCS6.0/install/ccsv6/tools/compiler/c2000_6.2.5/include" --include_path="C:/ti/controlSUITE/device_support/f2833x/v141/DSP2833x_common/include" --include_path="C:/ti/controlSUITE/device_support/f2833x/v141/DSP2833x_headers/include" -g --define="_DEBUG" --define="LARGE_MODEL" --quiet --verbose_diagnostics --diag_warning=225 --diag_suppress=10063 --issue_remarks --output_all_syms --cdebug_asm_data --preproc_with_compile --preproc_dependency="Example_2833xEPwmUpDownAQ.pp" "../Example_2833xEPwmUpDownAQ.c"
    >> WARNING: more than one source file is specified; preprocessor output will be generated for last file only
    Fatal error: cannot open source file "MEMORY"

    1 catastrophic error detected in the compilation of "MEMORY".
    Compilation terminated.

    >> Compilation failure
    gmake: *** [Example_2833xEPwmUpDownAQ.obj] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

  • 你的程序里有两个Example_2833xEPwmUpDownAQ.c文件吗?还是你在编译属性里通过preproc_dependency选项重复添加了这个文件?

  • Example_2833xEPwmUpDownAQ.c只有一个,你说的后者应该在哪查看?

  • 还有dependency的配置呢?

  • 是这个吗?如果不是,应该在哪找,如果配置不对应该怎么改呢?

  • 我回复给你的有两个截图,你为什么不看第一个呢?

  • 你的编译选项里明明提到有这个设置,不知道为什么这里没有显示。

    你可以把程序简化后发到这里吗?我可能需要测试看一下。

  • 你的这个工程有三个大问题,不过目前报错的只是其中的第一个,解决完了它之后另两个问题的错误才会提示。

    第一,此处通过--cmd_file=filename命令添加两个cmd文件是错误的,你已经在主工程路径下添加了它,并不需要再指定,而且此处这种指定方式是错误的,它的意思是将整个cmd文件嵌入到cmd文件里,所以它会报错MEMORY是个文件;

    第二,将这两条命令删除后,再编译得到的结果如下:

    这里有两个错误,一是指定了两个库文件,但没有指定包含路径,二是主程序中用到的很多函数和变量,都是在其它文件里的,可是不明白你为什么将这些链接文件全部删除了:

    解决办法是:

    一、找到这两个库文件,直接copy到工程路径下面,或者通过相对路径进行链接,这里我使用第一种方法,它们的路径是:

    C:\ti\controlSUITE\libs\math\IQmath\v160\lib 和 C:\ti\controlSUITE\libs\math\FPUfastRTS\V100\lib

    二、添加需要的所有相关源文件,如上一幅截图中的三个红框所示,同理,你可以将它们全部找到后拷贝到你的主工程路径下,也可以通过相对路径进行链接,这里我使用第二种方法,需要注意的是,只要使用了第二种方法,该主工程就必须在C:\ti\controlSUITE\device_support\f2833x\v141\DSP2833x_examples_ccsv5路径下才能调试,否则会找不到对应的文件,所以如果你希望它单独使用,建议都使用第一种方法。这 些文件的路径在:

    C:\ti\controlSUITE\device_support\f2833x\v141\DSP2833x_common\source 和 C:\ti\controlSUITE\device_support\f2833x\v141\DSP2833x_headers\source

    这里我将修改后的工程附上,你可以直接编译通过,前提是必须解压到C:\ti\controlSUITE\device_support\f2833x\v141\DSP2833x_examples_ccsv5路径下。

    建议在使用TI例程做相关的修改之前,先了解其具体含义和原因,一步一步地往下进行。

    aa_test.7z
  • 太感谢了!以前没接触过,学习了!