硬汉嵌入式论坛

 找回密码
 立即注册
查看: 4719|回复: 1
收起左侧

[MDK] MicroLib 不支持 assert 怎么破

[复制链接]

100

主题

275

回帖

575

积分

金牌会员

积分
575
发表于 2016-4-3 16:25:07 | 显示全部楼层 |阅读模式
要用到 printf 点上 MicroLib后,Freemodbus 中有 assert ,出现错误编译过不了。
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117530
QQ
发表于 2016-4-4 01:14:12 | 显示全部楼层
官方说明: http://www.keil.com/support/man/docs/armlib/armlib_chr1358938924063.htm

使用微库的时候,重定向函数__aeabi_assert,下面是一个简单的测试代码
========================================================

#include <assert.h>
#include <stdio.h>       /* required for printf */

void __aeabi_assert(const char *expr, const char *file, int line)
{
//加入你要执行的内容
}

void check_parms (
  char *string)
{
  assert (string != NULL);     /* check for NULL ptr */
  printf ("String %s is OK\\n", string);
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-8-12 16:19 , Processed in 0.039036 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表