您尚未登录。

楼主 # 2025-12-30 23:45:06

Amichael
会员
注册时间: 2025-12-30
已发帖子: 2
积分: 3

在STM32G0B1开发板上移植pika,遇到一个宏定义重复的问题,请问def_ins(OUT)这里的OUT可以换一个名称吗?

1,STM32G0B1使用stm32 cubemx 生成工程,添加了usb模块
2,使用pika CMSIS-PACK 添加pika模块
3,添加#include "pikaScript.h"
4,编译报错如下
Build started: Project: Lua_G0B1
*** Using Compiler 'V6.23', folder: 'd:\Keil_v5\ARM\ARMCLANG\Bin'
Build target 'Lua_G0B1'
../Core/Src/main.c(26): warning: In file included from...
../MDK-ARM/RTE/PikaScript\pikaScript.h(8): warning: In file included from...
../MDK-ARM/RTE/PikaScript\PikaObj.h(88): warning: In file included from...
../MDK-ARM/RTE/PikaScript\__instruction_table.h(43): error: redefinition of enumerator 'OUT'
43 | def_ins(OUT)
| ^
../Middlewares/ST/STM32_USB_Device_Library/Core/Inc\usbd_def.h(398): note: previous definition is here
398 | OUT = 0x00,
| ^
1 error generated.
compiling main.c...
compiling app_fatfs.c...
compiling user_diskio.c...
compiling usbd_desc.c...
compiling usb_device.c...
compiling stm32g0xx_it.c...
compiling usbd_storage_if.c...
compiling stm32g0xx_hal_pcd_ex.c...

尝试STM32F411,加入Mass storage class组件,出现同样的问题,宏定义重复。"OUT"定义重复
usbd_def.h(398)有定义
/ USB Device endpoint direction /
typedef enum
{
OUT = 0x00,
IN = 0x80,
} USBD_EPDirectionTypeDef;

和__instruction_table.h中的定义重复

/ clang-format off /
/ none /
def_ins(NON)
/ get referance /
def_ins(REF)
/ run function /
def_ins(RUN)
/ string /
def_ins(STR)
/ output /
def_ins(OUT)
/ number /
def_ins(NUM)
/ jump /
def_ins(JMP)

请问def_ins(OUT)这里的OUT可以换一个名称吗?

最近编辑记录 Amichael (2025-12-31 22:22:57)

离线

楼主 #2 2025-12-31 23:19:06

Amichael
会员
注册时间: 2025-12-30
已发帖子: 2
积分: 3

Re: 在STM32G0B1开发板上移植pika,遇到一个宏定义重复的问题,请问def_ins(OUT)这里的OUT可以换一个名称吗?

1,更改usb的配置 virtual port com,编译出现一下问题,stm32G0B1会出现以下问题,

compiling PikaObj.c...
compiling pikaScript.c...
compiling dataStack.c...
compiling dataStrs.c...
compiling dataString.c...
compiling __pikaBinding.c...
compiling PikaVM.c...
linking...

Lua_G0B1\Lua_G0B1.axf: Error: L6200E: Symbol Appli_state multiply defined (by usb_host.o and app_fatfs.o).
Not enough information to list image symbols.
Not enough information to list load addresses in the image map.
Finished: 2 information, 0 warning and 1 error messages.
"Lua_G0B1\Lua_G0B1.axf" - 1 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:05

2,stm32f411 会出现usb的配置 virtual port com或 mass storage class
compiling stm32g0xx_hal_rcc.c...
../Core/Src/main.c(26): warning: In file included from...
./RTE/PikaScript\pikaScript.h(8): warning: In file included from...
./RTE/PikaScript\PikaObj.h(88): warning: In file included from...
./RTE/PikaScript\__instruction_table.h(43): error: redefinition of enumerator 'OUT'
43 | def_ins(OUT)
| ^
../Middlewares/ST/STM32_USB_Device_Library/Core/Inc\usbd_def.h(398): note: previous definition is here
398 | OUT = 0x00,
| ^
1 error generated.
compiling main.c...
compiling stm32g0xx_hal_rcc_ex.c...
compiling stm32g0xx_hal_pcd.c...
compiling stm32g0xx_ll_usb.c...

最近编辑记录 Amichael (2025-12-31 23:36:15)

离线

#3 2026-01-13 20:53:50

lyon1998
Moderator
注册时间: 2021-12-01
已发帖子: 146
积分: 155

Re: 在STM32G0B1开发板上移植pika,遇到一个宏定义重复的问题,请问def_ins(OUT)这里的OUT可以换一个名称吗?

确实是个问题,这个会在下次更新的时候修改

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn


东莞哇酷科技有限公司开发