如何将变量放入访问组 - PIC 18 MPASM 链接器脚本
我有一个链接器脚本,它启动时
INCLUDE 18f14K50_g.lkr
我希望我的中断服务变量进入 ACCESS 库。 (我的程序目前很小,全部都可以,但也许将来......)。结果
SECTION NAME=VarsModemISR RAM=accessram
是:
MPLINK 4.39, Linker
Device Database Version 1.1
Copyright (c) 1998-2011 Microchip Technology Inc.
Error - section 'VarsModemISR' has a memory 'accessram' which is not defined in the linker command file.
Errors : 1
检查包含的文件,我相信它是。要么我在扩展模式下工作,而“gpre”就是。我可以使用#IFDEF 来检查,我尝试过。结果,它尝试使用“accessram”而不是“gpre”。
也许如果我尝试通过复制包含文件中的行来显式定义访问库:
ACCESSBANK NAME=accessram START=0x0 END=0x5F
SECTION NAME=VarsModemISR RAM=accessram
这会导致错误
MPLINK 4.39, Linker
Device Database Version 1.1
Copyright (c) 1998-2011 Microchip Technology Inc.
Error - duplicate definition of memory 'accessram'
Errors : 1
,这让我感到困惑。根据汇编器/链接器文档,我将 SECTION 与 RAM 选项一起使用,其中 RAM 先前已使用 ACCESSBANK、SHAREBANK 或 DATABANK 声明。它应该有效。
谢谢 ——理查德
I have a linker script which starts
INCLUDE 18f14K50_g.lkr
I want my interrupt service variables to go into the ACCESS bank. (My program's so small at the moment the whole lot can, but maybe in future...). So
SECTION NAME=VarsModemISR RAM=accessram
which results in:
MPLINK 4.39, Linker
Device Database Version 1.1
Copyright (c) 1998-2011 Microchip Technology Inc.
Error - section 'VarsModemISR' has a memory 'accessram' which is not defined in the linker command file.
Errors : 1
Examining the included file I believe it is. Either that or I'm working in extended mode and "gpre" is. I can use an #IFDEF to check, which I tried. The result, it was trying to use "accessram" not "gpre".
Maybe if I try defining the access bank explicitly by copying the line from the include file:
ACCESSBANK NAME=accessram START=0x0 END=0x5F
SECTION NAME=VarsModemISR RAM=accessram
This results in the error
MPLINK 4.39, Linker
Device Database Version 1.1
Copyright (c) 1998-2011 Microchip Technology Inc.
Error - duplicate definition of memory 'accessram'
Errors : 1
Which has me confused. According to the Assembler/Linker documentation I use SECTION with the RAM option, where RAM has previously been declared using ACCESSBANK, SHAREBANK or DATABANK. It should work.
Thanks
- Richard
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确实不需要更改链接描述文件,使用默认链接描述文件!
在 PIC18 MCPU 下,访问的文件寄存器随时可用。
只需在名为 ACCESSBANK 的适当内存数据库中声明变量,该数据库从 0x00 地址开始,到 0x60 地址结束。
如果您使用 MPLAB,则声明:
链接器应自动设置文件寄存器地址的代码指令中的“a”位,这些地址在 ACCESSBANK 中声明。
There is really no need to change linker script, use default one!
Accessed file registers are available at any moment under PIC18 MCPUs.
Just declare variables in appropriate memory databank named ACCESSBANK which start at 0x00 and end at 0x60 address.
If you are using MPLAB than declare:
Linker should automatically set the 'a' bit in code instruction for file register addresses, which are declared in ACCESSBANK.
我正在使用 UDATA_ACS 来声明我想要访问的变量,因此在 modem.asm 中我有
我当前的链接器脚本使用提供的脚本,但定义了我的段。我注意到脚本中只定义了一个程序页,这与 PIC16 不同。不再有 PAGESEL 了吗?
生成的映射包含我期望的映射:
按预期硬编码位置:
可移动位置打包在:
EEPROM 位于正确的位置
以及 ACCESSRAM 和 GP0 中的变量
还有更多问题需要解决,但它们可能在其他帖子中。我注意到 CodeWaveTable 占用 64 个字节,因此它的包装并不紧密。解决方案 - 使用 CODE_PACK,现在它是 32 字节。
I am using UDATA_ACS to declare the variables I want in access, so in modem.asm I have
My current linker script uses the supplied script, but defines my segments. I note that there's only one program page defined in the script, unlike on the PIC16s. No more PAGESEL?
The resulting map contains the mappings I expect:
Hard coded locations as expected:
Movable locations packed in:
EEPROM in the right place
And variables in ACCESSRAM and GP0
There are more problems to solve, but they may be in other posts. I note that CodeWaveTable is taking 64 bytes so it's not closely packed. Solution - use CODE_PACK and now it's 32 bytes.