keil armcc这编译,elf运行不正常(突然崩溃、停在HardFault_Handler (void)),照着VSM Studio改了改编译选项似乎还是不行
还是用gcc编译出elf正常
--c99 -c --cpu Cortex-M3 -D__EVAL -g -O0 --apcs=interwork --split_sections
-I ......
-D__UVISION_VERSION="518" -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103x6 -o "jiaotongdeng\*.o" --omf_browse "jiaotongdeng\*.crf" --depend "jiaotongdeng\*.d"
armcc.exe --cpu=cortex-m3 --thumb -I.. -I../../../../../../../../../Keil_v5/ARM/CMSIS/Include -g "../main.c" -c -o "main.o"
似乎的确跟编译器版本有一定关系
反正就是自带的VSM Studio的编译器和选项,一般还是没问题的,别的IDE(keil什么的)的编译器和选项,就可能有问题
(C:\yagarto-20121222 自带的gcc是这个东西,问题是这东西编译起来也有点问题,我把stm32cubeide的tool chain换了个gcc-arm-embedded 2014q2,但是吧,编译出来看着是没问题(仔细看了看,可能是ld文件有点语法不支持),到proteus上运行就会死循环HardFault_Handler()
同样的选项用最新版armgcc就能运行(就是局部变量地址经常有问题。。。))
此外,还有一点比较坑,就是proteus自带的yagarto gcc,编译自带的stm32代码,居然都会报错,我也是醉了。。。改了一下代码里的static inline,才能跑
总而言之,用armgcc,有些bug,但是可以用,不是正版用户,也不能要求太高
还有就是那个官方支持论坛,updates and fixes区域http://support.labcenter.co.uk/forums/viewforum.php?f=12,也是只有正版验证用户才能看
< 1><0x00000a4b> DW_TAG_subprogram
DW_AT_external yes(1)
DW_AT_name main
DW_AT_decl_file 0x00000001 C:/Users//STM32CubeIDE/workspace_1.8.0/proj4/Debug/../Core/Src/main.c
DW_AT_decl_line 0x00000044
DW_AT_decl_column 0x00000005
DW_AT_prototyped yes(1)
DW_AT_type <0x000001be>
DW_AT_low_pc 0x08000250
DW_AT_high_pc 0x08000308
DW_AT_frame_base <loclist at offset 0x000000fa with 4 entries follows>
[ 0]< offset pair low-off : 0x08000250 addr 0x08000250 high-off 0x08000252 addr 0x08000252>DW_OP_breg13+0
[ 1]< offset pair low-off : 0x08000252 addr 0x08000252 high-off 0x08000254 addr 0x08000254>DW_OP_breg13+8
[ 2]< offset pair low-off : 0x08000254 addr 0x08000254 high-off 0x08000256 addr 0x08000256>DW_OP_breg13+32
[ 3]< offset pair low-off : 0x08000256 addr 0x08000256 high-off 0x08000308 addr 0x08000308>DW_OP_breg7+32
DW_AT_frame_base为r7+0d32
r7:2000 27E0 +0d32/0x20 后为2000 2800
< 3><0x00000ab3> DW_TAG_variable
DW_AT_name shi1
DW_AT_decl_file 0x00000001 C:/Users//STM32CubeIDE/workspace_1.8.0/proj4/Debug/../Core/Src/main.c
DW_AT_decl_line 0x0000006d
DW_AT_decl_column 0x00000007
DW_AT_type <0x000001be>
DW_AT_location DW_OP_fbreg -20
这里说明shi1这个int变量在内存中的位置为DW_OP_fbreg -0d20,即DW_AT_frame_base -0d20,即2000 2800-0d20=2800 27EC
经验证,2800 27EC这个地址是对的,的确是int shi1这个变量的内容,那么问题就确定,出在proteus对于dwarf的解析上了。。。
8.9/8.12换到8.13版本后,变量地址和反汇编代码出现两段重复 问题修复了,但是源代码断点断不下来了,要反汇编断点
另外一些改进:
可以自动检测.c源文件了,不需要跟.pdsprj同一目录了
可以看函数调用栈了
仿真开启更快了,13以前的版本开启的挺慢
(多个版本不能共存,虽然新版本可以安在另一个文件夹,保留旧版本,但是具体可能有一些覆盖,导致运行中报错)
又发现一个很坑的问题:
如果用外部的elf文件的话,必须得先点Source Code,然后点Project,然后Delete掉proteus自己的Project,它才会自动检测.pdsprj文件附近的.c文件,在调试界面显示出来
双击芯片后
元件属性里这个 Crystal Frequency:
应该是控制HSI,高速内部时钟,72MHz
Wire labels may only be assigned via the Property Assignment Tool when it is used in On Click mode. This is because there is no way for ISIS to determine where a wire label should be placed on a tagged wire, unless you mark the position with the mouse.
根据这个说法,比较可惜,没法通过替换,来修改Wire labels的名字,只能一个个click了
而且
action中的RENAME
The string should contain both a property assignment of the form:
current_keyword=new_keyword
The name to the left of the assignment is the existing property name you wish to rename; the name to the right is the new name you wish to rename it to.
Only user properties can be renamed.(所以只有user properties可以重命名)(懂了,这个是重命名keyword的,并不能重命名value,value还是得用assign)
You can place more than one label on a wire. If you wish them all to have the same name, and for all of them to update automatically whenever any of the names are changed, the click the Auto-Sync checkbox.
多个标签都得手动勾选上,才能同步,但是实际上我并没有看出来这个功能有什么用。。。
获取资料的方法:
Labcenter Electronics\Proteus 8 Professional\HELP目录下的chm文件
官方论坛
一本02年的user manual(可能有新版?反正盗版用户弄不到。。。)
这三东西直接用google或者百度搜是搜不全或者搜不到内容的,所以得分别搜