Vybrid Strange Memory Overwrite

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Vybrid Strange Memory Overwrite

2,143件の閲覧回数
johannestraxler
Contributor III

We have a strange problem on Vybrid M4 using MQX.

Platform: PCM052

MQX-Version: 4.0.1 with PCM052- and ADC-Patch applied

DS-5 V5.17

Code Region: OnChip SysRAM0 0x3f00 0000-0x3f03 fff0

Data Region: GfxRAM0 0x3f40 0000-0x3f47 ffff

Shared Data (MCC): OnChip SysRAM1 0x3f04 0000-0x3f04 fff0

Stack starts at TCML_END: 0x1f80 7ff0

Librarys: PSP, BSP, MCC, RTCS (UDP only)

Tasks: MQX Idle, User Main-Task (1500Bytes Stacksize), User Task2 (1000Bytes Stacksize)

We have a periodic function, which is calculating some values. From time to time it happens, that values are corrupted (random numbers without meaning in this context), i.e. we do not see the expected values in the debugger. With ULinkPro Trace we found out, that this error occurs in combination with an interrupt (GPIO and also ADC0/1). Further analysis show that the StackPointer is rather high with ~28kByte. In the TCML-Memory there are just 32kBytes available, so we assume that in corner cases the stack pointer overflows and overwrite the CPU registers with wrong values, which are then written into our value buffers.

Is a stack pointer size of 28kByte in MQX normal or is this a exception here?

Are there any techniques to keep the stack pointer lower?

Is there a possibility in DS-5 to monitor the stack pointer and break in case of overflow?

Thanks in advance,

Johannes

ラベル(3)
0 件の賞賛
返信
6 返答(返信)

1,691件の閲覧回数
kef2
Senior Contributor V

I think you should try updating compiler. D-5 5.17.1 was released almost immediately after 5.17. I remember heaving big problems with 5.17.

1,691件の閲覧回数
johannestraxler
Contributor III

I just checked the version string in detail. It is already 5.17.1.

ARM DS-5 (DS-5 Vybrid Edition)

Version: 5.17.1

Build number: 5171010

EDIT: I just updated to the newest DS-5 (DS-5 Vybrid Edition, Version: 5.19.0, Build number: 5190027) and the problem still exists.

0 件の賞賛
返信

1,691件の閲覧回数
kef2
Senior Contributor V

Johannes,

MQX is preemptive OS, which has as many stacks as many tasks. 28k is total stacks size? I don't think MQX uses so much stack space. Most likely it is some data arrays allocated on stack. Perhaps you have some function scope non-static const array, or array of pointers to non-const strings? Missing const and static keywords may make your stack big.

0 件の賞賛
返信

1,691件の閲覧回数
johannestraxler
Contributor III

Ok, we will then first check, if there is indeed any stack overflow and then search for arrays, which are put on the stack, to reduce general stack size.

Updating to MQX4.0.2 has not been done so far, but I think that it is not a MQX bug.

0 件の賞賛
返信

1,691件の閲覧回数
timesyssupport
Senior Contributor II

Hello Johannes,

Have you tried building your application against MQX 4.0.2? If this is an issue with stack size, here is a useful document that details how to minimize stack usage and debugging the stack:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472e/CJAIIDCG.html

Thanks,

Timesys Support

1,691件の閲覧回数
karina_valencia
NXP Apps Support
NXP Apps Support

timesyssupport can you  help with this case?

0 件の賞賛
返信