完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,
我将我的项目从IAR移动到COSMIC和STVD,现在使用COSMIC编译器我总是得到错误消息''#error clnk Debug densitometer_st.lkf:1符号_FLASH_NCR2未定义((C: Program Files(x86) COSMIC 32K_Compilers CXSTM8 Lib libm0.sm8)eepwrl.o(C: Program Files(x86) COSMIC 32K_Compilers CXSTM8 Lib libm0.sm8)eeprom.o) 命令:''clnk -l''C: Program Files(x86) COSMIC 32K_Compilers CXSTM8 Lib'' - o Debug densitometer_st.sm8 -mDebug densitometer_st.map Debug densitometer_st.lkf''失败,返回值为:1 退出代码= 1。''。 我搜索了这个主题,我发现,不知何故有必要手动实现这个定义: volatile char FLASH_CR1 @ 0x5050; / *闪存控制寄存器1 * / volatile char FLASH_CR2 @ 0x5051; / *闪存控制寄存器2 * / // volatile char FLASH_NCR2 @ 0x5051; / * Flash互补控制注册2 * / volatile char FLASH_PUKR @ 0x5052; / *闪存程序内存不保护注册* / volatile char FLASH_DUKR @ 0x5053; / *数据EEPROM unprotection reg * / volatile char FLASH_IAPSR @ 0x5054; / * Flash in-appl Prog。状态reg * / 它开始变得奇怪,因为我的stm8l052c6没有NCR2寄存器。 所以我想,我需要设置一个正确的定义,编译器从文件中获取所有必要的定义。 我还检查了STVD中的MCU选择。选择了正确的一个。 正如您所看到的,我还尝试定义NCR2,但如果我这样做,则write命令会终止正在运行的程序。 所以请有人帮我解决这个问题。 谢谢 和我 以上来自于谷歌翻译 以下为原文 Hallo, I moved my project from IAR to COSMIC and STVD and now with the COSMIC Compiler I always get the error message ''#error clnk Debugdensitometer_st.lkf:1 symbol _FLASH_NCR2 not defined ((C:Program Files (x86)COSMIC32K_CompilersCXSTM8Liblibm0.sm8)eepwrl.o (C:Program Files (x86)COSMIC32K_CompilersCXSTM8Liblibm0.sm8)eeprom.o ) The command: ''clnk -l''C:Program Files (x86)COSMIC32K_CompilersCXSTM8Lib'' -o Debugdensitometer_st.sm8 -mDebugdensitometer_st.map Debugdensitometer_st.lkf '' has failed, the returned value is: 1 exit code=1.''. I searched on this topic and i found, that somehow it is necessary to manually implement this defines: volatile char FLASH_CR1 @0x5050; /* Flash Control Register 1 */ volatile char FLASH_CR2 @0x5051; /* Flash Control Register 2 */ //volatile char FLASH_NCR2 @0x5051; /* Flash Complementary Control Reg 2 */ volatile char FLASH_PUKR @0x5052; /* Flash Program memory unprotection reg */ volatile char FLASH_DUKR @0x5053; /* Data EEPROM unprotection reg */ volatile char FLASH_IAPSR @0x5054; /* Flash in-appl Prog. Status reg */ And there it starts to get strange, because my stm8l052c6 does not have a NCR2 register. So I guess, that i need to set a correct define and the compiler takes all the necessary defines from a file. I also checked the MCU Selection in STVD. There is the correct one selected. As you can see, i also tried to define the NCR2 but if i do so, the write command kills the running program. So please can someone help me with this problem. Thanks Andi |
|
相关推荐
4个回答
|
|
你好,
这在用户手册的第51/52页(即编译器的/ doc子目录中)进行了解释。 问候, 卢卡 以上来自于谷歌翻译 以下为原文 Hello, this is explained on pages 51/52 of the user manual (that is in the /doc subdirectory of the compiler). Regards, Luca |
|
|
|
你好卢卡,
谢谢你的快速回复。正如手册中提到的,我手动将库添加到链接器文件中。我附上了链接器文件。 我在“链接器/输入”下更改了STVD中的设置以使用自定义.lkf文件,因此每次都不会覆盖它。也许还有另一种方法可以直接将libl0.sm8库包含在STVD中,但我在短时间内找不到它。 通过此步骤,链接器不再要求FLASH_NCR2定义。 但无论如何,写过程仍然存在问题。当我尝试对eeprom执行写入过程时,控制器仍然停止。还有更多事要做吗? 这是正常的,我仍然需要自己定义FLASH_CR2和FLASH_IAPSR。 问候, 和我 以上来自于谷歌翻译 以下为原文 Hello luca, thanks for the fast reply. As it is mentioned in the manual, I manually added the library to the linker file. I attached the linker file. And i changed the settings in STVD under ''Linker/Input'' to use a custom .lkf file, so that it is not overwritten every time. Maybe there is also another option to include the libl0.sm8 library directly with STVD, but i could not find it in the short time. With this step, the linker was not asking for the FLASH_NCR2 definition any more. But anyway there is still a problem with the write procedure. The controller still stops when i try to perform a write procedure to the eeprom. Is there more to do? And is it normal, that i still have to define FLASH_CR2 and FLASH_IAPSR by my own. Regards, Andi |
|
|
|
今天我也在flash库中找到了这个说明:
================================================== ============================= 要从RAM执行的功能 ================================================== ============================= 除了以下定义的所有功能必须从RAM专门执行 用于可以从Flash执行的FLASH_WaitForLastOperation函数。 从RAM执行的步骤从一个工具链到另一个工具链不同: - 对于Cosmic Compiler: 1-通过''#pragma section(FLASH_CODE)''的平均值定义段FLASH_CODE。 该段在stm8l15x_flash.c文件中定义。 2-取消注释stm8l15x.h文件中的'#define RAM_EXECUTION(1)''行, 或者在Cosmic编译器预处理器中定义它以启用FLASH_CODE段 定义。 3-在STVD中选择Project Settings Linker Category''input''和RAM部分 使用''-ic''选项添加FLASH_CODE段。 4-在main.c文件中调用带有第一个分段字符的_fctcpy()函数 参数''_fctcpy('F');''加载声明的可移动代码段 执行前RAM中的(FLASH_CODE)。 5-默认情况下,_fctcpy函数打包在Cosmic机器库中, 所以必须在main.c中添加函数原型''int _fctcopy(char name);'' 文件。 是否有必要从RAM执行它? 如何在列表中添加此段并使用哪些命令? 它看起来像这样吗? (部分出自lkf文件)我自己添加了这一行。 #Segment Ram: + seg .data -b 0x100 -m 0x4ff -n .data + seg .bss -a .data -n .bss + seg .FLASH_CODE -a .data -n .FLASH_CODE -ic #< END SEGMENT_CONF> 以上来自于谷歌翻译 以下为原文 Today I also found this instructions inside the flash-library: =============================================================================== Functions to be executed from RAM =============================================================================== All the functions defined below must be executed from RAM exclusively, except for the FLASH_WaitForLastOperation function which can be executed from Flash. Steps of the execution from RAM differs from one toolchain to another: - For Cosmic Compiler: 1- Define a segment FLASH_CODE by the mean of '' #pragma section (FLASH_CODE)''. This segment is defined in the stm8l15x_flash.c file. 2- Uncomment the ''#define RAM_EXECUTION (1)'' line in the stm8l15x.h file, or define it in Cosmic compiler preprocessor to enable the FLASH_CODE segment definition. 3- In STVD Select ProjectSettingsLinkerCategory ''input'' and in the RAM section add the FLASH_CODE segment with ''-ic'' options. 4- In main.c file call the _fctcpy() function with first segment character as parameter ''_fctcpy('F');'' to load the declared moveable code segment (FLASH_CODE) in RAM before execution. 5- By default the _fctcpy function is packaged in the Cosmic machine library, so the function prototype ''int _fctcopy(char name);'' must be added in main.c file. Is it necessary to execute it from RAM? How can i add this segement in the list and with which commands? Could it look like this? (part out of lkf-file) I added this line by my own. # Segment Ram: +seg .data -b 0x100 -m 0x4ff -n .data +seg .bss -a .data -n .bss +seg .FLASH_CODE -a .data -n .FLASH_CODE -ic # |
|
|
|
我解决了我的问题。我忘了解锁我的EEPROM。对不起,谢谢你的第一个提示。这个是必要的。
问候 以上来自于谷歌翻译 以下为原文 I solved my problem. I forgot to unlock my EEPROM. Sorry and thanks for the first hint. This one was necessary. Regards |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2730 浏览 1 评论
3239 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1808 浏览 1 评论
3647 浏览 6 评论
6035 浏览 21 评论
1337浏览 4评论
197浏览 3评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
350浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
442浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
273浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 22:59 , Processed in 0.964771 second(s), Total 51, Slave 44 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号