Hi everyone,
thanks for your advice, I've managed to get the emWin demo up and running now. I had to add the xip folder to the project so it initialised the SDRAM (the SDRAM mcuxpresso init script could have alternatively been used). It's a bit slow using SDRAM for the system variables etc.
I've also got another project with it running successfully under freeRTOS and have implemented double buffering and got some other emwin demos working (including realtime MJPEG video at 30 fps). I'm just using the SDRAM for the framebuffers and emwin memory in that case.
To enable multi/double buffering you just need to add the following code somewhere in emwin init (I put it in LCD_X_Config()).
GUI_MEMDEV_MULTIBUF_Enable(1);
WM_MULTIBUF_Enable(1);
Also, there is no need to have the end of frame interrupts on all the time as the example has. You only need to turn them on when you want to switch buffers. To do this:
1. In void APP_ELCDIF_Init(void)
remove the line: ELCDIF_EnableInterrupts(APP_ELCDIF, kELCDIF_CurFrameDoneInterruptEnable);
2. In int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void *p)
replace the line: while (s_LCDpendingBuffer >= 0) ;
with: uint32_t intStatus = ELCDIF_GetInterruptStatus(APP_ELCDIF);
ELCDIF_ClearInterruptStatus(APP_ELCDIF, intStatus);
ELCDIF_EnableInterrupts(APP_ELCDIF, kELCDIF_CurFrameDoneInterruptEnable);
3. In void APP_LCDIF_IRQHandler(void)
after: s_LCDpendingBuffer = -1;
add the line: ELCDIF_DisableInterrupts(APP_ELCDIF, kELCDIF_CurFrameDoneInterruptEnable);