Skip to content

[fixed]增加条件编译,防止RT_USING_DFS没有定义时 _sys_flen()出现编译警告:stat变量定义但没有被调用 的问题 #3803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bsp/stm32/stm32f072-st-nucleo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NUCLEO-F072RB 开发板常用 **板载资源** 如下:
- 常用接口:USB 转串口、Arduino Uno 和 ST morpho 两类扩展接口
- 调试接口:板载 ST-LINK/V2-1 调试器。

更多相关信息资料见 ST 官网详情页:[NUCLEO_F072RB_STM32Nucleo-64开发板]https://www.stmcu.com.cn/Designresource/design_resource_detail?file_name=NUCLEO_F072RB_STM32Nucleo-64%E5%BC%80%E5%8F%91%E6%9D%BF&lang=EN&ver=
开发板更多详细信息请参考意法半导体[NUCLEO-F072RB](https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-nucleo-boards/nucleo-f072rb.html)

## 外设支持

Expand Down
8 changes: 4 additions & 4 deletions bsp/stm32/stm32f091-st-nucleo/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# BSP README 模板
# NUCLEO-F091RC 开发板 BSP 说明

## 简介

本文档为 RT-Thread 开发团队为 STM32F091RC-NuCLEO 开发板提供的 BSP (板级支持包) 说明。
本文档为 RT-Thread 开发团队为 STM32F091RC-NUCLEO 开发板提供的 BSP (板级支持包) 说明。

主要内容如下:

Expand All @@ -22,15 +22,15 @@ STM32F091RC-NuCLEO 开发板是 ST 官方推出的一款基于 ARM Cortex-M0 内

该开发板常用 **板载资源** 如下:

- MCU:STM32F091,主频 48MHz,256KB FLASH ,32KB RAM
- MCU:STM32F091RC,主频 48MHz,256KB FLASH ,32KB RAM
- 外部 RAM:无
- 外部 FLASH:无
- 常用外设
- 按键:1个,user(兼具唤醒功能,PC13)
- 常用接口:USB 转串口、arduino 接口等
- 调试接口,标准 SWD

开发板更多详细信息请参考 ST 的 [NUCLEO 开发板介绍](https://www.st.com/en/evaluation-tools/stm32-mcu-nucleo.html?querycriteria=productId=LN1847)。
开发板更多详细信息请参考意法半导体[NUCLEO-F091RC](https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-nucleo-boards/nucleo-f091rc.html)。

## 外设支持

Expand Down
6 changes: 3 additions & 3 deletions bsp/stm32/stm32f412-st-nucleo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

![board](figures/board.png)

该开发板常用 ** 板载资源 ** 如下:
该开发板常用 **板载资源** 如下:

- MCU:STM32F411ZG,主频 100MHz,1024KB FLASH ,256KB RAM。
- MCU:STM32F412ZG,主频 100MHz,1024KB FLASH ,256KB RAM。
- 常用外设
- LED:3 个,USB communication (LD1), user LED (LD2), power LED (LD3) 。
- 按键,2 个,USER and RESET 。
Expand Down Expand Up @@ -71,7 +71,7 @@

#### 运行结果

下载程序成功之后,系统会自动运行,观察开发板上 LED 的运行效果,红色 LD3 和 LD1 常亮、绿色 LD2 会周期性闪烁。
下载程序成功之后,系统会自动运行,观察开发板上 LED 的运行效果,红色 LD3 和 LD1 常亮、蓝色 LD2 会周期性闪烁。

USB 虚拟 COM 端口默认连接串口 3,在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:

Expand Down
10 changes: 6 additions & 4 deletions components/libc/compilers/armlibc/stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* 2013-11-24 aozima fixed _sys_read()/_sys_write() issues.
* 2014-08-03 bernard If using msh, use system() implementation
* in msh.
* 2020-08-05 Meco Man fixed _sys_flen() compiling-warning when
* RT_USING_DFS is not defined
*/

#include <string.h>
Expand Down Expand Up @@ -265,16 +267,16 @@ RT_WEAK void _sys_exit(int return_code)
*/
long _sys_flen(FILEHANDLE fh)
{
#ifdef RT_USING_DFS
struct stat stat;

if (fh < STDERR)
return -1;

#ifndef RT_USING_DFS
return -1;
#else
fstat(fh, &stat);
return stat.st_size;
#else
return -1;
#endif
}

Expand Down