如何指定PIC代码的地址范围?

发布于 2024-08-05 05:56:38 字数 362 浏览 2 评论 0原文

我想为 PIC16 使用 Claudiu Chiculitas 小型引导加载程序(我已对其进行修改以适合我的芯片),但由于该引导加载程序不会移动代码以防止覆盖引导加载程序,因此我必须以某种方式手动确保引导加载程序不被覆盖。我尝试像这样使用 --rom 选项:

--rom=default,-0-4,-3f00-3fff

我想要的是:代码内存的前 4 个字中没有代码,因为那是跳转到引导加载程序的位置,并且内存的最后 128 个字中没有代码,因为那是实际引导加载程序在哪里。 --rom 就像我用的那样什么也没做。我使用HI-TECH PICC STD编译器(Microchip PICmicro)V9.60PL3,芯片是pic16f876A。

I want to use Claudiu Chiculitas tiny bootloader for PIC16 (i have modyfied it to suit my chip) but since that bootloader does not move code to prevent overwriting the bootloader, I must somehow manually see to that the bootloader is not overwritten. I have tried to use the --rom option like this:

--rom=default,-0-4,-3f00-3fff

What I want is: No code in the first 4 words of code memmory, because thats where the jump to the bootloader is and no code in the last 128 words of memory because thats where the actual bootloader is. --rom like I use it does nothing. Im using HI-TECH PICC STD COMPILER (Microchip PICmicro) V9.60PL3 and the chip is pic16f876A.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔戏命师 2024-08-12 05:56:38

您还可以使用自定义链接描述文件来执行此操作。通常,链接器脚本将包含以下几行,将复位向量放在前面,然后将代码(在名为“page”的页面中)放在后面:

CODEPAGE   NAME=vectors    START=0x0            END=0x29           PROTECTED
CODEPAGE   NAME=page       START=0x2A           END=0x7FFF

对于 Microchip 的 FSDem 板中使用的引导加载程序(占据 0x0-0x800 范围,并期望您的程序在 0x800 处拥有自己的向量),这被下面的行替换,以防止链接器使用 0x800 以下的任何内容:

CODEPAGE   NAME=boot       START=0x0            END=0x7FF          PROTECTED
CODEPAGE   NAME=vectors    START=0x800          END=0x0x829        PROTECTED
CODEPAGE   NAME=page       START=0x82A          END=0x7FFF

You can also do this with a custom linker script. Usually, your linker script would contain these lines to put the reset vectors first and the code (in the page named "page") behind it:

CODEPAGE   NAME=vectors    START=0x0            END=0x29           PROTECTED
CODEPAGE   NAME=page       START=0x2A           END=0x7FFF

For the bootloader used in Microchip's FSDem board (which occupies the 0x0-0x800 range, and expects your program to have its own vectors at 0x800), this is replaced by the lines below which prevent the linker from using anything below 0x800:

CODEPAGE   NAME=boot       START=0x0            END=0x7FF          PROTECTED
CODEPAGE   NAME=vectors    START=0x800          END=0x0x829        PROTECTED
CODEPAGE   NAME=page       START=0x82A          END=0x7FFF
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文