硬汉嵌入式论坛

 找回密码
 立即注册
查看: 246|回复: 5
收起左侧

[ThreadX全家桶] _ux_system_slave地址居然为0

[复制链接]

28

主题

196

回帖

280

积分

高级会员

积分
280
发表于 2025-7-17 22:11:01 | 显示全部楼层 |阅读模式
CUBEMX 6.15.0, STM32U5 1.8.0,AC6, 定义的全局变量 UX_SYSTEM_SLAVE *_ux_system_slave;,地址居然是0
回复

使用道具 举报

28

主题

196

回帖

280

积分

高级会员

积分
280
 楼主| 发表于 2025-7-17 22:16:21 | 显示全部楼层
map文件中是有地址信息的,-0优化也是一样的。
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117512
QQ
发表于 2025-7-18 09:46:14 | 显示全部楼层
怎么理解,调试状态看地址是0,而MAP文件不是0,是这个意思吗
回复

使用道具 举报

28

主题

196

回帖

280

积分

高级会员

积分
280
 楼主| 发表于 2025-7-18 12:13:04 | 显示全部楼层
本帖最后由 ccschen 于 2025-7-18 18:39 编辑
eric2013 发表于 2025-7-18 09:46
怎么理解,调试状态看地址是0,而MAP文件不是0,是这个意思吗

是这个意思。
全局变量。
/* Define USBX Host variable.  */
UX_SYSTEM_SLAVE *_ux_system_slave;
函数里面这样引用的,地址为0,自然跑飞了。
    /* Get the pointer to the device. */
    device =  &_ux_system_slave -> ux_system_slave_device;
就这个文件里面。
ux_device_stack_initialize.c

map文件中_ux_system_slave的内存地址值是0x20001e10,在观察窗口中是0
以前的老工程,观察窗口中是对的。
现在用的最新的库最新的CUBEMX。
拷贝内容的时候就出错了。

    /* Store the high speed device framework address and length in the project structure.  */
    _ux_system_slave -> ux_system_slave_device_framework_high_speed =             device_framework_high_speed;


为什么图片不能刷出来?







回复

使用道具 举报

28

主题

196

回帖

280

积分

高级会员

积分
280
 楼主| 发表于 2025-7-18 21:01:21 | 显示全部楼层
结案,久了没弄,犯糊涂了,变量只是个指针,需要别的地方赋值,由于宏定义不对,所以相应的代码没执行。自己修改下就对了。
/* Defined, this value will only enable the host side of usbx.  */
//#define UX_HOST_SIDE_ONLY

/* Defined, this value will only enable the device side of usbx.  */
#define UX_DEVICE_SIDE_ONLY
/* Defined, this value will include the OTG polling thread. OTG can only be active if both host/device are present.
*/
#ifndef UX_HOST_SIDE_ONLY
#ifndef UX_DEVICE_SIDE_ONLY
#define UX_OTG_SUPPORT
#endif
#endif
回复

使用道具 举报

28

主题

196

回帖

280

积分

高级会员

积分
280
 楼主| 发表于 2025-7-18 21:01:27 | 显示全部楼层
结案,久了没弄,犯糊涂了,变量只是个指针,需要别的地方赋值,由于宏定义不对,所以相应的代码没执行。自己修改下就对了。
/* Defined, this value will only enable the host side of usbx.  */
//#define UX_HOST_SIDE_ONLY

/* Defined, this value will only enable the device side of usbx.  */
#define UX_DEVICE_SIDE_ONLY
/* Defined, this value will include the OTG polling thread. OTG can only be active if both host/device are present.
*/
#ifndef UX_HOST_SIDE_ONLY
#ifndef UX_DEVICE_SIDE_ONLY
#define UX_OTG_SUPPORT
#endif
#endif
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-8-12 06:01 , Processed in 0.062412 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表