773 views
in GUI Development by

I am trying to update my GUI with a string from the native C code. I implemented the Device Driver and the String Property along with its UpdateString method. I cannot seem to get past an error. I followed the Device Integration Tutorial and looked over all the forum discussions and cannot get past this. I went over the articles Integrating with the device and Device Class and Device Driver.

This is my Embedded Wizard part

This is what I have in native C. 

The error is: 

assertion "block_to_ptr(remaining) == align_ptr(block_to_ptr(remaining), ALIGN_SIZE) && "remaining block not aligned properly"" failed: file "./Architecture_and_Integration/Third_Party/TLSF/tlsf.c", line 469, function: block_split

I tried modyfying the code and sometimes all I get is a HARDFAULT

 

Thank you for all support.

1 Answer

0 votes
by

Hello,

the error message is reported by the memory manager. Evidently the heap is corrupted. Try to clarify following questions:

1. Which EmWi version are you using?

2. Are you using your own HW or an evaluation/dicovery board? Eventually, the RAM configuration is incorrect causing the RAM contents to be lost.

3. If you comment out the above C code section to call the UpdateString() method, does the error still occur? If yes, it is not related to this code.

4. Are you using an operating system? If yes, have you ensured to not execute EmWi code in context of a foreign thread? EmWi code is not thread safe Call EmWi code always in context of the thread, which initialized and drive the GUI.

5. How do you obtain access to the device object (how you initialize the variable DeviceObject)? 

6. The variable DeviceObject, does it store the reference to the object permanently?  If yes, the EmWi Garbage Collector does not know anything about it. As soon as the object is not used in the GUI application, it is released leaving your variable initialized with an outdated reference. Accessing it may currupt the heap. The best is to not store references to EmWi objects in C code.

7. Do you have another (your own) C code linked together with the application? Try to narrow down the possible heap corruption by commenting out your code blocks.

Hope it helps you to narrow down the problem.

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint

...