在我的程序中,我有一个保存配置值的结构。我需要一些方法来控制这个结构放在哪里,就像现在编译器决定放在哪里一样。然后,我想把这个结构读入ram,改变一些值,然后写回去。也许非常相似……我还想把变量指向0x000—0x01FF区域中的某个位置。我使用该区域作为引导加载程序,我希望运行的程序知道引导加载程序的版本。这个引导加载程序是用ASM制作的,所以我知道值在哪里。我可以从FLASH读出来,这很管用。但是最好能定义一个指向这个值的变量。我想把它用作:uint8_t BootoaderVersion;有没有办法让编译器知道在哪里(0x01f0)查找这个值?我对XC8编译器很陌生,所以我正在为一些事情而奋斗。有什么好的参考资料吗?
以上来自于百度翻译
以下为原文
In my program i have a structure that holds configura
tion values.
i use 'const MyConfig Config;'
The MyConfig is a structure with 64 bytes of data which i want to put in the HEF using the HEX file that is created by the compiler. I need some way of controlling where this structure is placed as now it is just wherever the compiler decides to.
Afterwards i want to read this structure into ram, change some values and write it back.
Maybe very similar... i also want to point a variable to a location somewhere in the 0x0000-0x01ff area. I use that area for a bootloader and i would like the running program to know the version of the bootloader. This bootloader is made with ASM so i know exactly where the value is. I could read it from flash, and that works. But it would be nicer to be able to define a variable that points to this value.
I would like to use it as:
uint8_t BootoaderVersion;
Is there a way to let the compiler know where (0x01f0) to look for this value?
I am pretty new to the XC8 compiler so i am struggling with some things. Is there a good reference somewhere available?