keil stm32 : extern _ARMABI

keil stdio.h

extern _ARMABI int fputc(int /*c*/, FILE * /*stream*/) __attribute__((__nonnull__(2)));
   /*
    * writes the character specified by c (converted to an unsigned char) to
    * the output stream pointed to by stream, at the position indicated by the
    * asociated file position indicator (if defined), and advances the
    * indicator appropriately. If the file position indicator is not defined,
    * the character is appended to the output stream.
    * Returns: the character written. If a write error occurs, the error
    *          indicator is set and fputc returns EOF.
    */

 1. 商业公司,赚钱是目的。有一部分源代码,还是不会以源码的形式给出的。

ARM is a chip architecture.

ABI is application binary interface.   https://community.st.com/t5/stm32-mcus-products/what-does-quot-armabi-quot-mean/m-p/186698

2. keil 特有的吧?

_ARMABI is a Keil-specific #define. It isn't used in STM32CubeIDE. The toolchain within STM32CubeIDE comes with its own standard library files, you shouldn't need to copy the Keil ones over.
  https://community.st.com/t5/stm32cubeide-mcus/unknown-type-name-armabi/td-p/291050

printf函数的原型,printf()在 C 标准库函数中实质是一个宏,这个宏extern _ARMABI int printf是什么意思?

  https://zhidao.baidu.com/question/2056717816879546907.html

extern _ARMABI int printf(const char * __restrict /*format*/, ...) __attribute__((__nonnull__(1)));
请问这个宏是什么意思?能不能解释一下这个宏?宏不是用"#define"的吗?

追答

extern表示这是一个外部函数的声明;

_ARMABI 表示这是一个针对ARM的二进制接口

__attribute__((__nonnull__(1))) 表示调用函数时第一个参数不能为NULL,
__attribute__() 是用于“修饰”函数的,
__nonnull__(1) 表示第一个参数不为空。

int printf(const char * __restrict /*format*/, ...)

这一部分则是printf()函数的原型,后面的“…”表示这是一个可变参数的函数,即函数参数的数量、类型都可以变化的函数

### Keil 不打印调试信息的解决方案 当遇到Keil不打印调试信息的情况时,可能涉及多个方面的原因。以下是详细的排查和解决方法: #### 1. 检查硬件连接 确保目标板与PC之间的通信接口(如SWD、JTAG)已正确连接并工作正常。任何物理连接上的问题都会影响调试信息的传输。 #### 2. 配置串口重定向 为了使`printf()`函数能够通过UART发送输出到终端仿真器,需设置好标准I/O流重定向至特定端口。这通常涉及到修改项目中的初始化代码来启用相应外设,并指定其作为stdout/stderr设备[^2]。 ```c #include <stdio.h> #include "stm32f4xx_hal.h" // 定义USART句柄结构体实例化变量 extern UART_HandleTypeDef huart1; int __io_putchar(int ch) { HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF); return ch; } ``` 此段C语言代码片段展示了如何自定义`__io_putchar()`函数实现单字符写入操作,从而让后续调用`printf()`可以经由选定的串行通讯链路向外传递消息字符串。 #### 3. 开启ITM/SWO跟踪功能 对于基于ARM Cortex-M系列微控制器的应用开发而言,利用Instrumentation Trace Macrocell(ITM)以及Serial Wire Output(SWO)机制不失为一种高效便捷的方式来进行实时日志记录。具体做法是在工程属性里激活相关选项,并调整配套工具软件使之能接收来自这些特殊寄存器的数据包[^1]。 #### 4. 处理浮点数显示异常 如果仅限于浮点数值无法被正确呈现,则可能是由于缺少必要的库支持所致。针对此类情形,建议核查链接脚本内是否包含了对软/硬FP ABI模式的支持声明;另外还需确认编译参数中开启了相应的优化级别以便更好地处理这类复杂运算指令集[^3]。 ```makefile # Makefile 示例部分 LDFLAGS += -abi=hard -mfpu=fpv4-sp-d16 CFLAGS += -O2 -Wall $(LDFLAGS) ``` 上述Makefile摘录说明了怎样向构建过程中加入适当标记以确保最终生成的目标文件具备完整的数学计算能力。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值