关于MPLAB C18编译提示“Error - section '.udata_main.o' can not fit the section. Section '.udata_main.o' len

关于MPLAB C18编译提示“Error - section '.udata_main.o' can not fit the section. Section '.udata_main.o' length=0x00000606”这类错误的解决方法  

这两天用MPLAB IDE v8.84 + MPLAB C18 + PIC18F2620编译程序,程序中有一个比较大的数组,长度超过了256字节,因此就出现了上面的错误提示,网上收索了关于这个问题的解答,说得最多的解答方式如下:

关于MPLAB C18编译提示“Error - section .udata_main.o can not fit the section. Section .udata_main.o length=0x00000606”这类错误的解决方法 - 北极星 - xiebingsuccess的博客

我最初也是按照这种方式去修改,修改后问题依旧,感觉不起作用,后来找到了一篇英文版的解释(http://www.xargs.com/pic/c18large.html),可能是作者在翻译的时候有些遗漏,其中第2点“ Add a linker script to your project. With recent versions of the compiler, linker scripts are located in the compiler's bin/LKR directory. Be sure to get your linker script from bin/LKR rather than the lkr directory, since the scripts in the latter directory are obsolete, and should not be used. The lkr directory also does not include scripts for newer PICs.”,就是说要从MPLAB C18的安装目录下的bin/LKR目录下拷贝一个对应单片机的链接脚本到MPLAB IDE的工程目录下,然后进行对应的修改,这样C18在链接的时候就会使用修改后的在工程目录下的单片机链接脚本,最开始我是直接在bin/LKR这个目录下面对相应的单片机链接脚本进行修改,但一直没有效果,就是没有拷贝到工程中这个原因。

猜你喜欢

转载自blog.csdn.net/xiebingsuccess/article/details/91871238