Skip to content

Commit

Permalink
[project]Optimize the arm2d project directory structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rbb666 committed Jun 14, 2024
1 parent c34b68e commit 3c30d88
Show file tree
Hide file tree
Showing 28 changed files with 1,814 additions and 311 deletions.
38 changes: 20 additions & 18 deletions projects/arm2d/vision_board_mipi_2.0inch_arm2d/.config
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_FREEMODBUS is not set
# CONFIG_PKG_USING_NANOPB is not set
# CONFIG_PKG_USING_WIFI_HOST_DRIVER is not set

#
# Wi-Fi
Expand Down Expand Up @@ -481,8 +480,26 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# CONFIG_PKG_USING_RT_MEMCPY_CM is not set
# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
# CONFIG_PKG_USING_AUNITY is not set
CONFIG_PKG_USING_RT_VSNPRINTF_FULL=y
CONFIG_PKG_RT_VSNPRINTF_FULL_PATH="/packages/system/enhanced-kservice/rt_vsnprintf_full"
CONFIG_PKG_VSNPRINTF_SUPPORT_DECIMAL_SPECIFIERS=y
CONFIG_PKG_VSNPRINTF_SUPPORT_EXPONENTIAL_SPECIFIERS=y
CONFIG_PKG_VSNPRINTF_SUPPORT_WRITEBACK_SPECIFIER=y
CONFIG_PKG_VSNPRINTF_SUPPORT_LONG_LONG=y
CONFIG_PKG_VSNPRINTF_CHECK_FOR_NUL_IN_FORMAT_SPECIFIER=y
# CONFIG_PKG_VSNPRINTF_SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS is not set
CONFIG_PKG_VSNPRINTF_INTEGER_BUFFER_SIZE=32
CONFIG_PKG_VSNPRINTF_DECIMAL_BUFFER_SIZE=32
CONFIG_PKG_VSNPRINTF_DEFAULT_FLOAT_PRECISION=6
CONFIG_PKG_VSNPRINTF_MAX_INTEGRAL_DIGITS_FOR_DECIMAL=9
CONFIG_PKG_VSNPRINTF_LOG10_TAYLOR_TERMS=4
# CONFIG_RT_VSNPRINTF_FULL_REPLACING_SPRINTF is not set
# CONFIG_RT_VSNPRINTF_FULL_REPLACING_SNPRINTF is not set
# CONFIG_RT_VSNPRINTF_FULL_REPLACING_PRINTF is not set
# CONFIG_RT_VSNPRINTF_FULL_REPLACING_VSPRINTF is not set
CONFIG_RT_VSNPRINTF_FULL_REPLACING_VSNPRINTF=y
CONFIG_PKG_USING_RT_VSNPRINTF_FULL_LATEST_VERSION=y
CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"

#
# acceleration: Assembly language or algorithmic acceleration packages
Expand Down Expand Up @@ -573,20 +590,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_STM32L4_CMSIS_DRIVER is not set
# CONFIG_PKG_USING_STM32WB55_SDK is not set
# CONFIG_PKG_USING_STM32_SDIO is not set

#
# Infineon HAL Packages
#
# CONFIG_PKG_USING_INFINEON_CAT1CM0P is not set
# CONFIG_PKG_USING_INFINEON_CMSIS is not set
# CONFIG_PKG_USING_INFINEON_CORE_LIB is not set
# CONFIG_PKG_USING_INFINEON_MTB_HAL_CAT1 is not set
# CONFIG_PKG_USING_INFINEON_MTB_PDL_CAT1 is not set
# CONFIG_PKG_USING_INFINEON_RETARGET_IO is not set
# CONFIG_PKG_USING_INFINEON_CAPSENSE is not set
# CONFIG_PKG_USING_INFINEON_CSDIDAC is not set
# CONFIG_PKG_USING_INFINEON_SERIAL_FLASH is not set
# CONFIG_PKG_USING_INFINEON_USBDEV is not set
# CONFIG_PKG_USING_BLUETRUM_SDK is not set
# CONFIG_PKG_USING_EMBARC_BSP is not set
# CONFIG_PKG_USING_ESP_IDF is not set
Expand Down Expand Up @@ -772,7 +775,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# Signal Processing and Control Algorithm Packages
#
# CONFIG_PKG_USING_APID is not set
# CONFIG_PKG_USING_FIRE_PID_CURVE is not set
# CONFIG_PKG_USING_QPID is not set
# CONFIG_PKG_USING_UKAL is not set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/* Rotated : 0.0 deg */


#ifdef RTE_Acceleration_Arm_2D

#include "arm_2d.h"

Expand Down Expand Up @@ -17968,4 +17969,4 @@ const arm_2d_tile_t c_tileMeterPanelA4Mask = {
# pragma diag_warning=1296
#endif


#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from building import *
import os

cwd = GetCurrentDir()
group = []
src = Glob('*.c')
CPPPATH = [cwd]

group = group + DefineGroup('arm2d_app', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
12 changes: 12 additions & 0 deletions projects/arm2d/vision_board_mipi_2.0inch_arm2d/packages/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os
from building import *

objs = []
cwd = GetCurrentDir()
list = os.listdir(cwd)

for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
objs = objs + SConscript(os.path.join(item, 'SConscript'))

Return('objs')
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# rt_vsnprintf 完整功能版本

在RT-Thread的kservice.c源码中的这些函数的实现是为了满足RT-Thread内核的自持能力,即在不依赖标准C库的情况下,RT-Thread核心代码也可以正常运行,因此rt_kprintf、rt_sprintf、rt_snprintf、rt_vsnprintf这类打印函数(或者称之为rt_kprintf家族函数)仅仅满足内核的使用需求,不会实现完整的、和标准C库一致的功能,以减少ROM占用。但是,很多社区小伙伴希望rt_kprintf家族函数可以支持上更多的功能(例如打印浮点数据等等)。因此,本软件包实现了该功能。

本软件包实现了rt_kprintf家族函数的全功能版本,因为rt_kprintf家族函数的核心功能都是调用rt_vsnprintf函数,因此只需要重新实现rt_vsnprintf函数即可。本软件包基于开源项目[printf](https://github.com/eyalroz/printf)重新实现了rt_vsnprintf,在4.1.0以及以上的RT-Thread版本中,只需要安装本软件包即可。若RT-Thread低于4.1.0版本,需要手动将kservice.c内的rt_vsnprintf函数注释掉,再安装本软件包。

关于newlib下使用自带printf函数的问题可以参考这边帖子的评论区:https://club.rt-thread.org/ask/article/2b0a1d202135b205.html

## 接管标准C库的printf家族函数(仅支持4.1.0及以上版本)
本软件包有三个功能宏开关,是否允许本软件包接管printf、sprintf以及snprintf函数,默认为yes,即接管。
也就是说,安装本软件包后,即便没有使能libc(RT_USING_LIBC),你可以正常的使用printf、sprintf以及snprintf函数,当你调用这三个函数时,会自动被rt_kprintf、rt_sprintf、rt_snprintf函数接管。你可以正常使用printf家族函数的所有功能。

```c
#include <stdio.h>

printf("hello world\n");
```
## ROM占用
GCC下占用8.6KB, Keil下占用8KB。远小于开启标准C库的ROM占用。
## 如何添加该软件包
```
RT-Thread online packages
system packages --->
enhanced kernel services --->
[*] rt_vsnprintf_full: fully functional version of rt_vsnprintf --->
Version (latest) --->
```
- 使用 `RT-Thread Studio` 打开 `RT-Thread Settings`, 点击添加软件包,输入关键字 `printf`, 添加 `rt_vsnprintf_full` 软件包,保存
![1](figures/1.png)
- 软件包目录下多出了一个 `rt_vsnprintf_full-latest` 包
![2](figures/2.png)
- 打开 rt_vsnprintf.c,发现其中也实现了 rt_vsnprintf
```c
rt_int32_t rt_vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list args)
{
return __vsnprintf(out_buffer, buf, size, fmt, args);
}
```

- 注释掉 kservice.c 中的 rt_vsnprintf **(只针对4.1.0版本以下)**

- 重新编译并运行 `rt_kprintf ``LOG_I`, 浮点数打印正常
![3](figures/3.png)



## 维护

[Meco Man](https://github.com/mysterywolf)

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from building import *

src = ['rt_vsnprintf.c']
CPPDEFINES = []

if GetDepend('RT_VSNPRINTF_FULL_REPLACING_SPRINTF'):
CPPDEFINES += ['sprintf=rt_sprintf']
if GetDepend('RT_VSNPRINTF_FULL_REPLACING_SNPRINTF'):
CPPDEFINES += ['snprintf=rt_snprintf']
if GetDepend('RT_VSNPRINTF_FULL_REPLACING_PRINTF'):
CPPDEFINES += ['printf=rt_kprintf']

group = DefineGroup('rt_kprintf', src, depend = ['PKG_USING_RT_VSNPRINTF_FULL'], CPPDEFINES = CPPDEFINES)
Return('group')
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3c30d88

Please sign in to comment.