加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ReportCheckFailedStdout.c 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
风之羽 提交于 2015-10-03 16:54 . v1.0 10.03 16:54
#pragma build_attribute vfpcc_compatible
#pragma build_attribute arm_thumb_compatible
#pragma build_attribute ropi_compatible
// #pragma build_attribute rwpi_compatible
#ifdef __AS_BOUNDS__
#error "Boundscheck should not be turned on when compiling this file"
#endif
#include <stdint.h>
#include <yfuns.h>
#pragma language=extended
void abort(void);
__interwork void __iar_ReportCheckFailedStdout(void * d);
static char * putstring(char *buf, const char *s)
{
while( *s ) *buf++ = *s++;
return buf;
}
static char * puthex(char *buf, unsigned long ul)
{
const char hex[16] = "0123456789ABCDEF";
buf = putstring(buf, "0x");
char lbuf[9] = {0};
int index = 8;
do {
--index;
lbuf[index] = hex[ul & 0xF];
ul >>= 4;
} while(ul);
return putstring(buf, &lbuf[index]);
}
int __iar_ReportCheckFailedStdoutAbort = 0;
__interwork void __iar_ReportCheckFailedStdout(void * d)
{
char buf[200] = {0};
char *b = buf;
uint32_t const *data = (uint32_t const *)d;
int nr = data[0] >> 24;
b = putstring(b, "CRUN_ERROR:");
for (int i = 0; i < nr; ++i)
{
*b++ = ' ';
b = puthex(b, data[i]);
}
*b++ = '\n';
__write(_LLIO_STDOUT, (unsigned char const *)buf, (size_t)(b - buf));
if (__iar_ReportCheckFailedStdoutAbort)
abort();
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化