完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
下面是我设置断点进行调试的代码的一部分:我还附上了一个屏幕截图以更好地解释它。但它是“超出范围”-看到图片。我怎样才能看到和修改它呢?在imeStr.dateSeparator=0.variablewatchwindow:buf-out of scoperouterAddr.Val=0x00000000线上的第二个断点应该从值192.168.0.1的buf转换为字符串。但是,当然您无法看到,这是“buf”变量中的值。myEchoRequest.targetAddr被分配给routerAddr,因此您希望看到正确的值。但是您看到的是:myEchoRequest.targetAddr.Val=0xFFBFFFFF,但是它既没有转换ip地址192.168.0.1,也没有转换值di。标识符被赋值为44。你在监视窗口看到的是0x000。它以红色为重点,所以它意味着价值已经改变,但是什么?虽然显示的值不正确,但是分配正确的值是因为我在ICMP回调函数中获得了ping响应。要查看在回调函数中是否获得了ping超时,我必须停止调试器,插入strcpy(buf,“192.168.0.50”)行以及不存在的ip地址。重新编译程序,下载并调试它。在watch窗口中显示的值仍然相同,但是我得到了超时,因此它意味着可以工作。我们已经在MPLAX X的3.45版上了!!!!正如我以前在其他线程中讲过的,MPLAB 8中没有这样的问题。什么时候可以用MPLAB X进行调试?我试图附加一个屏幕捕捉来更好地解释它,但是我得到了“拒绝访问”。您没有权限访问“http://www. McCys.com /论坛/上载.ASPX?”在这个服务器上。参考文献18,DDFF117171494225581AE2DD8“没有新的东西!编辑:在编辑帖子和几次重试之后,我就可以上传屏幕捕捉了。
以上来自于百度翻译 以下为原文 Below is part of the code where I set the breakpoint to debug it: IPV4_ADDR routerAddr; strcpy(buf, TCPIP_NETWORK_DEFAULT_GATEWAY); TCPIP_Helper_StringToIPAddress((char *) buf, &routerAddr); TCPIP_ICMP_ECHO_REQUEST myEchoRequest; myEchoRequest.netH = 0; myEchoRequest.targetAddr = routerAddr; myEchoRequest.sequenceNumber = sequenceNumber; myEchoRequest.identifier = 44; myEchoRequest.pData = myDataBuffer; myEchoRequest.dataSize = sizeof(myDataBuffer); myEchoRequest.callback = EchoCallback; ConvertTimeToStr(); TimeStr.dateSeparator = 0; I have also attached a screen capture to better explain it. I first break on the line TCPIP_Helper_StringToIPAddress and want to see what is in the "buf" variable. But it is "out of scope" - see the picture. How can I see and modify it? Second breakpoint on the line imeStr.dateSeparator = 0. Variable watch window: buf - out of scope routerAddr.Val = 0x00000000, should be converted string from buf which has value 192.168.0.1. But of course you can't see that that is a value in the "buf" variable. myEchoRequest.targetAddr is assigned routerAddr, so you would expect to see the correct value. But what you see is: myEchoRequest.targetAddr.Val = 0xFFBFFFFF, but it is not either converted ip address 192.168.0.1 nor the value displayed in routerAddr.Val. myEchoRequest.identifier is assigned value 44. What you see in the watch window is 0x0000. It is highlighted in red so it means that the value has changed but to what? Although the displayed values are not correct, correct values are assigned because I get the ping response in the ICMP callback function. To see if I get a ping timeout in the callback function, I had to stop the debugger, insert the line strcpy(buf, "192.168.0.50") - with the non existing ip address. Recompile the program, download it and debug it. Displayed values in the watch windows are still the same, but I get the timeout so it means that it works. One would think that the simple way to achieve this would be to change the string value in the "buf" variable - but no, it would be to easy! We are already on version 3.45 of MPLAB X!!! As I said before in other threads, there were no such problems in MPLAB 8. When will the debugging be possible with MPLAB X? I have tried to attach a screen capture to better explain it but I get "Access Denied. You don't have permission to access "http://www.microchip.com/forums/upload.aspx?" on this server. Reference #18.ddf00117.1479422858.1ae2dd8" Nothing new! . Edit: After editing the post and a couple of retries I was able to upload the screen capture Attached Image(s) |
|
相关推荐
9个回答
|
|
是的,我使用MPLAB X 3.45。我使用的是Harmony 2.01b。我不能关闭优化,因为尽管我使用的是PIC32MX795(以太网启动器套件),但是没有优化它就不能编译——我想是因为wolfSSL。PIC32 MX795的大小不够大!我想从MPLAB 8切换到MPLAB X(不是选择)之后,我期待更多。你知道,我开始使用MPLAB 8和pic16F84,所以那是很久以前的事了,我当时使用HI-TECH C编译器-我认为这是非常好的编译器。你如何摆脱竞争?这就是Microchip和高科技合作的结果。无论如何,这不是这个话题的话题。你是对的,你要学会处理工具的局限性。这就是为什么,在调试期间,我甚至不费力地更改变量值——因为我尝试过几次,在论坛上搜索这个问题的解决方案,结果我放弃了。我已经接受了,对于我来说,这个特性并不存在于这个调试工具中,而不是每次尝试改变一个而不能改变另一个时都感到沮丧。
以上来自于百度翻译 以下为原文 Yes, I am using MPLAB X 3.45. And I am using Harmony 2.01b. I can't switch optimisation off because, although I am using PIC32MX795 (Ethernet Starter Kit) it won't compile without optimisation - due to wolfSSL I presume. The size of PIC32MX795 is not big enough! I guess after switching to MPLAB X from MPLAB 8 (not by choice) I expected more from it. You know, I started using MPLAB 8 with pic16F84 so it was a long while back, and I used HI-TECH C compiler at the time - I think it was pretty good compiler. How do you get rid of the competition? That's what Microchip did with HI-TECH. Bought it out and abandoned it. Anyway, that's not a topic of this thread. And you are right, you learn to deal with limitations of the tools. That's why, I don't even bother trying to change variable values during debugging - because I tried a few times, searched the forum for the solution for this issue and that's it, I gave up. I have accepted, that for me, this feature doesn't exist in this debugging tool, instead of getting frustrated every time, when I try and I can change one and can not change the other. |
|
|
|
高科技C编译器现在改名为XC-8。核心是相同的。为了支持C18(实际丢弃的产品)做了一些修改。大约十年前,微芯片丢弃了它们的C16编译器。XC16和XC32是基于GCC的。与大多数,如果不是所有的ARM编译器,我有自己的产品问题。但我用高科技和MPLAB 7处理它们。到他们面前的8052个工具
以上来自于百度翻译 以下为原文 The HI-TECH C compiler is now renamed XC-8. The core is mostly the same. There were some modificatios to support C18 (the actual dropped product). Microchip dropped their C16 compiler about a decade ago. XC16 and XC32 are GCC Based. The same as Most, if not all ARM compilers. I have my own issue about the products. But I dealt with them with Hi-tech and Mplab 7.?? to 8.92 And my 8052 tools before them. |
|
|
|
是的,我理解你的观点。这是好的,如果你有一个备用串行端口和PC一直运行。堆栈的问题可以在上电后几个小时发生,半天或更长时间,因此更容易写入文件。我先将数据复制到缓冲区,当它填充时,将其保存到文件中。每件事都有时间戳,所以我知道什么时候发生的。通过这种方式,我不会过多地干扰处理流程。
但是启动这个线程的原因是我想在我的代码中添加ICMP客户端,作为解决堆栈问题的辅助工具。关于如何做的唯一信息,我只能在和声帮助文件中找到。因此,在复制代码从PDF文件和添加我的位,我想看看它在做什么。我无法监控任何我想要的变量,所以我决定写下来。虽然代码工作,现在,我不确定代码是正确的。当您查看myEchoReguest.netH=0行(上面的第一篇文章)时,我本以为必须获得默认接口的句柄,而不是使用0值。但这只是从帮助文件中复制的。在我做这件事的时候已经很晚了,所以我没有太多的考虑。它工作了,所以我不担心太多。& & P & gt; 以上来自于百度翻译 以下为原文
But what started this thread was that I wanted to add ICMP client to my code as a band-aid to my stack problem. The only information about how to do it, I could only find in the Harmony help file. So, after copying the code from the pdf file and adding my bits, I wanted to see what it is doing. And I couldn't monitor any variables that I wanted so I decided to write about it. Although the code worked, now, I am not sure that the code is correct. When you look at the line myEchoReguest.netH = 0 (first post above), I would have thought that I have to get a handle of the default interface rather than using 0 value. But that's just copied from the help file. And it was late at night when I was doing it so I didn't think much about it. And it worked so I didn't worry too much. |
|
|
|
是的,对于稀有事件,日志文件是唯一的方法…
以上来自于百度翻译 以下为原文 Yeah, For rare events, the log file is the only way... |
|
|
|
有一些事情会使调试混乱。(1)编译器优化了程序。当您需要单步执行代码时,将优化级别设置为-O0。这会带走所有类型的编译器逻辑,这些编译器逻辑会重新排序,移除数学上对执行没有影响的东西,等等。当您完成单步操作时,将优化级别设置回任何需要的级别。(2)死代码移除。有一个名为“隔离节中的每个函数”的GCC选项,它导致“-ffunction-.”被添加到编译器命令行参数。这会创建对象文件,其中每个函数都在它自己的部分中,这是相当无用的事情,除非您还激活了一个名为“删除未使用的部分”(命令行-gc-.)的链接器选项。然后,这两个编译器/链接器选项的组合允许链接器丢弃程序中任何地方未引用的任何代码。如果您预期未调用的函数将出现在可执行文件中,但实际情况并非如此,则死代码删除可能正在消除这些内容。请注意,如果启用编译器选项“将数据放入其自己的部分”(命令行-fdata-.),则也会删除死数据。(3)存在影响符号、调试信息等的选项。(4)MCU除了做纯计算工作外,通常还用于控制事物。但是这使得调试变得有挑战性,因为当调试器在断点停止时,一切都停止。这扰乱了连接到MCU的设备。因此,例如,如果您正在尝试调试网络内容,那么在断点上暂停会使得网络认为设备脱机。如果你在控制马达,你的马达可能会跑掉。由于这样的原因,这里的其他人建议LED调试、串口调试、示波器等等,所以您的代码在您调试时继续运行。当网络可用时,我就使用它。(5)如果要调试的项目庞大而复杂,那么最好将问题代码隔离在一个小型项目中,以便进行调试。(6)如果要调试的代码(或代码部分)纯粹是计算/算法(不特别依赖于您的MCU,不影响/使用外围设备等)然后它可以帮助安装开发工具,为您的计算机,可以编译命令行程序,然后运行您的纯计算代码在您的PC上,看看它是什么。当您不必等待MCU闪存擦除/编程时,编译/运行/编辑周期就快得多。此外,您的PC比更有限的MCU快几个数量级,因此您可以针对测试工具运行代码,该测试工具可以非常快速地测试数百万个输入组合。一旦你知道你的代码工作,把它放在MCU中,你有很好的机会,它仍然可以工作。如果你的电脑是32位的,而你的MCU是16位或8位,那么要注意可能出现的问题。(使用确定的大小uint8_t/uint16_t/uint32_t类型,而不是依赖于平台的无符号int类型)。你只需确切地了解你传递给它的所有选项是如何影响结果的。幸运的是,它可能是这个星球上最常用和开发的编译器,所以那里有大量关于它的信息。
以上来自于百度翻译 以下为原文 There are a few things that mess up debugging. (1) Compiler optimizing stuff away. When you need to single-step through code, set optimization level to -O0. This takes away all kinds of compiler logic that reorders things, removes things that mathematically have no effect on execution, etc. When you're done single-stepping, set optimization level back to whatever it needs to be. (2) Dead code removal. There's a GCC option called "isolate each function in a section." It results in "-ffunction-sections" being added to the compiler command line arguments. This creates object files where each function is in its own section, a rather useless thing UNLESS you also activate a linker option called "Remove unused sections" (command line -gc-sections). Then, the combination of these two compiler/linker options allows the linker to throw away any code that isn't being referenced anywhere in your program. If you're expecting uncalled functions to appear in the executable and it's not, dead code removal may be eliminating that stuff. Note there's also dead data removal if you enable compiler option "Place data into its own section" (command line -fdata-sections). (3) There are options that affect symbols, debug information, etc. If information the debugger needs isn't present in the debug executable, you definitely won't be able to see it in the debugger. (4) MCUs are generally used for controlling things, in addition to doing pure computational stuff. But this makes debugging challenging because when the debugger halts at a breakpoint, everything stops. This messes up devices attached to the MCU. So for example if you're trying to debug network stuff, halting on a breakpoint makes it appear, to the network, that the device went offline. If you're controlling motors, your motors could run away. For reasons like this, others here have suggested LED debugging, serial port debugging, oscilloscope, etc., so your code continues running while you "debug." I always keep a pin for an "activity LED" that I can also monitor with an oscilloscope. When network is available, I use that. (5) If the project you're trying to debug is huge and complex, it's often best to isolate the code in question in a little mini-project just for the purpose of debugging. (6) If the code (or section of code) you're debugging is purely computational/algorithmic (doesn't depend specifically on your MCU, doesn't affect/use peripherals, etc.) then it can be helpful to install development tools for your computer that can compile command-line programs, and then run your purely computational code on your PC and see what it does. The compile/run/edit cycle is much faster when you don't have to wait for MCU flash erase/programming. Also your PC is orders of magnitude faster than the more limited MCUs so you can run your code against a test harness that can test millions of input combinations very quickly. Once you know your code works, put it in the MCU and you have a very good chance that it will still work. Just watch out for potential problems that get introduced if your PC is 32-bit and your MCU is 16-bit or 8-bit, where numbers might roll over unexpectedly. (Use the definite size uint8_t/uint16_t/uint32_t types rather than the platform dependent unsigned int types). A word about GCC: it's a very good compiler. You just have to understand exactly how all the options you're passing to it affect the result. Luckily it's probably the most used and developed compiler on the planet, so there's a ton of information about it out there. |
|
|
|
我不得不使用Help帮助添加ICMP客户端代码。我找不到任何例子中的代码与和谐。我正在混合MLA与和谐-我不得不添加USB主机和闪存磁盘读/写从MLA。和声示例对我来说不起作用。我有异常处理程序,但这不是问题所在。TCPIP栈只是停止响应,无法从PIC(TCP客户端,UDP服务器)发送任何东西,也不能接收任何东西(HTTP服务器网页没有响应,UDP消息未被接收)。有趣的是,在添加ICMP客户端之后,当我ping路由器时,TCPIpIi ICMPEQueReQuestREST的结果(…)是ICMPAQuixOK,意思是它是发送的。我没有得到路由器的响应——我得到回调超时。但是如果Ping是从PIC发送的(堆栈是单向工作的吗?)为什么我不能从TCP客户端发送UDP消息或消息?现在我向PC发送一个ping,我把它记录在WiReSARK中。我也把它记录在照片里。所以我正在等待一个堆栈被卡住,我会看到我是否收到了WiReSurk的最后一个ping。我增加了堆大小,但没用。我记录了所有的套接字状态(它是在我的另一个线程中,与这个问题相关),但是在某个时刻它停止了,没有套接字是活动的,并且它总是应该至少是IP检查和DDNS更新的一个。
以上来自于百度翻译 以下为原文 I had to use harmony help to add ICMP client code. I couldn't find any code in the examples with harmony. I am mixing MLA with Harmony - I had to add u*** Host and Flash disk read/write from MLA. Harmony examples didn't work for me. I have exception handler, but it is not the crash that is the problem. TCPIP stacks just stops responding couldn't send anything from the PIC (tcp client, udp server) nor could I receive anything (http server web page not responding, udp messages not received). The interesting thing after adding ICMP client, when I ping the router, the result of TCPIP_ICMP_EchoRequest(...) is ICMP_ECHO_OK, meaning that it was send. I don't get a response from the router - I get callback timeout. But if ping was sent from the pic (the stack works one way?), why couldn't I send udp message or message from the tcp client? Now I am sending a ping to the PC, where I log it in wireshark. I also log it in the pic. So I am waiting now for a stack to get stuck and I will see if I received last ping in wireshark. I had increased the heap size but it didn't help. I logged the all the socket states (it is in my other thread in Harmony, related to this issue) but at some point it stops, no socket are active, and it always should be at least one for ip check and ddns update. |
|
|
|
TCP/IP堆来自堆。它是在一个镜头在init。你必须增加两个来增加TCP/IP更多,你使用MHC来添加和谐组件,对吗?ICMP应该只是一个单击复选框。确保MLA组件不阻塞,如果阻塞,并且您想要使用它们,您将需要一个RTOS。还要确保您分配了足够的套接字。
以上来自于百度翻译 以下为原文 The TCP/IP Heap comes from the heap. It is pulled in one shot during init. You must increase both to add more to tcp/ip And you are using MHC to add Harmony components, correct? ICMP should have just been a clicking a check box. Make sure the MLA components do not Block, If they do and you want to use them you will need an RTOS. Also make sure you allocated enough sockets. |
|
|
|
是的,我使用MHC来添加/更改组件。我在Harmony中选择了ICMP客户端,它在system_config.h中添加了一些初始值,但是我仍然必须添加一个函数TCPIP_ICMP_EchoRequest、设置数据和添加回调函数。为此,我不得不使用Help帮助文件。MLA只是USB主机,我用它从上电后读取数据。还有日志记录(如果我这样做的话)-但这并不经常发生,因为我首先将数据记录到缓冲区,并在文件填充时保存到文件中。也许我也应该看看tcpip堆栈,正如您建议的那样。这是我的堆栈问题http://www..hip.com/for./m956930.aspx的线程,我在这里发布了套接字活动的日志。如果你愿意,你可以看一下。
以上来自于百度翻译 以下为原文 Yes, I use MHC to add/change components. I select ICMP client in Harmony, which adds some initial values in system_config.h but I still had to add a function TCPIP_ICMP_EchoRequest, setup data and add a callback function. For this I had to use harmony help file. MLA is only u*** host, which I use to read data from after power up. And also for logging (if I do it) - but this happens not very often, because I first log data to the buffer and save to the file when it fills up. With the heap, I must say, that I only increased the total heap size. Maybe I should have had a look at tcpip stack heap as well, as you are suggesting. This is the thread for my stack problem http://www.microchip.com/forums/m956930.aspx, where I posted log of sockets activities. If you would like, you can have a look at it. |
|
|
|
嗨,调试优化代码可能总是混淆操作系统的误解,并且编译大型项目中的所有文件可能是不切实际的或不可能的。XC32编译器有可能使用pragma规范对单个文件设置优化,您可以尝试诸如pragma.-O0or之类的操作。使用属性规范的特殊功能:参见XC32用户指南和GCC文档。问候,Mysil
以上来自于百度翻译 以下为原文 Hi, Debugging Optimized code may always be confusing os misleading, and compiling all files in a big project may be unpractical or impossible. XC32 compiler have possibilities to set optimization for individual files using #pragma specifications, you may try something like: #pragma optimize -O0 or for specific functions using attribute specifications: int __attribute__((optimize("-O0"))) pandora (void) { if (maya > axton) return 1; return 0; } See XC32 Users Guide and GCC documentation. Regards, Mysil |
|
|
|
只有小组成员才能发言,加入小组>>
5238 浏览 9 评论
2028 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3204 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
776浏览 1评论
665浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
594浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
675浏览 0评论
575浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 00:03 , Processed in 1.422612 second(s), Total 95, Slave 77 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号