完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
在我的程序中,我有一个保存配置值的结构。我需要一些方法来控制这个结构放在哪里,就像现在编译器决定放在哪里一样。然后,我想把这个结构读入ram,改变一些值,然后写回去。也许非常相似……我还想把变量指向0x000—0x01FF区域中的某个位置。我使用该区域作为引导加载程序,我希望运行的程序知道引导加载程序的版本。这个引导加载程序是用ASM制作的,所以我知道值在哪里。我可以从FLASH读出来,这很管用。但是最好能定义一个指向这个值的变量。我想把它用作:uint8_t BootoaderVersion;有没有办法让编译器知道在哪里(0x01f0)查找这个值?我对XC8编译器很陌生,所以我正在为一些事情而奋斗。有什么好的参考资料吗?
以上来自于百度翻译 以下为原文 In my program i have a structure that holds configuration 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? |
|
相关推荐
2个回答
|
|
你可以用这个方法把你的数据放在HEF中。确保你的数据是航空页大小的倍数,这样编译器就不会把数据和你的数据一起放进去。如果您只想读取ITUTIN Tyt const *ByTeToCult;ByTePosie= 0x01F0;修正的附加const
以上来自于百度翻译 以下为原文 const uint8_t BootoaderVersion @ 0x01F0 You can use this method to put you data in HEF. Make sure you your data is in multiples of the airways page size so that the compiler doesn't put data with yours. If you just want to read it uint_t const *bytePointer; bytePointer = 0x01F0; Corrected added const |
|
|
|
用户引导部分5.5.4绝对变量。后缀定义为@ AddiSsCistMyCONFIG CONFIG @ 0x1F80= {…在PIC10/12/16上,编译器希望所有的const变量都在Flash中,并由ReTLW表组成。所以你的版本号必须存储为一个RILLW。如果不是,它会在访问时崩溃。
以上来自于百度翻译 以下为原文 User Guide section 5.5.4 Absolute Variables. Postfix the definition with @ address const MyConfig Config @ 0x1F80 = { .... }; On PIC10/12/16, the compiler expects all const variables to be in FLASH and to consist of a RETLW table. so your version number must be stored as a RETLW. If it isn't it will crash when accessed. |
|
|
|
只有小组成员才能发言,加入小组>>
5250 浏览 9 评论
2037 浏览 8 评论
1958 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3219 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2266 浏览 5 评论
792浏览 1评论
682浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
613浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
686浏览 0评论
585浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-29 18:58 , Processed in 1.373670 second(s), Total 77, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号