u8 *BlackImage, *RedImage;
u16 Imagesize = 0x7800;
if((BlackImage = (u8*)malloc(Imagesize / 2)) == NULL) {
printf("Failed to apply for black memory...
");
return -1;
}
if((RedImage = (u8*)malloc(Imagesize / 2)) == NULL){
printf("Failed to apply for red memory...
");
return -1;
}
为什么程序里加了这段代码 单步调试时会进入
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{}
}
出现这样的错误
?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
嗯, 不至于崩.
我觉得楼主这个判断有点像 if ( (a = b) == NULL ).
正常应该这样吧?
u8 *BlackImage;
u16 Imagesize = 0x7800;
BlackImage = (u8*)malloc(sizeof(u8) * (Imagesize / 2));
if (NULL == BlackImage) {
printf("Failed to apply for black memory... ");
return -1;
}
一周热门 更多>