ptr_out.c

本文展示了一个简单的C语言程序,该程序使用printf函数输出整型变量value的内存地址。通过这个例子,读者可以了解到如何在C语言中获取并打印变量的地址。

  name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-5572165936844014&dt=1194442938015&lmt=1194190197&format=336x280_as&output=html&correlator=1194442937843&url=file%3A%2F%2F%2FC%3A%2FDocuments%2520and%2520Settings%2Flhh1%2F%E6%A1%8C%E9%9D%A2%2FCLanguage.htm&color_bg=FFFFFF&color_text=000000&color_link=000000&color_url=FFFFFF&color_border=FFFFFF&ad_type=text&ga_vid=583001034.1194442938&ga_sid=1194442938&ga_hid=1942779085&flash=9&u_h=768&u_w=1024&u_ah=740&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="336" scrolling="no" height="280" allowtransparency="allowtransparency"> #include <stdio.h>

void main(void)
 {
   int value;

   printf("The address of the variable value is %p/n", &value);
 }

 

PS F:\程序员的日常\python\AI_Manager> & 'e:\python\python.exe' 'c:\Users\13636\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher' '63298' '--' 'f:\程序员的日常\python\AI_Manager\Progress\app\text_to_speech.py' 14:27:06 DEBUG:comtypes:CoInitializeEx(None, 2) 14:27:06 INFO:comtypes.client._code_cache:Imported existing <module 'comtypes.gen' from 'e:\\python\\Lib\\site-packages\\comtypes\\gen\\__init__.py'> 14:27:06 INFO:comtypes.client._code_cache:Using writeable comtypes cache directory: 'e:\python\Lib\site-packages\comtypes\gen' 14:27:06 DEBUG:comtypes.client._create:SAPI.SPVoice -> {96749377-3391-11D2-9EE3-00C04F797396} 14:27:06 DEBUG:comtypes.client._create:CoCreateInstance({96749377-3391-11D2-9EE3-00C04F797396}, clsctx=None, interface=None) 14:27:06 DEBUG:comtypes.client._managing:GetBestInterface(<POINTER(IUnknown) ptr=0x275877d7b70 at 2758ac55450>) 14:27:06 DEBUG:comtypes.client._managing:Does implement IProvideClassInfo 14:27:06 DEBUG:comtypes.client._managing:Default interface is {269316D8-57BD-11D2-9EEE-00C04F797396} 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x275877d7bb0 at 2758b57ef50> 14:27:06 DEBUG:comtypes.client._generate:GetModule(TLIBATTR(GUID={C866CA3A-32F7-11D2-9602-00C04F8EE628}, Version=5.4, LCID=0, FLags=0x8)) 14:27:06 DEBUG:comtypes.client._managing:Implements default interface from typeinfo <class 'comtypes.gen._C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.ISpeechVoice'> 14:27:06 DEBUG:comtypes.client._managing:Final result is <POINTER(ISpeechVoice) ptr=0x275877d7bb0 at 2758b57efd0> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IProvideClassInfo) ptr=0x275877d7bd0 at 2758b57eb50> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeInfo) ptr=0x2758aab6ef8 at 2758b57ebd0> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeInfo) ptr=0x2758aab6f50 at 2758b57ed50> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeLib) ptr=0x275883694e0 at 2758b57ef50> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x275877d7b70 at 2758ac55450> 14:27:06 DEBUG:comtypes.client._events:<POINTER(ISpeechVoice) ptr=0x275877d7bb0 at 2758b57efd0> using sinkinterface from clsid <class 'comtypes.gen._C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4._ISpeechVoiceEvents'> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IProvideClassInfo2) ptr=0x275877d7bd0 at 2758ac55450> 14:27:06 DEBUG:comtypes._vtbl:<comtypes.client._events.CreateEventReceiver.<locals>.Sink object at 0x000002758B16BB60>: _ISpeechVoiceEvents.VoiceChange not implemented 14:27:06 DEBUG:comtypes._vtbl:<comtypes.client._events.CreateEventReceiver.<locals>.Sink object at 0x000002758B16BB60>: _ISpeechVoiceEvents.Bookmark not implemented 14:27:06 DEBUG:comtypes._vtbl:<comtypes.client._events.CreateEventReceiver.<locals>.Sink object at 0x000002758B16BB60>: _ISpeechVoiceEvents.Sentence not implemented 14:27:06 DEBUG:comtypes._vtbl:<comtypes.client._events.CreateEventReceiver.<locals>.Sink object at 0x000002758B16BB60>: _ISpeechVoiceEvents.Phoneme not implemented 14:27:06 DEBUG:comtypes._vtbl:<comtypes.client._events.CreateEventReceiver.<locals>.Sink object at 0x000002758B16BB60>: _ISpeechVoiceEvents.Viseme not implemented 14:27:06 DEBUG:comtypes._vtbl:<comtypes.client._events.CreateEventReceiver.<locals>.Sink object at 0x000002758B16BB60>: _ISpeechVoiceEvents.AudioLevel not implemented 14:27:06 DEBUG:comtypes._vtbl:<comtypes.client._events.CreateEventReceiver.<locals>.Sink object at 0x000002758B16BB60>: _ISpeechVoiceEvents.EnginePrivate not implemented 14:27:06 DEBUG:comtypes.client._events:Start advise <class 'comtypes.gen._C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4._ISpeechVoiceEvents'> 14:27:06 DEBUG:comtypes._comobject:<comtypes.client._events.CreateEventReceiver.<locals>.Sink object at 0x000002758B16BB60>.QueryInterface({A372ACD1-3BEF-4BBD-8FFB-CB3E2B416AF8}) -> S_OK 14:27:06 DEBUG:comtypes._comobject:1 active COM objects: Added <comtypes.client._events.CreateEventReceiver.<locals>.Sink object at 0x000002758B16BB60> 14:27:06 DEBUG:comtypes._comobject:<comtypes.client._events.CreateEventReceiver.<locals>.Sink object at 0x000002758B16BB60>.AddRef() -> 1 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IConnectionPointContainer) ptr=0x275877d7bd8 at 2758b2a5c50> 14:27:06 DEBUG:comtypes.client._managing:wrap_outparam(<POINTER(ISpeechObjectToken) ptr=0x275877d88d0 at 2758b2a5c50>) 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ISpeechObjectToken) ptr=0x275877d88d0 at 2758b2a5c50> 14:27:06 DEBUG:comtypes.client._managing:wrap_outparam(<POINTER(ISpeechObjectTokens) ptr=0x2758cadf550 at 2758b2a5c50>) 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758b7c3a20 at 2758b2a5a50> 14:27:06 DEBUG:comtypes.client._managing:wrap_outparam(<POINTER(IDispatch) ptr=0x2758b7c19e0 at 2758b2a56d0>) 14:27:06 DEBUG:comtypes.client._managing:GetBestInterface(<POINTER(IDispatch) ptr=0x2758b7c19e0 at 2758b2a56d0>) 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo, trying IProvideClassInfo2 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo/IProvideClassInfo2 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758aab7000 at 2758b2a6650> 14:27:06 DEBUG:comtypes.client._managing:Default interface is {C74A3ADC-B727-4500-A84A-B526721C8B8C} 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758b7c19e0 at 2758b5e82d0> 14:27:06 DEBUG:comtypes.client._generate:GetModule(TLIBATTR(GUID={C866CA3A-32F7-11D2-9602-00C04F8EE628}, Version=5.4, LCID=0, FLags=0x8)) 14:27:06 DEBUG:comtypes.client._managing:Implements default interface from typeinfo <class 'comtypes.gen._C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.ISpeechObjectToken'> 14:27:06 DEBUG:comtypes.client._managing:Final result is <POINTER(ISpeechObjectToken) ptr=0x2758b7c19e0 at 2758b5e82d0> 14:27:06 DEBUG:comtypes.client._managing:wrap_outparam(<POINTER(ISpeechObjectTokens) ptr=0x2758cadf7a0 at 2758b5e83d0>) 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758b7c48c0 at 2758b5e8450> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ISpeechObjectTokens) ptr=0x2758cadf7a0 at 2758b5e83d0> 14:27:06 DEBUG:comtypes.client._managing:wrap_outparam(<POINTER(IDispatch) ptr=0x2758b7c14d0 at 2758b5e8450>) 14:27:06 DEBUG:comtypes.client._managing:GetBestInterface(<POINTER(IDispatch) ptr=0x2758b7c14d0 at 2758b5e8450>) 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c19e0 at 2758b2a6450> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeInfo) ptr=0x2758aab7000 at 2758b2a5650> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeLib) ptr=0x275883694e0 at 2758b2a6150> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c19e0 at 2758b2a56d0> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IEnumVARIANT) ptr=0x2758b7c3a20 at 2758b2a5850> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ISpeechObjectTokens) ptr=0x2758cadf550 at 2758b2a5c50> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ISpeechObjectToken) ptr=0x2758b7c19e0 at 2758b5e82d0> 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo, trying IProvideClassInfo2 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo/IProvideClassInfo2 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758aab7000 at 2758b2a5c50> 14:27:06 DEBUG:comtypes.client._managing:Default interface is {C74A3ADC-B727-4500-A84A-B526721C8B8C} 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758b7c14d0 at 2758b2a56d0> 14:27:06 DEBUG:comtypes.client._generate:GetModule(TLIBATTR(GUID={C866CA3A-32F7-11D2-9602-00C04F8EE628}, Version=5.4, LCID=0, FLags=0x8)) 14:27:06 DEBUG:comtypes.client._managing:Implements default interface from typeinfo <class 'comtypes.gen._C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.ISpeechObjectToken'> 14:27:06 DEBUG:comtypes.client._managing:Final result is <POINTER(ISpeechObjectToken) ptr=0x2758b7c14d0 at 2758b2a6150> 14:27:06 DEBUG:comtypes.client._managing:wrap_outparam(<POINTER(IDispatch) ptr=0x2758b7c1c20 at 2758b2a5950>) 14:27:06 DEBUG:comtypes.client._managing:GetBestInterface(<POINTER(IDispatch) ptr=0x2758b7c1c20 at 2758b2a5950>) 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c14d0 at 2758b2a59d0> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeInfo) ptr=0x2758aab7000 at 2758b2a5850> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeLib) ptr=0x275883694e0 at 2758b2a56d0> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c14d0 at 2758b5e8450> 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo, trying IProvideClassInfo2 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo/IProvideClassInfo2 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758aab7000 at 2758b2a5a50> 14:27:06 DEBUG:comtypes.client._managing:Default interface is {C74A3ADC-B727-4500-A84A-B526721C8B8C} 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758b7c1c20 at 2758b57fa50> 14:27:06 DEBUG:comtypes.client._generate:GetModule(TLIBATTR(GUID={C866CA3A-32F7-11D2-9602-00C04F8EE628}, Version=5.4, LCID=0, FLags=0x8)) 14:27:06 DEBUG:comtypes.client._managing:Implements default interface from typeinfo <class 'comtypes.gen._C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.ISpeechObjectToken'> 14:27:06 DEBUG:comtypes.client._managing:Final result is <POINTER(ISpeechObjectToken) ptr=0x2758b7c1c20 at 2758b2a60d0> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ISpeechObjectToken) ptr=0x2758b7c14d0 at 2758b2a6150> 14:27:06 DEBUG:comtypes.client._managing:wrap_outparam(<POINTER(IDispatch) ptr=0x2758b7c15f0 at 2758b5e8450>) 14:27:06 DEBUG:comtypes.client._managing:GetBestInterface(<POINTER(IDispatch) ptr=0x2758b7c15f0 at 2758b5e8450>) 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c1c20 at 2758b2a56d0> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeInfo) ptr=0x2758aab7000 at 2758b2a5850> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeLib) ptr=0x275883694e0 at 2758b57fa50> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c1c20 at 2758b2a5950> 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo, trying IProvideClassInfo2 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo/IProvideClassInfo2 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758aab7000 at 2758b2a6550> 14:27:06 DEBUG:comtypes.client._managing:Default interface is {C74A3ADC-B727-4500-A84A-B526721C8B8C} 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758b7c15f0 at 2758b2a5850> 14:27:06 DEBUG:comtypes.client._generate:GetModule(TLIBATTR(GUID={C866CA3A-32F7-11D2-9602-00C04F8EE628}, Version=5.4, LCID=0, FLags=0x8)) 14:27:06 DEBUG:comtypes.client._managing:Implements default interface from typeinfo <class 'comtypes.gen._C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.ISpeechObjectToken'> 14:27:06 DEBUG:comtypes.client._managing:Final result is <POINTER(ISpeechObjectToken) ptr=0x2758b7c15f0 at 2758b2a5c50> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ISpeechObjectToken) ptr=0x2758b7c1c20 at 2758b2a60d0> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c15f0 at 2758b2a5650> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeInfo) ptr=0x2758aab7000 at 2758b2a5950> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeLib) ptr=0x275883694e0 at 2758b2a5850> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c15f0 at 2758b5e8450> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ISpeechObjectToken) ptr=0x2758b7c15f0 at 2758b2a5c50> 14:27:06 INFO:__main__:🔊 TTS 引擎初始化成功 14:27:06 DEBUG:__main__:🔊 TTS 工作线程运行中... 14:27:06 DEBUG:__main__:🎧 TTS 工作线程已启动 (daemon) 14:27:06 INFO:__main__:✅ TTS 非阻塞事件循环已启动 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IEnumVARIANT) ptr=0x2758b7c48c0 at 2758b5e8350> 14:27:06 DEBUG:__main__:📥 添加语音任务: 你好,我是AI助手。... 14:27:06 INFO:__main__:📢 正在播报: 你好,我是AI助手。... 14:27:06 DEBUG:comtypes.client._managing:wrap_outparam(<POINTER(ISpeechObjectToken) ptr=0x275877d88d0 at 2758b2a6650>) 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ISpeechObjectToken) ptr=0x275877d88d0 at 2758b2a6650> 14:27:06 DEBUG:comtypes.client._managing:wrap_outparam(<POINTER(ISpeechObjectTokens) ptr=0x2758cae5d80 at 2758b2a6550>) 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758b7c3ba0 at 2758b2a59d0> 14:27:06 DEBUG:comtypes.client._managing:wrap_outparam(<POINTER(IDispatch) ptr=0x2758b7c1e60 at 2758b2a56d0>) 14:27:06 DEBUG:comtypes.client._managing:GetBestInterface(<POINTER(IDispatch) ptr=0x2758b7c1e60 at 2758b2a56d0>) 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo, trying IProvideClassInfo2 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo/IProvideClassInfo2 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758aab7000 at 2758b2a6450> 14:27:06 DEBUG:comtypes.client._managing:Default interface is {C74A3ADC-B727-4500-A84A-B526721C8B8C} 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758b7c1e60 at 2758b5e84d0> 14:27:06 DEBUG:comtypes.client._generate:GetModule(TLIBATTR(GUID={C866CA3A-32F7-11D2-9602-00C04F8EE628}, Version=5.4, LCID=0, FLags=0x8)) 14:27:06 DEBUG:comtypes.client._managing:Implements default interface from typeinfo <class 'comtypes.gen._C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.ISpeechObjectToken'> 14:27:06 DEBUG:comtypes.client._managing:Final result is <POINTER(ISpeechObjectToken) ptr=0x2758b7c1e60 at 2758b5e82d0> 14:27:06 DEBUG:comtypes.client._managing:wrap_outparam(<POINTER(IDispatch) ptr=0x2758b7c14d0 at 2758b5e86d0>) 14:27:06 DEBUG:comtypes.client._managing:GetBestInterface(<POINTER(IDispatch) ptr=0x2758b7c14d0 at 2758b5e86d0>) 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c1e60 at 2758b2a60d0> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeInfo) ptr=0x2758aab7000 at 2758b5e8350> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeLib) ptr=0x275883694e0 at 2758b5e84d0> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c1e60 at 2758b2a56d0> 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo, trying IProvideClassInfo2 14:27:06 DEBUG:comtypes.client._managing:Does NOT implement IProvideClassInfo/IProvideClassInfo2 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758aab7000 at 2758b2a56d0> 14:27:06 DEBUG:comtypes.client._managing:Default interface is {C74A3ADC-B727-4500-A84A-B526721C8B8C} 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IUnknown) ptr=0x2758b7c14d0 at 2758b2a5650> 14:27:06 DEBUG:comtypes.client._generate:GetModule(TLIBATTR(GUID={C866CA3A-32F7-11D2-9602-00C04F8EE628}, Version=5.4, LCID=0, FLags=0x8)) 14:27:06 DEBUG:comtypes.client._managing:Implements default interface from typeinfo <class 'comtypes.gen._C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.ISpeechObjectToken'> 14:27:06 DEBUG:comtypes.client._managing:Final result is <POINTER(ISpeechObjectToken) ptr=0x2758b7c14d0 at 2758b2a5a50> 14:27:06 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ISpeechObjectToken) ptr=0x2758b7c1e60 at 2758b5e82d0> 14:27:09 DEBUG:__main__:🔚 TTS 工作线程退出 14:27:09 DEBUG:__main__:🛑 当前语音已停止 14:27:09 DEBUG:__main__:📥 添加语音任务: 这是第二次说话,应该能正常播放。... 14:27:09 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c14d0 at 2758b2a59d0> 14:27:09 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeInfo) ptr=0x2758aab7000 at 2758b2a6450> 14:27:09 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ITypeLib) ptr=0x275883694e0 at 2758b2a5650> 14:27:09 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IDispatch) ptr=0x2758b7c14d0 at 2758b5e86d0> 14:27:09 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(IEnumVARIANT) ptr=0x2758b7c3ba0 at 2758b2a6650> 14:27:09 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ISpeechObjectTokens) ptr=0x2758cae5d80 at 2758b2a6550> 14:27:09 DEBUG:comtypes._post_coinit.unknwn:Release <POINTER(ISpeechObjectToken) ptr=0x2758b7c14d0 at 2758b2a5a50> 14:27:12 DEBUG:__main__:📥 添加语音任务: 第三次测试,看看是不是还能响。... 14:27:18 INFO:__main__:🔇 开始关闭 TTS 引擎... 14:27:18 WARNING:__main__:⚠️ endLoop() 调用失败: run loop not started 14:27:18 DEBUG:comtypes._post_coinit.unknwn:Calling CoUninitialize() 14:27:18 DEBUG:comtypes._post_coinit.unknwn:CoUninitialize() done. Exception ignored in: <function _DeleteDummyThreadOnDel.__del__ at 0x0000027587F3F060> Traceback (most recent call last): File "e:\python\Lib\threading.py", line 1383, in __del__ TypeError: 'NoneType' object does not support the context manager protocol
最新发布
10-24
两个type结构体的指针分配有误 ! 设置大数组共享内存 - 分为5个变量 subroutine setup_shared_memory_data(node_comm, node_rank, ensemble_pi_ptr, & ensemble_u_ptr, ensemble_v_ptr, ensemble_th_ptr, ensemble_q_ptr, & back_data_ptr, true_data_ptr, & win_ensemble_pi, win_ensemble_u, win_ensemble_v, & win_ensemble_th, win_ensemble_q, win_back, win_true) use module_initial use iso_c_binding integer, intent(in) :: node_comm, node_rank real, pointer, intent(out) :: ensemble_pi_ptr(:,:,:,:), ensemble_u_ptr(:,:,:,:), ensemble_v_ptr(:,:,:,:), & ensemble_th_ptr(:,:,:,:), ensemble_q_ptr(:,:,:,:) type(model_data), pointer, intent(inout) :: back_data_ptr, true_data_ptr integer, intent(out) :: win_ensemble_pi, win_ensemble_u, win_ensemble_v, win_ensemble_th, win_ensemble_q, win_back, win_true integer(kind=MPI_ADDRESS_KIND) :: ssize_ensemble, ssize_data integer :: ierr, disp_unit type(c_ptr) :: baseptr_pi, baseptr_u, baseptr_v, baseptr_th, baseptr_q, baseptr_back, baseptr_true ! --------------------------------------------------- ! back_data_ptr 和 true_data_ptr 是 model_data 类型的指针 integer(kind=c_intptr_t) :: addr type(c_ptr) :: c_ptr_back, c_ptr_true ! --------------------------------------------------- disp_unit = 4 ! sizeof(real) ! 集合数据大小 - 每个变量单独分配 if (node_rank == 0) then ssize_ensemble = int(nx * nz * ny * nsample, MPI_ADDRESS_KIND) ! 单个变量 ssize_data = int(nx * nz * ny * 5, MPI_ADDRESS_KIND) ! 5个变量 else ssize_ensemble = 0 ssize_data = 0 end if ! 分配5个集合变量的共享内存 call MPI_Win_allocate_shared(ssize_ensemble * disp_unit, disp_unit, MPI_INFO_NULL, & node_comm, baseptr_pi, win_ensemble_pi, ierr) if (node_rank /= 0) then call MPI_Win_shared_query(win_ensemble_pi, 0, ssize_ensemble, disp_unit, baseptr_pi, ierr) end if call c_f_pointer(baseptr_pi, ensemble_pi_ptr, [nx, nz, ny, nsample]) call MPI_Win_allocate_shared(ssize_ensemble * disp_unit, disp_unit, MPI_INFO_NULL, & node_comm, baseptr_u, win_ensemble_u, ierr) if (node_rank /= 0) then call MPI_Win_shared_query(win_ensemble_u, 0, ssize_ensemble, disp_unit, baseptr_u, ierr) end if call c_f_pointer(baseptr_u, ensemble_u_ptr, [nx, nz, ny, nsample]) call MPI_Win_allocate_shared(ssize_ensemble * disp_unit, disp_unit, MPI_INFO_NULL, & node_comm, baseptr_v, win_ensemble_v, ierr) if (node_rank /= 0) then call MPI_Win_shared_query(win_ensemble_v, 0, ssize_ensemble, disp_unit, baseptr_v, ierr) end if call c_f_pointer(baseptr_v, ensemble_v_ptr, [nx, nz, ny, nsample]) call MPI_Win_allocate_shared(ssize_ensemble * disp_unit, disp_unit, MPI_INFO_NULL, & node_comm, baseptr_th, win_ensemble_th, ierr) if (node_rank /= 0) then call MPI_Win_shared_query(win_ensemble_th, 0, ssize_ensemble, disp_unit, baseptr_th, ierr) end if call c_f_pointer(baseptr_th, ensemble_th_ptr, [nx, nz, ny, nsample]) call MPI_Win_allocate_shared(ssize_ensemble * disp_unit, disp_unit, MPI_INFO_NULL, & node_comm, baseptr_q, win_ensemble_q, ierr) if (node_rank /= 0) then call MPI_Win_shared_query(win_ensemble_q, 0, ssize_ensemble, disp_unit, baseptr_q, ierr) end if call c_f_pointer(baseptr_q, ensemble_q_ptr, [nx, nz, ny, nsample]) ! 分配背景场共享内存 call MPI_Win_allocate_shared(ssize_data * disp_unit, disp_unit, MPI_INFO_NULL, & node_comm, baseptr_back, win_back, ierr) if (node_rank /= 0) then call MPI_Win_shared_query(win_back, 0, ssize_data, disp_unit, baseptr_back, ierr) end if ! call c_f_pointer(baseptr_back, back_data_ptr) call c_f_pointer(baseptr_back, back_data_ptr%pi, [nx, nz, ny]) addr = transfer(baseptr_back, addr) + 1 * nx * nz * ny * disp_unit c_ptr_back = transfer(addr, c_ptr_back) call c_f_pointer(c_ptr_back, back_data_ptr%u, [nx, nz, ny]) addr = transfer(baseptr_back, addr) + 2 * nx * nz * ny * disp_unit c_ptr_back = transfer(addr, c_ptr_back) call c_f_pointer(c_ptr_back, back_data_ptr%v, [nx, nz, ny]) addr = transfer(baseptr_back, addr) + 3 * nx * nz * ny * disp_unit c_ptr_back = transfer(addr, c_ptr_back) call c_f_pointer(c_ptr_back, back_data_ptr%th, [nx, nz, ny]) addr = transfer(baseptr_back, addr) + 4 * nx * nz * ny * disp_unit c_ptr_back = transfer(addr, c_ptr_back) call c_f_pointer(c_ptr_back, back_data_ptr%q, [nx, nz, ny]) ! 分配真值场共享内存 call MPI_Win_allocate_shared(ssize_data * disp_unit, disp_unit, MPI_INFO_NULL, & node_comm, baseptr_true, win_true, ierr) if (node_rank /= 0) then call MPI_Win_shared_query(win_true, 0, ssize_data, disp_unit, baseptr_true, ierr) end if ! call c_f_pointer(baseptr_true, true_data_ptr) call c_f_pointer(baseptr_true, true_data_ptr%pi, [nx, nz, ny]) addr = transfer(baseptr_true, addr) + 1 * nx * nz * ny * disp_unit c_ptr_true = transfer(addr, c_ptr_true) call c_f_pointer(c_ptr_true, true_data_ptr%u, [nx, nz, ny]) addr = transfer(baseptr_true, addr) + 2 * nx * nz * ny * disp_unit c_ptr_true = transfer(addr, c_ptr_true) call c_f_pointer(c_ptr_true, true_data_ptr%v, [nx, nz, ny]) addr = transfer(baseptr_true, addr) + 3 * nx * nz * ny * disp_unit c_ptr_true = transfer(addr, c_ptr_true) call c_f_pointer(c_ptr_true, true_data_ptr%th, [nx, nz, ny]) addr = transfer(baseptr_true, addr) + 4 * nx * nz * ny * disp_unit c_ptr_true = transfer(addr, c_ptr_true) call c_f_pointer(c_ptr_true, true_data_ptr%q, [nx, nz, ny]) end subroutine setup_shared_memory_data (pylk312) [hejx@login04 da_svd]$ cat mylog.e21493684 srun: ROUTE: split_hostlist: hl=a3310n[13-14],b3305r8n8,b3306r1n[1-8],b3306r2n[1-5],b3309r2n[4-8],b3309r3n[1-8],b3309r4n[1-3] tree_width 0 forrtl: severe (174): SIGSEGV, segmentation fault occurred Image PC Routine Line Source libifcoremt.so.5 00002B0FCC1622F6 for__signal_handl Unknown Unknown libpthread-2.17.s 00002B0FCBCD45D0 Unknown Unknown Unknown da_svd.exe 000000000041BD81 da_system_IP_setu 852 NUDT_RFS_DA.F90 da_svd.exe 0000000000402AD6 MAIN__ 152 NUDT_RFS_DA.F90 da_svd.exe 0000000000401D4E Unknown Unknown Unknown libc-2.17.so 00002B0FCDE3A3D5 __libc_start_main Unknown Unknown da_svd.exe 0000000000401C59 Unknown Unknown Unknown forrtl: severe (174): SIGSEGV, segmentation fault occurred Image PC Routine Line Source libifcoremt.so.5 00002B5530B802F6 for__signal_handl Unknown Unknown libpthread-2.17.s 00002B55306F25D0 Unknown Unknown Unknown da_svd.exe 000000000041BD81 da_system_IP_setu 852 NUDT_RFS_DA.F90 da_svd.exe 0000000000402AD6 MAIN__ 152 NUDT_RFS_DA.F90 da_svd.exe 0000000000401D4E Unknown Unknown Unknown libc-2.17.so 00002B55328583D5 __libc_start_main Unknown Unknown da_svd.exe 0000000000401C59 Unknown Unknown Unknown forrtl: severe (174): SIGSEGV, segmentation fault occurred Image PC Routine Line Source libifcoremt.so.5 00002B1B63F5B2F6 for__signal_handl Unknown Unknown libpthread-2.17.s 00002B1B63ACD5D0 Unknown Unknown Unknown da_svd.exe 000000000041BD81 da_system_IP_setu 852 NUDT_RFS_DA.F90 da_svd.exe 0000000000402AD6 MAIN__ 152 NUDT_RFS_DA.F90 da_svd.exe 0000000000401D4E Unknown Unknown Unknown libc-2.17.so 00002B1B65C333D5 __libc_start_main Unknown Unknown da_svd.exe 0000000000401C59 Unknown Unknown Unknown forrtl: severe (174): SIGSEGV, segmentation fault occurred
07-22
Rebuild started: Project: Project *** Using Compiler 'V6.19', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin' Rebuild target 'Project' compiling app_ble.c... ../Src/main.c(200): warning: null passed to a callee that requires a non-null argument [-Wnonnull] fputc('s', NULL); ~~~~^ ../Src/main.c(339): warning: null passed to a callee that requires a non-null argument [-Wnonnull] fputc('w', NULL); ~~~~^ 2 warnings generated. compiling main.c... ../Src/app_at.c(793): warning: passing 'char *' to parameter of type 'uint8_t *' (aka 'unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign] tcp_rec_show_update((char *)p->payload,p->len); ^~~~~~~~~~~~~~~~~~ ../Src/app_at.c(792): note: passing argument to parameter 'data' here extern void tcp_rec_show_update(uint8_t *data,uint32_t len); ^ 1 warning generated. compiling app_at.c... ../Src/app_bt.c(662): warning: format specifies type 'char *' but the argument has type 'void *' [-Wformat] printf("hfg codec connection rsp: %s,type = %d\r\n",Info->p.ptr,codec_type); ~~ ^~~~~~~~~~~ 1 warning generated. compiling app_bt.c... compiling app_btdm.c... compiling app_task.c... compiling app_hw.c... compiling diskio.c... compiling app_lvgl.c... compiling user_bt.c... compiling autonavi_profile.c... compiling autonavi_handler.c... compiling app_rpmsg.c... compiling msbc_sample.c... compiling app_hid_sdp.c... compiling app_audio.c... compiling sbc_sample.c... compiling mp3_sample.c... compiling btdm_mem.c... compiling controller.c... assembling controller_code.s... compiling host.c... compiling SWD.c... assembling img_rom.s... compiling fal_flash_port.c... compiling fdb_app.c... assembling startup_fr30xx.s... compiling driver_cali.c... compiling trim_fr30xx.c... compiling system_fr30xx.c... compiling driver_efuse.c... compiling driver_frspim.c... compiling driver_flash.c... compiling driver_gpio.c... compiling driver_pmu.c... compiling driver_pmu_iwdt.c... compiling driver_qspi.c... compiling driver_trng.c... compiling driver_uart.c... compiling driver_timer.c... compiling driver_dma.c... compiling driver_display.c... compiling driver_spi_master.c... compiling driver_sd_card.c... compiling driver_sd.c... compiling driver_ipc.c... compiling driver_can.c... compiling driver_pdm.c... compiling driver_i2s.c... compiling driver_psd_dac.c... compiling driver_display_dev.c... compiling driver_saradc.c... compiling ext_flash.c... compiling driver_st7282_rgb_hw.c... compiling co_log.c... ../../../../components/drivers/bsp/spi_flash/IC_W25Qxx.c(240): warning: incompatible pointer types passing 'uint16_t *' (aka 'unsigned short *') to parameter of type 'uint8_t *' (aka 'unsigned char *') [-Wincompatible-pointer-types] __SPI_Read_flash_X1(lu8_DataBuffer, 4, pu8_Buffer, fu32_Length); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../../components/drivers/bsp/spi_flash/IC_W25Qxx.h(37): note: expanded from macro '__SPI_Read_flash_X1' #define __SPI_Read_flash_X1(__CMD__, __CSIZE__, __BUFFER__, __SIZE__) spi_master_readflash_X1(&spi_flash_handle, (uint16_t *)__CMD__, __CSIZE__, (void *)__BUFFER__, __SIZE__) ^~~~~~~~~~~~~~~~~~~ ../../../../components/drivers/peripheral/Inc/driver_spi.h(522): note: passing argument to parameter 'fp_CMD_ADDR' here void spi_master_readflash_X1(SPI_HandleTypeDef *hspi, uint8_t *fp_CMD_ADDR, uint32_t fu32_CMDLegnth, uint8_t *fp_Data, uint16_t fu16_Size); ^ 1 warning generated. compiling IC_W25Qxx.c... compiling co_list.c... compiling fal.c... compiling co_util.c... compiling fal_flash.c... compiling fdb.c... compiling fal_partition.c... compiling croutine.c... compiling fdb_utils.c... compiling event_groups.c... compiling list.c... compiling fdb_kvdb.c... compiling stream_buffer.c... compiling queue.c... compiling port.c... compiling timers.c... compiling portasm.c... compiling heap_6.c... assembling cpu_context.s... compiling freertos_sleep.c... compiling tasks.c... compiling heap.c... compiling lv_indev.c... compiling lv_refr.c... compiling lv_obj_pos.c... compiling lv_flex.c... compiling lv_bmp.c... compiling lv_ffmpeg.c... compiling lv_grid.c... compiling lv_freetype.c... compiling lv_fs_posix.c... compiling lv_fs_fatfs.c... compiling lv_fs_stdio.c... compiling lv_fs_win32.c... compiling lv_gif.c... compiling gifdec.c... compiling lodepng.c... compiling lv_png.c... compiling lv_qrcode.c... compiling lv_rlottie.c... compiling lv_sjpg.c... compiling tjpgd.c... compiling lv_fragment.c... compiling lv_fragment_manager.c... compiling lv_gridnav.c... compiling qrcodegen.c... compiling lv_ime_pinyin.c... compiling lv_imgfont.c... compiling lv_msg.c... compiling lv_monkey.c... compiling lv_snapshot.c... compiling lv_theme_basic.c... compiling lv_theme_mono.c... compiling lv_animimg.c... compiling lv_theme_default.c... compiling lv_calendar.c... compiling lv_calendar_header_dropdown.c... compiling lv_calendar_header_arrow.c... compiling lv_imgbtn.c... compiling lv_colorwheel.c... compiling lv_keyboard.c... compiling lv_chart.c... compiling lv_led.c... compiling lv_list.c... compiling lv_menu.c... compiling lv_msgbox.c... compiling lv_meter.c... compiling lv_spinner.c... compiling lv_spinbox.c... compiling lv_span.c... compiling lv_tileview.c... compiling lv_tabview.c... compiling lv_win.c... compiling lv_font.c... compiling lv_extra.c... compiling lv_font_dejavu_16_persian_hebrew.c... compiling lv_font_fmt_txt.c... compiling lv_font_montserrat_8.c... compiling lv_font_loader.c... compiling lv_font_montserrat_10.c... compiling lv_font_montserrat_12.c... compiling lv_font_montserrat_12_subpx.c... compiling lv_font_montserrat_14.c... compiling lv_font_montserrat_18.c... compiling lv_font_montserrat_16.c... compiling lv_font_montserrat_20.c... compiling lv_font_montserrat_22.c... compiling lv_font_montserrat_24.c... compiling lv_font_montserrat_26.c... compiling lv_font_montserrat_28_compressed.c... compiling lv_font_montserrat_28.c... compiling lv_font_montserrat_30.c... compiling lv_font_montserrat_32.c... compiling lv_font_montserrat_34.c... compiling lv_font_montserrat_36.c... compiling lv_font_montserrat_38.c... compiling lv_font_montserrat_40.c... compiling lv_font_montserrat_42.c... compiling lv_font_montserrat_44.c... compiling lv_font_montserrat_46.c... compiling lv_font_montserrat_48.c... compiling lv_font_simsun_16_cjk.c... compiling lv_font_unscii_8.c... compiling lv_font_unscii_16.c... compiling lv_hal_tick.c... compiling lv_hal_indev.c... compiling lv_hal_disp.c... compiling lv_anim.c... compiling lv_anim_timeline.c... compiling lv_area.c... compiling lv_async.c... compiling lv_color.c... compiling lv_fs.c... compiling lv_bidi.c... compiling lv_gc.c... compiling lv_log.c... compiling lv_ll.c... compiling lv_math.c... compiling lv_lru.c... compiling lv_printf.c... compiling lv_mem.c... compiling lv_templ.c... compiling lv_style.c... compiling lv_style_gen.c... compiling lv_tlsf.c... compiling lv_timer.c... compiling lv_utils.c... compiling lv_txt.c... compiling lv_txt_ap.c... compiling lv_btn.c... compiling lv_arc.c... compiling lv_bar.c... compiling lv_checkbox.c... compiling lv_canvas.c... compiling lv_btnmatrix.c... compiling lv_img.c... compiling lv_dropdown.c... compiling lv_objx_templ.c... compiling lv_label.c... compiling lv_line.c... compiling lv_roller.c... compiling lv_slider.c... compiling lv_switch.c... compiling lv_textarea.c... compiling lv_table.c... compiling lv_demo_benchmark.c... compiling img_benchmark_cogwheel_alpha16.c... compiling img_benchmark_cogwheel_argb.c... compiling img_benchmark_cogwheel_chroma_keyed.c... compiling img_benchmark_cogwheel_indexed16.c... compiling img_benchmark_cogwheel_rgb.c... compiling img_benchmark_cogwheel_rgb565a8.c... compiling lv_font_bechmark_montserrat_12_compr_az.c.c... compiling lv_font_bechmark_montserrat_16_compr_az.c.c... compiling lv_font_bechmark_montserrat_28_compr_az.c.c... compiling lv_demo_stress.c... compiling img_clothes.c... compiling lv_demo_widgets.c... compiling img_demo_widgets_avatar.c... compiling img_lvgl_logo.c... compiling lv_demo_music.c... compiling lv_demo_music_list.c... compiling img_lv_demo_music_btn_corner_large.c... compiling lv_demo_music_main.c... compiling img_lv_demo_music_btn_list_pause.c... compiling img_lv_demo_music_btn_list_pause_large.c... compiling img_lv_demo_music_btn_list_play.c... compiling img_lv_demo_music_btn_list_play_large.c... compiling img_lv_demo_music_btn_loop.c... compiling img_lv_demo_music_btn_loop_large.c... compiling img_lv_demo_music_btn_next.c... compiling img_lv_demo_music_btn_next_large.c... compiling img_lv_demo_music_btn_pause.c... compiling img_lv_demo_music_btn_pause_large.c... compiling img_lv_demo_music_btn_play.c... compiling img_lv_demo_music_btn_play_large.c... compiling img_lv_demo_music_btn_prev.c... compiling img_lv_demo_music_btn_prev_large.c... compiling img_lv_demo_music_btn_rnd.c... compiling img_lv_demo_music_btn_rnd_large.c... compiling img_lv_demo_music_corner_left.c... compiling img_lv_demo_music_corner_left_large.c... compiling img_lv_demo_music_corner_right.c... compiling img_lv_demo_music_corner_right_large.c... compiling img_lv_demo_music_cover_1_large.c... compiling img_lv_demo_music_cover_1.c... compiling img_lv_demo_music_cover_2.c... compiling img_lv_demo_music_cover_2_large.c... compiling img_lv_demo_music_cover_3.c... compiling img_lv_demo_music_cover_3_large.c... compiling img_lv_demo_music_icon_1.c... compiling img_lv_demo_music_icon_1_large.c... compiling img_lv_demo_music_icon_2.c... compiling img_lv_demo_music_icon_2_large.c... compiling img_lv_demo_music_icon_3.c... compiling img_lv_demo_music_icon_3_large.c... compiling img_lv_demo_music_icon_4.c... compiling img_lv_demo_music_icon_4_large.c... compiling img_lv_demo_music_list_border.c... compiling img_lv_demo_music_list_border_large.c... compiling img_lv_demo_music_logo.c... compiling img_lv_demo_music_slider_knob.c... compiling img_lv_demo_music_slider_knob_large.c... compiling img_lv_demo_music_wave_bottom.c... compiling img_lv_demo_music_wave_bottom_large.c... compiling img_lv_demo_music_wave_top.c... compiling crc32.c... compiling ffsystem.c... compiling img_lv_demo_music_wave_top_large.c... compiling ffunicode.c... compiling lfs_util.c... compiling ext_flash_program.c... compiling ff.c... compiling ext_flash_uart.c... compiling lfs_port.c... compiling lv_common_function.c... compiling batt_full_yellow.c... compiling lfs.c... compiling batt_full_gren.c... compiling arialuni_bbp1_32px__.c... compiling Number_HarmonyOS_bpp4_16px.c... compiling Number_HarmonyOS_bpp4_12px.c... compiling Number_HarmonyOS_bpp4_44px.c... compiling Number_HarmonyOS_bpp4_36px.c... compiling Number_HarmonyOS_bpp4_92px.c... compiling fr_lv_test_page.c... compiling Number_HarmonyOS_bpp4_20px.c... compiling fr_lv_86box_page.c... compiling fr_lv_customer_page.c... compiling fr_lv_app_music_control.c... compiling fr_lv_instrument_panel.c... compiling fr_lv_instrument_panel_km.c... compiling fr_lv_list_page.c... compiling fr_lv_can_page.c... compiling fr_lv_bt_pan_page.c... compiling fr_guimain.c... compiling fr_watch.c... compiling lv_user_sqlist.c... compiling fr_device_rtc.c... compiling fr_device_button.c... compiling fr_device_encode.c... compiling fr_device_pmu_io.c... compiling autoip.c... compiling fr_device_canfd.c... compiling icmp.c... compiling etharp.c... compiling igmp.c... compiling dhcp.c... compiling ip4.c... compiling ip4_addr.c... compiling dhcp6.c... compiling ethip6.c... compiling ip4_frag.c... compiling icmp6.c... compiling inet6.c... compiling ip6.c... compiling ip6_addr.c... compiling ip6_frag.c... compiling mld6.c... compiling nd6.c... compiling altcp.c... compiling altcp_alloc.c... compiling altcp_tcp.c... compiling def.c... compiling inet_chksum.c... compiling init.c... compiling dns.c... compiling ip.c... compiling mem.c... compiling memp.c... compiling raw.c... compiling netif.c... compiling stats.c... compiling sys.c... compiling pbuf.c... compiling tcp_in.c... compiling tcp.c... compiling tcp_out.c... compiling timeouts.c... compiling udp.c... compiling api_lib.c... compiling err.c... compiling if_api.c... compiling api_msg.c... compiling netbuf.c... compiling netdb.c... compiling netifapi.c... compiling ethernet.c... compiling tcpip.c... compiling ethernetif.c... compiling sys_arch.c... compiling sockets.c... compiling rpmsg.c... compiling rpmsg_ns.c... compiling rpmsg_lite.c... compiling rpmsg_queue.c... compiling llist.c... compiling virtqueue.c... compiling rpmsg_env_freertos.c... compiling rpmsg_platform.c... assembling dsp_code_rom.s... compiling dsp.c... compiling dsp_mem.c... compiling audio_a2dp_sink.c... compiling audio_a2dp_source.c... compiling audio_encoder.c... compiling audio_rpmsg.c... ../../../../components/modules/audio/audio_decoder.c(72): warning: null passed to a callee that requires a non-null argument [-Wnonnull] fputc(hex2char[(value >> 12)&0xf], NULL); ~~~~^ ../../../../components/modules/audio/audio_decoder.c(73): warning: null passed to a callee that requires a non-null argument [-Wnonnull] fputc(hex2char[(value >> 8)&0xf], NULL); ~~~~^ ../../../../components/modules/audio/audio_decoder.c(74): warning: null passed to a callee that requires a non-null argument [-Wnonnull] fputc(hex2char[(value >> 4)&0xf], NULL); ~~~~^ ../../../../components/modules/audio/audio_decoder.c(75): warning: null passed to a callee that requires a non-null argument [-Wnonnull] fputc(hex2char[(value >> 0)&0xf], NULL); ~~~~^ 4 warnings generated. compiling audio_decoder.c... compiling audio_hw.c... compiling audio_scene.c... compiling local_playback.c... compiling audio_sco.c... compiling loopback.c... compiling recorder.c... compiling voice_recognize.c... compiling algorithm.c... compiling resample.c... compiling codec.c... compiling AMS_client.c... compiling simple_gatt_service.c... compiling ANCS_AMS_client.c... compiling hid_service.c... compiling retarget_io.c... linking... .\Objects\Project.axf: Error: L6985E: Unable to automatically place AT section rpmsg.o(.ARM.__at_0x20000000) with required base address 0x20000000. Please manually place in the scatter file using the --no_autoat option. Not enough information to list image symbols. Finished: 1 information, 0 warning and 1 error messages. ".\Objects\Project.axf" - 1 Error(s), 9 Warning(s). Target not created. Build Time Elapsed: 00:01:10
09-13
<think> 我们面临的问题主要分为编译警告和链接错误两部分。我将分别针对这些问题提供解决方案,并最后给出优化建议。 ### 一、编译警告解决方案 #### 1. 空指针传递警告(-Wnonnull) **问题代码示例**: ```c fputc('s', NULL); // main.c:200 fputc('w', NULL); // main.c:339 ``` **分析**:`fputc`函数要求第二个参数为非空文件指针,传递`NULL`会导致未定义行为[^1]。 **修复方案**: ```c // 方案1:重定向到标准输出(若需控制台输出) fputc('s', stdout); // 方案2:使用空操作宏(若不需实际输出) #define NULL_PUTCHAR(c) ((void)0) NULL_PUTCHAR('s'); ``` #### 2. 指针类型不兼容警告(-Wpointer-sign) **问题代码**: ```c // app_at.c:793 tcp_rec_show_update((char *)p->payload, p->len); ``` ```c // 函数原型:app_at.c:792 extern void tcp_rec_show_update(uint8_t *data, uint32_t len); ``` **修复方案**: ```c // 正确强制转换 tcp_rec_show_update((uint8_t *)p->payload, p->len); ``` #### 3. 格式字符串类型不匹配(-Wformat) **问题代码**: ```c // app_bt.c:662 printf("hfg codec connection rsp: %s,type = %d\r\n", Info->p.ptr, codec_type); ``` **分析**:`%s`需要`char*`但实际传入`void*`。 **修复方案**: ```c printf("hfg codec connection rsp: %p, type=%d\r\n", (void*)Info->p.ptr, codec_type); // 改为指针输出 ``` #### 4. 指针符号不兼容(-Wincompatible-pointer-types) **问题源码**: ```c // IC_W25Qxx.c:240 __SPI_Read_flash_X1(lu8_DataBuffer, 4, pu8_Buffer, fu32_Length); ``` **宏展开**: ```c spi_master_readflash_X1(&spi_flash_handle, (uint16_t *)__CMD__, // 问题点:uint16_t* -> uint8_t* __CSIZE__, (void *)__BUFFER__, __SIZE__); ``` **修复方案**: ```c // 修改宏定义(components/drivers/bsp/spi_flash/IC_W25Qxx.h) #define __SPI_Read_flash_X1(__CMD__, __CSIZE__, __BUFFER__, __SIZE__) \ spi_master_readflash_X1(&spi_flash_handle, \ (uint8_t *)(__CMD__), // 强制转换为uint8_t* \ __CSIZE__, \ (uint8_t *)(__BUFFER__), \ __SIZE__) ``` ### 二、链接错误解决方案 #### 1. 执行区域重叠(L6221E) **错误描述**: ``` Execution region RW_RAM_CODE [...] overlaps with [...] RW_IRAM1 ``` **根本原因**:`RW_RAM_CODE`区域(起始0x1FFE01B0)与`RW_IRAM1`区域(起始0x20000000)存在地址重叠。 **修复方案**(修改分散加载文件): ```sct RW_RAM_CODE_FRONT 0x1FFE0000 0x0000F000 { ; 分配60KB空间 *(ram_code_front) } RW_RAM_CODE 0x1FFEF000 0x00011000 { ; 紧接着前段分配68KB *(ram_code) rpmsg.o ... // 其余目标文件 } RW_IRAM1 0x20010000 0x00070000 { ; 后移64KB起始地址 .ANY (+RW +ZI) } ``` #### 2. ScatterAssert失败(L6388E) **错误描述**: ``` ScatterAssert expression ((ImageLength(...)) <= 0x20000) failed ``` **修复方案**:根据实际需求调整限制值 ```sct ScatterAssert((ImageLength(RW_RAM_CODE_FRONT) + ImageLength(RW_RAM_CODE)) <= 0x21000) ; 扩容至132KB ``` ### 三、优化建议 1. **内存布局可视化**: 使用Keil的`Memory Map`视图(Linker > Memory Layout)验证区域分布[^1]。 2. **大对象移出RAM**: 将音频缓冲等大对象移至PSRAM: ```sct RW_PSRAM 0x30000000 UNINIT { audio_buffer.o (+RW) } ``` 3. **ZI数据优化**: 对无需初始化的数据使用`UNINIT`属性: ```c __attribute__((section(".noinit"))) uint8_t sensor_cache[4096]; ``` > **验证要点**:编译后检查`.map`文件中的`Section Cross References`,确保: > - `RW_RAM_CODE`结束地址 < `RW_IRAM1`起始地址 > - 各区域尺寸小于芯片物理内存 §§相关问题§§ 1. 如何通过分散加载文件优化嵌入式系统的内存使用效率? 2. C语言中如何安全地进行指针类型转换? 3. Keil链接器错误L6221E的常见解决方法有哪些? </think> 以下是针对代码编译和链接过程中出现的警告和错误问题的系统化解决方案,按照问题类型分类整理: --- ### 一、编译警告解决方案 #### 1. 空指针传递警告(-Wnonnull) **问题代码**: ```c fputc('s', NULL); // main.c:200 fputc('w', NULL); // main.c:339 ``` **修复方案**: ```c // 方案1:重定向到标准输出 fputc('s', stdout); // 方案2:使用空操作函数 #define NULL_PUTCHAR(c) ((void)0) NULL_PUTCHAR('s'); ``` #### 2. 指针类型不兼容警告 **问题场景**: ```c // app_at.c:793 tcp_rec_show_update((char *)p->payload, p->len); // 函数原型:app_at.c:792 extern void tcp_rec_show_update(uint8_t *data,uint32_t len); ``` **修复方案**: ```c // 正确强制转换 tcp_rec_show_update((uint8_t *)p->payload, p->len); ``` #### 3. 格式字符串类型不匹配 **问题代码**: ```c // app_bt.c:662 printf("hfg codec connection rsp: %s,type = %d\r\n", Info->p.ptr, codec_type); ``` **修复方案**: ```c printf("hfg codec connection rsp: %p, type=%d\r\n", (void*)Info->p.ptr, codec_type); // 显式转换为void指针 ``` --- ### 二、链接错误解决方案 #### 1. 执行区域重叠(L6221E) **错误描述**: ```bash Execution region RW_RAM_CODE [...] overlaps with [...] RW_IRAM1 ``` **根本原因**:RAM代码区(`RW_RAM_CODE`)与数据区(`RW_IRAM1`)地址空间冲突 **修复方案**(修改分散加载文件): ```sct RW_RAM_CODE_FRONT 0x1FFE0000 0x0000F000 { ; 前段代码区(60KB) *(ram_code_front) } RW_RAM_CODE 0x1FFEF000 0x00011000 { ; 主代码区(68KB) *(ram_code) rpmsg.o ... // 其余目标文件 } RW_IRAM1 0x20010000 0x00070000 { ; 数据区后移64KB(448KB) .ANY (+RW +ZI) } ``` #### 2. ScatterAssert失败(L6388E) **错误描述**: ```bash ScatterAssert expression ((ImageLength(...)) <= 0x20000) failed ``` **修复方案**: ```sct ScatterAssert((ImageLength(RW_RAM_CODE_FRONT) + ImageLength(RW_RAM_CODE)) <= 0x21000) ; 扩容至132KB ``` #### 3. 内存优化技巧 ```sct // 将大缓冲区移出RAM RW_PSRAM 0x30000000 UNINIT { audio_buffer.o (+RW) // 音频缓冲区示例 } // 减少ZI数据初始化 .noinit 0x20050000 { sensor_cache.o (+ZI) // 传感器缓存 } ``` --- ### 三、其他问题解决方案 #### 1. SPI Flash驱动警告 **问题代码**(IC_W25Qxx.c): ```c __SPI_Read_flash_X1(lu8_DataBuffer, 4, pu8_Buffer, fu32_Length); ``` **修复方案**(修改宏定义): ```c // IC_W25Qxx.h #define __SPI_Read_flash_X1(__CMD__, __CSIZE__, __BUFFER__, __SIZE__) \ spi_master_readflash_X1(&spi_flash_handle, \ (uint8_t *)(__CMD__), \ // 强制类型转换 __CSIZE__, \ (uint8_t *)(__BUFFER__), \ __SIZE__) ``` --- ### 四、验证与调试建议 1. **内存映射检查**: ```bash Section Start End Size RW_RAM_CODE_FRONT 0x1FFE0000 - 0x1FFEF000 (60KB) RW_RAM_CODE 0x1FFEF000 - 0x1FFFF000 (68KB) RW_IRAM1 0x20010000 - 0x20080000 (448KB) ``` 2. **编译器优化标志**: ```makefile CFLAGS += -Wno-pointer-sign # 禁用特定警告 CFLAGS += -fdata-sections # 数据段优化 CFLAGS += -ffunction-sections # 函数段优化 ``` --- ### 五、最佳实践总结 1. **指针安全**: - 避免`void*`与非`char*`类型的隐式转换 - 使用`uintptr_t`进行指针运算[^1] 2. **内存布局原则**: ```mermaid graph LR A[FLASH] --> B
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值