完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
我的前辈已经设置了一个函数来捕获由处理器FRI(DaveBy-0II)错位内存REFII导致的越界引用。不知为什么,当我运行它时,下面的代码会变成异常错误。如果将它设置为null,则需要确认。R“log & gt;计数”传递给整数?
以上来自于百度翻译 以下为原文 My predecessors had set up a function to trap exceptions thrown by processor for i) div-by-0 ii) misaligned memory ref iii) out of bounds ref. #define RCON_EXC (0x40 | 0x04 | 0x08 |0x10) .... void _general_exception_handler (unsigned cause, unsigned status) { RCON = RCON_EXC; KRNL_Reset(); } Somehow my code below goes into exception fault when I run it. Just need confirmation if setting it to NULL is the root cause OR is it due to the deferenced pointer "log->count" passed to the Integer? //Usage.h HEADER FILE CONTENTS #define MAX_SIZE 10 typedef UINT8 ComponentName_t[MAX_SIZE]; typedef struct { ComponentName_t Identity; UINT16 count; UINT16 SeqNum; } UsageLog_t; ... //Usage.c FILE CONTENTS static UsageLog_t *log = NULL; static cycleCount = 0; void IncrementCounter(void) { log->count++; } void PerformPostChecks(void){ UINT16 PD = 0; ... PD = log->count; //This line causes exception to be thrown, when removed there is absolutely no problem. } void main (void){ while (1) { cycleCount++; if (cycleCount >= 10){ IncrementCounter(); cycleCount = 0; } PerformPostChecks(); } } |
|
相关推荐
1个回答
|
|
|
在没有MMU的设备上访问空指针应该取决于它是否被访问为数据或代码而导致DBE或IBE(数据/指令总线错误)。在具有MMU的设备上,您将获得一个TLB填充异常,该异常具有单独的入口点,因此,如果您移动到其中一个(例如MZ系列),您可能希望为此添加一个处理程序。
以上来自于百度翻译 以下为原文 Accessing a NULL pointer on devices without an MMU should cause a DBE or IBE (data/instruction bus error) depending on whether it's accessed as data or code. On devices with an MMU, you'll get a TLB refill exception which has a separate entry point, so you may want to add a handler for that as well if you move to one of those (eg. the MZ series). |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475 浏览 0 评论
5795 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1126浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1098浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-3 08:03 , Processed in 0.572394 second(s), Total 72, Slave 55 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2207