C/C++编程-工程实践-MDK工具学习

MDK工具学习

  • 工程配置
    • C语言的标准库
    • *armlib*
    • *libcxx*
      • [兼容ARM架构的二进制应用接口(Compliance with the Application Binary Interface (ABI) for the Arm architecture)](#兼容ARM架构的二进制应用接口(Compliance with the Application Binary Interface (ABI) for the Arm architecture))

MDK有着一整套工具链,包括:编辑、环境配置、工程配置、编译、调试等等。

工程配置

从 mdk6 开始,采用CLANG 编译器 和 LLVM 编译架构。

C语言的标准库

标准库的分类,及简介

分为

  • C 和C++ 动态运行库 (C and C++ runtime libraries)
    • Standard C library
    • C micro-library
    • C++
  • 独立的C库 (standalone C library function)
Arm C 和 C++ 库的目录结构

库安装在<install_directory>/lib 路径下 armlib 和 libcxx 文件夹内

armlib

包含Arm C 库的变体(Arm C Library)、浮点计算库(floating-point arithmetic library 【fplib】)、 数学库(math library【mathlib】)

libcxx

包含 所有的 libc++ 和 libc++abi 库

库的头文件安装在<install_directory>/include路径下。

兼容ARM架构的二进制应用接口(Compliance with the Application Binary Interface (ABI) for the Arm architecture)

此组规范规定了一些特定兼容性规范。

  1. the C Library ABI for the Arm Architecture(CLIBABI)
  2. the Base Standard ABI for the Arm Architecture(BSABI)
  3. the libc++ library conforms to the C++ ABI for the Arm Architecture(CPPABI)

【解读】:MDK中对标准库的支持是采用静态二进制的加载方式,如果对其api跳转的话,只能跳到***.h文件。 并且以extern _ARMABI 方式进行声明。举例如下:

cpp 复制代码
extern _ARMABI void *memcpy(void * __restrict /*s1*/,
                   const void * __restrict /*s2*/, size_t /*n*/) __attribute__((__nonnull__(1,2)));
  /*
   * copies n characters from the object pointed to by s2 into the object
   * pointed to by s1. If copying takes place between objects that overlap,
   * the behaviour is undefined.
   * Returns: the value of s1.
   */
extern _ARMABI void *memmove(void * /*s1*/,
                   const void * /*s2*/, size_t /*n*/) __attribute__((__nonnull__(1,2)));
  /*
   * copies n characters from the object pointed to by s2 into the object
   * pointed to by s1. Copying takes place as if the n characters from the
   * object pointed to by s2 are first copied into a temporary array of n
   * characters that does not overlap the objects pointed to by s1 and s2,
   * and then the n characters from the temporary array are copied into the
   * object pointed to by s1.
   * Returns: the value of s1.
   */
extern _ARMABI char *strcpy(char * __restrict /*s1*/, const char * __restrict /*s2*/) __attribute__((__nonnull__(1,2)));
  /*
   * copies the string pointed to by s2 (including the terminating nul
   * character) into the array pointed to by s1. If copying takes place
   * between objects that overlap, the behaviour is undefined.
   * Returns: the value of s1.
   */
extern _ARMABI char *strncpy(char * __restrict /*s1*/, const char * __restrict /*s2*/, size_t /*n*/) __attribute__((__nonnull__(1,2)));
  /*
   * copies not more than n characters (characters that follow a null
   * character are not copied) from the array pointed to by s2 into the array
   * pointed to by s1. If copying takes place between objects that overlap,
   * the behaviour is undefined.
   * Returns: the value of s1.
   */

包涵string.h、

  1. string.h
cpp 复制代码
#ifndef __string_h			/* 1. 预防重复加载 */
#define __string_h
#define __ARMCLIB_VERSION 6180002	/* 2. 版本控制 */

/* _ARMABI 译为Application Binary Interface for the ARM Architecture */
#define _ARMABI __attribute__((__nothrow__))

  #ifndef __STRING_DECLS
  #define __STRING_DECLS
相关推荐
AC赳赳老秦9 分钟前
采集行为合规自检:OpenClaw 自动校验 robots 协议与采集频率,规避违规采集风险
java·开发语言·c++·python·php·deepseek·openclaw
无名猿29 分钟前
C++ 查找算法:std::find 与容器成员 find 的性能差距
c++·性能优化·stl·标准库
杨丰玮41830 分钟前
C语言基础知识(一)————各类符号的含义与输入输出库(stdio)
c语言·开发语言
程序猿编码1 小时前
工业视觉多任务方案:可编程梯度信息视觉框架,训练评估 + C++ 部署完整实战
开发语言·c++·视觉·推理引擎
水饺编程2 小时前
第1章,了解乌班图环境,使用浏览器和邮箱
c语言·汇编·ubuntu
朝朝辞暮i2 小时前
C++ 第 21 课:struct —— 把一组相关数据打包在一起
开发语言·c++·算法
SHARK_pssm3 小时前
【C++——类和对象(下)】
开发语言·c++·经验分享·笔记
Escalating_xu3 小时前
【C 语言】操作符详解(下):逗号、下标、结构体、类型转换与表达式求值
c语言
汉克老师4 小时前
GESP2026年9月认证C++二级( 第一部分选择题(1~7题)精讲
c++·gesp·小学生·学c++编程
沫璃染墨4 小时前
《从零入门Linux系统篇(五十四):线程篇·七——互斥锁底层原理:从原子交换到线程竞争与锁实现》
linux·运维·服务器·开发语言·c++·驱动开发·系统架构