From 03d21b83e1a3a7b09209c7ce994fb23b244e0aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B6=E4=B8=AD=E6=96=AD=E5=BB=B6=E8=BF=9F=E7=9A=84RTOS?= Date: Mon, 8 Apr 2024 16:54:34 +0000 Subject: [PATCH] =?UTF-8?q?update=20=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3/?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=B5=81=E7=A8=8B.md.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 零中断延迟的RTOS --- 说明文档/开发流程.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/说明文档/开发流程.md b/说明文档/开发流程.md index e289a18..1f1ee12 100644 --- a/说明文档/开发流程.md +++ b/说明文档/开发流程.md @@ -37,11 +37,11 @@ CosyOS支持高等级优化,您完全可以选择8级(default),speed偏 原因是C51的可重入栈效率十分低下,对于XBPSTACK,还存在关中断行为。
对于不可重入的库函数或自定义函数,如需要可重入,可采用下述的方法。
(1)替换法:对于不可重入的库函数,可考虑替换为其它的可重入库函数,实现相同的功能。
-| non-reentrant | reentrant | 替换条件 | -|--------------------|--------------------------------|----| -| strncpy(s1, s2, n) | memcpy(s1, s2, n) | 推荐s2的长度至少为n | -| strncat(s1, s2, n) | memcpy(s1 + strlen(s1), s2, n) | 推荐s2的长度至少为n | -| strcat(s1, s2) | strcpy(s1 + strlen(s1), s2) | 无 | +| non-reentrant | reentrant | 替换条件 | +|--------------------|--------------------------------|----------------------------------| +| strncpy(s1, s2, n) | memcpy(s1, s2, n) | 推荐s2的有效长度至少为n | +| strncat(s1, s2, n) | memcpy(s1 + strlen(s1), s2, n) | 推荐s2的有效长度至少为n | +| strcat(s1, s2) | strcpy(s1 + strlen(s1), s2) | 无 | | strncmp(s1, s2, n) | memcmp(s1, s2, n) | 确保其中一个字符串的有效长度至少为n | (2)可重入版本