简体   繁体   English

在MPLAB XC8 Microchip编译器中声明字符串的特定地址

[英]Declare a specific address for a string in MPLAB XC8 Microchip compiler

With compiler C18 when I want to use a specific address for a string I use: 使用编译器C18时,我想使用特定地址作为字符串,我使用:

In .C 在.C

#pragma romdata idsoft
    const rom unsigned char _app_nfo[31]= {"V0.0 No        - 05/12/12"};
#pragma romdata

in linker: 在链接器中:

CODEPAGE   NAME=idsoft     START=0x78E0         END=0x78FE

How can i do same with XC8? 我怎么能用XC8做同样的事情? I've try many things, but none of them are working. 我尝试过很多东西,但都没有。

in XC8 linker parameter: 在XC8链接器参数中:

-L-pappnfo=0x78E0

In .C : 在.C:

unsigned char __section ("appnfo")  app_nfo[31];

It's not working. 它不起作用。

You have just to do this: 你只需这样做:

unsigned char _app_nfo[31] @ 0x78E0 = {"V0.0 No        - 05/12/12"};

See 5.5.4.2 ABSOLUTE OBJECTS IN PROGRAM MEMORY in MPLAB XC8 C Compiler User's Guide 请参见“ MPLAB XC8 C编译器用户指南”中的 5.5.4.2 ABSOLUTE OBJECTS IN PROGRAM MEMORY中的5.5.4.2 ABSOLUTE OBJECTS IN PROGRAM MEMORY

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM