Browse Source

合并主线修改以支持动态生成裁剪宏头文件

master
Lizongdi 5 days ago
parent
commit
5221e2a8ca
  1. 12
      CMakePresets.json
  2. 65
      Core/Inc/bsp_config.h
  3. 2
      robot/bspMCU/My_Lwip.c
  4. 2
      robot/bspMCU/My_freeRTOS.c
  5. 4
      robot/bspMCU/My_print.c
  6. 2
      robot/bspMCU/include/bsp_CAN.h
  7. 2
      robot/bspMCU/include/bsp_cap.h
  8. 2
      robot/bspMCU/include/bsp_i2c.h
  9. 2
      robot/bspMCU/include/bsp_uart.h
  10. 2
      robot/bspMCU/include/bsp_usb.h
  11. 2
      robot/bspMCU/include/drv_interface.h
  12. 2
      robot/bspMCU/include/stmflash.h
  13. 4
      robot/bspMCU/l_can.c
  14. 2
      robot/bspMCU/l_stm32.c
  15. 2
      robot/bspMCU/l_uart.c
  16. 10
      robot/library/common/CMakeLists.txt
  17. 41
      robot/library/common/common_cfg.h.in
  18. 2
      robot/library/common/include/common.h

12
CMakePresets.json

@ -29,14 +29,22 @@
"BUILD_PERIPHERAL": "ON",
"BUILD_LIST": "ON",
"BUILD_BSPMCU": "ON",
"MY_MEMPOOL_SIZE": "46 * 1024"
"MY_MEMPOOL_SIZE": "46*1024",
"IOC_100PIN": true,
"USE_LUA_ST": true,
"USE_LUA_ST_CAN": true,
"USE_UART": true,
"USE_CAN": true,
"USE_FREERTOS": true
}
},
{
"name": "robot",
"inherits": "Spool-end",
"cacheVariables": {
"BUILD_OPTIONAL": "ON"
"BUILD_OPTIONAL": "ON",
"USE_TALNET": true,
"USE_LWIP": true
}
}
]

65
Core/Inc/bsp_config.h

@ -1,65 +0,0 @@
#ifndef __BSP_CONFIG_H__
#define __BSP_CONFIG_H__
#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */
/* 打印串口配置 */
#define IOC_100PIN // 100引脚芯片
#define USE_TALNET
/* 编译My_print.c */
// #define USE_PRINT
// #define PRINT_ID 1 // 串口打印映射的串口号,对应g_ptUartTab全局
// 如果还需要getchar需要将Myprint_IRQHandler放置到对应的中断服务中
// 如果注释掉该全局则表示使用usb的cdc来作为打印串口
// #define LUACOM_ID 2 //这里是Lua的COM模块初始化1或2使用的串口,确保不要和PRINT_ID一致即可
/* 编译l_stm32.c */
#define USE_LUA_ST
/* 编译l_can.c */
#define USE_LUA_ST_CAN
/* 编译l_uart.c */
// #define USE_LUA_ST_UART
/* 编译bsp_cap.c */
// #define USE_TIMER
/* 编译bsp_uart.c */
#define USE_UART
/* 默认使用空闲中断DMA方式,注释掉后使用传统字节中断 */
//#define CONFIG_UART_IT_IDLEDMA
/* 编译bsp_usb.c */
// #define USE_USB
/* 编译bsp_i2c.c */
// #define USE_I2C
/* 编译stmflash.c */
// #define USE_ONCHIP_FLASH
#define USE_CAN
#define CONFIG_CAN_BUFFER_SIZE 128
#define USE_FREERTOS
#define USE_LWIP
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */
#endif /* __L_STM32_H__ */

2
robot/bspMCU/My_Lwip.c

@ -16,7 +16,7 @@
:
******************************************************************************/
#include "bsp_config.h"
#include "common.h"
#ifdef USE_LWIP
#include "lwip/sockets.h"
#include "lwip/netdb.h"

2
robot/bspMCU/My_freeRTOS.c

@ -16,7 +16,7 @@
:
******************************************************************************/
#include "bsp_config.h"
#include "common.h"
#ifdef USE_FREERTOS
#include "cmsis_os.h"
#include "FreeRTOS.h"

4
robot/bspMCU/My_print.c

@ -1,4 +1,4 @@
#include "bsp_config.h"
#include "common.h"
#ifdef USE_PRINT
#include <stdio.h>
#include <stdint.h>
@ -8,7 +8,7 @@
#include "main.h"
#include "bsp_uart.h"
#include "rd_time.h"
#include "bsp_config.h"
#include "common.h"
#ifdef USE_FREERTOS
#include "cmsis_os.h"
#endif

2
robot/bspMCU/include/bsp_CAN.h

@ -59,7 +59,7 @@ extern "C"{
/*==============================================*
* include header files *
*----------------------------------------------*/
#include "bsp_config.h"
#include "common.h"
#ifdef USE_CAN
#include "main.h"
#include "com.h"

2
robot/bspMCU/include/bsp_cap.h

@ -12,7 +12,7 @@
#ifndef __BSP_CAP_H
#define __BSP_CAP_H
#include "bsp_config.h"
#include "common.h"
#ifdef USE_TIMER
#include "tim.h"
#include "stdbool.h"

2
robot/bspMCU/include/bsp_i2c.h

@ -2,7 +2,7 @@
#define BSP_I2C_H
#include "bsp_config.h"
#include "common.h"
#ifdef USE_I2C
#include "main.h"
#include <stdint.h>

2
robot/bspMCU/include/bsp_uart.h

@ -2,7 +2,7 @@
#define BSP_UART_H
#include "bsp_config.h"
#include "common.h"
#ifdef USE_UART
#include "com.h"
#include "usart.h"

2
robot/bspMCU/include/bsp_usb.h

@ -59,7 +59,7 @@ extern "C"{
/*==============================================*
* include header files *
*----------------------------------------------*/
#include "bsp_config.h"
#include "common.h"
#ifdef USE_USB
#include "com.h"

2
robot/bspMCU/include/drv_interface.h

@ -59,7 +59,7 @@ extern "C"{
/*==============================================*
* include header files *
*----------------------------------------------*/
#include "bsp_config.h"
#include "common.h"
#include "main.h"
#include "bsp_uart.h"
#include "bsp_CAN.h"

2
robot/bspMCU/include/stmflash.h

@ -59,7 +59,7 @@ extern "C"{
/*==============================================*
* include header files *
*----------------------------------------------*/
#include "bsp_config.h"
#include "common.h"
#ifdef USE_ONCHIP_FLASH
#include <stdint.h>
#include "main.h"

4
robot/bspMCU/l_can.c

@ -1,9 +1,11 @@
#include "bsp_config.h"
#include "common.h"
#ifdef USE_LUA_ST_CAN
#include "lua_base.h"
#include "fdcan.h"
#include "bsp_can.h"
#define CONFIG_CAN_BUFFER_SIZE 128
typedef struct
{
TComCtrl *m_ptComCtrl;

2
robot/bspMCU/l_stm32.c

@ -1,4 +1,4 @@
#include "bsp_config.h"
#include "common.h"
#ifdef USE_LUA_ST
#include <unistd.h>
#include "lua_base.h"

2
robot/bspMCU/l_uart.c

@ -1,4 +1,4 @@
#include "bsp_config.h"
#include "common.h"
#ifdef USE_LUA_ST_UART
#include "lua_base.h"
#include "bsp_uart.h"

10
robot/library/common/CMakeLists.txt

@ -7,3 +7,13 @@ if(EXISTS ${COMMON_CMAKE_PATH})
else()
message(FATAL_ERROR "Cannot find common build logic at ${COMMON_CMAKE_PATH}")
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/common_cfg.h.in
${CMAKE_CURRENT_BINARY_DIR}/common_cfg.h
@ONLY
)
target_include_directories(common PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
)

41
robot/library/common/common_cfg.h.in

@ -0,0 +1,41 @@
// TEMPLATE FILE: Copy this file and rename the extension to .h before use.
// DO NOT edit this file directly.
#ifndef __COMMON_CFG_H__
#define __COMMON_CFG_H__
#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */
#cmakedefine MEM_POOL_TOTAL_SIZE @MEM_POOL_TOTAL_SIZE@
#cmakedefine IOC_100PIN
#cmakedefine USE_TALNET
#cmakedefine USE_LUA_ST
#cmakedefine USE_UART
#cmakedefine CONFIG_UART_IT_IDLEDMA
#cmakedefine USE_LUA_ST_UART
#cmakedefine USE_PRINT
#cmakedefine USE_TIMER
#cmakedefine USE_USB
#cmakedefine USE_I2C
#cmakedefine USE_ONCHIP_FLASH
#cmakedefine USE_CAN
#cmakedefine USE_LUA_ST_CAN
#cmakedefine USE_FREERTOS
#cmakedefine USE_LWIP
#cmakedefine LUACOM_ID @LUACOM_ID@
#cmakedefine PRINT_ID @PRINT_ID@
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */
#endif /* __L_STM32_H__ */

2
robot/library/common/include/common.h

@ -2,6 +2,8 @@
#define COMMON_H
#include "common_cfg.h"
#define rd_inline static __inline
#define RD_SUCCESS 0 //成功

Loading…
Cancel
Save