Hi,
Based on the discussion in Direct framebuffer access, I started using memdevs.
But now I run into an exception during when calling GUI_Clear() when the memdev is active (though it might not be memdev related, so i created new topic).
Background:
I am using stemwin in a freertos multitasking environment.
The memory I give to emwin (and in which the memory buffer is located) is located in external SRAM.
IAR linker file:
place in ExtSRam_region { block HEAP, section EXT_MEMORY_IF_AVAILABLE };
GUI_conf.c:
The calls I do are
From a Freertos task A:
Display All
Then some other code runs, and finally from a different freertos task I do again
GUI_Clear();
and i get a hardfault.
Debugger further the point where it goes wrong gives me a call stack:
GUI_Clear -> WL__InitIVRSearch -> GUI_ALLOC_UnlockH
GUI_ALLOC_UnlockH contains on the 7th line in assembler the instruction:
LDRB.W R3, [R0, R5, LSL #3]
This is passed 3 times correctly with R3 having value 0x6804003C
Then a 4th time correctly with R3 being 0x68040074
And then the 5th time R3 is 0x00000009 which of course causes the hard fault.
( 0x6804xxxx is all inside the extmem buffer passed on to emwin)
Any suggestions what might be going wrong ?
I dumped the complete contents of the extMem buffer passed to emwin to see if maybe something got corrupted there, and the only difference i have is that at the end of region some 0x0000 is replaced by 0x1841, which happens during the execution of GUI_MEMDEV_GetDataPtr.
:10FF0000345D01200000000000000000000000003F
becomes
:10FF0000345D0120000000001841002000000000C6
(intel hex format, offset 0 is start of the extMem buffer)
I even tried clearing that to 0000 again but this did not solve the problem, so i am guessing it is totally unrelated and the problem is not some memory corruption.
It seem/might be related to the fact that i call the function from a different thread (?). Is that no allowed for some reason ?
Sideremark: the problem seems similar to emWin with external SRAM error, though maybe that one had a different cause(no thread relation ?)
Thanks,
Bram
Based on the discussion in Direct framebuffer access, I started using memdevs.
But now I run into an exception during when calling GUI_Clear() when the memdev is active (though it might not be memdev related, so i created new topic).
Background:
I am using stemwin in a freertos multitasking environment.
The memory I give to emwin (and in which the memory buffer is located) is located in external SRAM.
IAR linker file:
place in ExtSRam_region { block HEAP, section EXT_MEMORY_IF_AVAILABLE };
GUI_conf.c:
From a Freertos task A:
Source Code
- m_hMemDev = GUI_MEMDEV_CreateEx(0,0,DISPLAY_WIDTH_PIXELS,DISPLAY_HEIGHT_PIXELS, GUI_MEMDEV_NOTRANS);
- if ( 0 == m_hMemDev )
- {
- LOGGER_LOG_ERROR( LOG_CLASS, "%s: Could not create memdev", __FUNCTION__ );
- l_nResult = e_RETURNVALUE_Failure;
- goto lbl_err;
- }
- GUI_MEMDEV_Select(m_hMemDev);
- // debug test, this works fine, just adding stuff from the other thread
- GUI_Clear();
- {
- volatile void * mypointer;
- mypointer = GUI_MEMDEV_GetDataPtr( m_hMemDev );
- GUI_Clear();
- }
Then some other code runs, and finally from a different freertos task I do again
GUI_Clear();
and i get a hardfault.
Debugger further the point where it goes wrong gives me a call stack:
GUI_Clear -> WL__InitIVRSearch -> GUI_ALLOC_UnlockH
GUI_ALLOC_UnlockH contains on the 7th line in assembler the instruction:
LDRB.W R3, [R0, R5, LSL #3]
This is passed 3 times correctly with R3 having value 0x6804003C
Then a 4th time correctly with R3 being 0x68040074
And then the 5th time R3 is 0x00000009 which of course causes the hard fault.
( 0x6804xxxx is all inside the extmem buffer passed on to emwin)
Any suggestions what might be going wrong ?
I dumped the complete contents of the extMem buffer passed to emwin to see if maybe something got corrupted there, and the only difference i have is that at the end of region some 0x0000 is replaced by 0x1841, which happens during the execution of GUI_MEMDEV_GetDataPtr.
:10FF0000345D01200000000000000000000000003F
becomes
:10FF0000345D0120000000001841002000000000C6
(intel hex format, offset 0 is start of the extMem buffer)
I even tried clearing that to 0000 again but this did not solve the problem, so i am guessing it is totally unrelated and the problem is not some memory corruption.
It seem/might be related to the fact that i call the function from a different thread (?). Is that no allowed for some reason ?
Sideremark: the problem seems similar to emWin with external SRAM error, though maybe that one had a different cause(no thread relation ?)
Thanks,
Bram