none
Customized splash screens RRS feed

  • Question

  • Hi,

    I am developing a WEC7 (arm) device, and now my customer wants me to be to change splas screen image without recompiling bootloader.

    Is there a way for me to put image in NAND from windows UI and read it at boot to show it?

    Regards,

    Luka

    Thursday, April 25, 2013 8:18 AM

Answers

  • There is a simplest way to do ... of course MfgTool concept is long procedure and even i doubt that your BSP actually has a code for that ... Can you tell us which BSP are you using ...

    In the Eboot you might be having .c file for flash management "flashmenu.c" or similar ... You can try adding the following code or may be implementing something the same :

    VOID FlashBMP(OAL_BLMENU_ITEM *pMenu)
    {

        WCHAR filename[13];
        ULONG BmpLen,BmpTempLen, offset;//,buf_offset;//, time;
        UCHAR TempBuf[ONE28_KB];//,Temp[100];
        HANDLE hFlash = NULL;
        char cnt=0;//index=0;
        //UINT32 count=0;

        OALLog(L"Flashing BMP...\r\n");
         memset(filename, 0, 15);
        wcscpy(filename, L"Logo.bmp");
        BmpLen=BLSDImageDownload(filename);
        BmpTempLen = BmpLen;
        if((!BmpLen) || (BmpLen == BL_ERROR))
        {
            OALLog(L"File not found\r\n");
            return ;
        }
        OALLog(L"BMP len...:0x%x\r\n",BmpLen);
        hFlash = OALFlashStoreOpen(g_ulFlashBase);
        if (hFlash == NULL)
        {
        OALMSG(OAL_ERROR, (L"ERROR: OEMWriteFlash: "
            L"OALFlashStoreOpen call failed!\r\n"
            ));
        }
        offset = IMAGE_BOOTLOADER_BITMAP_START;


    #if 1
        //128K - 131072
        //300K - 307200
        OALLog(L"Read BMP file\r\n");
        for(cnt=0;BmpLen>0;cnt++)
        {
            OALLog(L"#");
            memset(TempBuf, 0x0, ONE28_KB);
            BLSDCardReadData(ONE28_KB,(UCHAR *)TempBuf);
            BmpLen-=ONE28_KB;
            
            
            if (!OALFlashStoreWrite(
                hFlash, offset, TempBuf, (ONE28_KB), FALSE, FALSE
                ))
            {
            OALMSG(OAL_ERROR, (L"ERROR: OEMWriteFlash: "
                L"OALFlashStoreWrite at relative address 0x%08x failed\r\n", offset
                ));
            }
            
            offset += ONE28_KB;
        }
        OALLog(L"\r\n");
    #endif

    return;
    }

    This function will copy boot logo called "Logo.bmp" from SDcard to nand flash into a reserved region ...

    Then you need to have a function which shall read the boot logo from flash and display into the screen during booting ...

    in the eboot main.c you need to call this function ...

    The function to read logo from flash and display onto the screen shall look like this ...

    VOID ShowLogo(UINT32 flashAddr, UINT32 offset)
    {
        HANDLE  hFlash = NULL;
        DWORD  framebuffer;
        DWORD  framebufferPA;
        PUCHAR  pChar;
        ULONG   x, y;
        WORD    wSignature = 0;
        DWORD   dwOffset = 0;
        DWORD   dwLcdWidth,
                dwLcdHeight;
        DWORD   dwLength;


        //  Get the LCD width and height
        LcdPdd_LCD_GetMode( NULL, &dwLcdWidth, &dwLcdHeight, NULL );

        dwLength = BYTES_PER_PIXEL * LOGO_WIDTH * LOGO_HEIGHT;

        //  Get the video memory
        LcdPdd_GetMemory( NULL, &framebufferPA );
        framebuffer = (DWORD) OALPAtoUA(framebufferPA);
        pChar = (PUCHAR)framebuffer;

        if (flashAddr != -1)
        {
            // Open flash storage
            hFlash = OALFlashStoreOpen(flashAddr);
            if( hFlash != NULL )
            {
                //  The LOGO reserved NAND flash region contains the BMP file
                OALFlashStoreBufferedRead( hFlash, offset, (UCHAR*) &wSignature, sizeof(wSignature), FALSE );

                //  Check for 'BM' signature
                if( wSignature == 0x4D42 )
                {
                    //  Read the offset to the pixel data
                    OALFlashStoreBufferedRead( hFlash, offset + 10, (UCHAR*) &dwOffset, sizeof(dwOffset), FALSE );

                    //  Read the pixel data with the given offset
                    OALFlashStoreBufferedRead( hFlash, offset + dwOffset, pChar, dwLength, FALSE );
                }

                //  Close store
                OALFlashStoreClose(hFlash);

                //  Compute position and size of logo image
                g_dwLogoPosX   = (dwLcdWidth - LOGO_WIDTH)/2;
                g_dwLogoPosY   = (dwLcdHeight - LOGO_HEIGHT)/2;
                g_dwLogoWidth  = LOGO_WIDTH;
                g_dwLogoHeight = LOGO_HEIGHT;

                //As BMP are stored upside down, we need to flip the frame buffer's content
                FlipFrameBuffer((PUCHAR)framebuffer,LOGO_HEIGHT,LOGO_WIDTH*BYTES_PER_PIXEL,(PUCHAR)framebuffer + dwLength);
            }
        }

        //  If bitmap signature is valid, display the logo, otherwise fill screen with pattern
        if( wSignature != 0x4D42 )
        {
            //  Adjust color bars to LCD size
            g_dwLogoPosX   = 0;
            g_dwLogoPosY   = 0;
            g_dwLogoWidth  = dwLcdWidth;
            g_dwLogoHeight = dwLcdHeight;

            for (y= 0; y < dwLcdHeight; y++)
            {
                for( x = 0; x < dwLcdWidth; x++ )
                {
                    if( y < dwLcdHeight/2 )
                    {
                        if( x < dwLcdWidth/2 )
                        {
                            *pChar++ = 0x00;    //  Blue
                            *pChar++ = 0x00;    //  Green
                            *pChar++ = 0xFF;    //  Red
                        }
                        else
                        {
                            *pChar++ = 0x00;    //  Blue
                            *pChar++ = 0xFF;    //  Green
                            *pChar++ = 0x00;    //  Red
                        }
                    }
                    else
                    {
                        if( x < dwLcdWidth/2 )
                        {
                            *pChar++ = 0xFF;    //  Blue
                            *pChar++ = 0x00;    //  Green
                            *pChar++ = 0x00;    //  Red
                        }
                        else
                        {
                            *pChar++ = 0x00;    //  Blue
                            *pChar++ = 0xFF;    //  Green
                            *pChar++ = 0xFF;    //  Red
                        }
                    }
                }
            }
        }

        //  Fire up the LCD
        lcd_config(framebufferPA);
    }

    Hope this may help ...

    ---- Misbah


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    Friday, April 26, 2013 5:15 AM

All replies

  • I assume that you are not talking about the boot logo and you are asking about the splash screen in the kernel.

    I have not done this but may be you can try this option :

    Under your platform.reg file, you have a reg setting as :

    [HKEY_CURRENT_USER\ControlPanel\Desktop]
        "wallpaper"="\\Windows\\wallpaper.jpg"   (" Or similar ...)

    Try editing it as

    [HKEY_CURRENT_USER\ControlPanel\Desktop]
        "wallpaper"="\\Mounted Volume\\wallpaper.jpg"

    If the NAND is mounted as "Mounded Volume"    ... eg ...

    picture should be there in nand ...

    --- Misbah


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    Thursday, April 25, 2013 8:40 AM
  • Hi,

    This is when windows is already loaded, but I need boot logo to load from file. Sry my eng. is not that good.

    Regards,

    Luka

    Thursday, April 25, 2013 8:45 AM
  • Hi Luka,

    You can flash the boot logo (Splash screen) to NAND or SDMMC.

    But to load that image while booting, you need to change few parts in eboot and hence you should recompile it...

    With regards,

    Keshava G N


    Keshava G N ( keshavagn@iwavesystems.com ), Member - Technical, iWave Systems ( http://iwavesystems.com )

    Thursday, April 25, 2013 9:24 AM
  • Hi,

    I know I have to change booloader, I just dont know where to start, if someone can point me in the right direction. 

    Regards,

    Luka

    Thursday, April 25, 2013 9:40 AM
  • What BSP?

    In short (the long one is too long):

    You reserve a piece of NAND for splash (just like you reserve a piece of NAND for NK). Then you add code to the bootloader to download a splash image and store that in NAND. Then at boot, you initialize the display driver, load the splash image from NAND and display it.

    I can't really explain anymore without making this a very, very long post. Some BSPs have support for this (like our Topaz BSP), hence I'm asking which BSP you are using.


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Thursday, April 25, 2013 10:52 AM
    Moderator
  • Yes Michel...

    But i think its better/easy if you write the splash screen BMP using the same way you are writing the eboot and NK to NAND... ie: may be using mfgtool etc.. (In this case you need to edit the function where you are writing NK and add the lines to download splash screen.), than writing in eboot...

    With regards,

    Keshava G N


    Keshava G N ( keshavagn@iwavesystems.com ), Member - Technical, iWave Systems ( http://iwavesystems.com )



    • Edited by Keshava GN Thursday, April 25, 2013 12:41 PM
    Thursday, April 25, 2013 12:39 PM
  • i think its better/easy if you write the splash screen BMP using the same way you are writing the eboot and NK to NAND... ie: may be using mfgtool etc.. (In this case you need to edit the function where you are writing NK and add the lines to download splash screen.), than writing in eboot...

    Well, you would still need to load the splash screen from NAND in the bootloader. Once you have the reading from NAND code, it is very easy to create the writing to NAND code (and vice versa), so no, I do not fully agree with your statement. If you use MfgTool then of course you'd want to add functionality to that to allow writing the splash screen from that app as well, but at the very least you'll need eboot to read the splash image from NAND and display it asap.


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Thursday, April 25, 2013 9:23 PM
    Moderator
  • There is a simplest way to do ... of course MfgTool concept is long procedure and even i doubt that your BSP actually has a code for that ... Can you tell us which BSP are you using ...

    In the Eboot you might be having .c file for flash management "flashmenu.c" or similar ... You can try adding the following code or may be implementing something the same :

    VOID FlashBMP(OAL_BLMENU_ITEM *pMenu)
    {

        WCHAR filename[13];
        ULONG BmpLen,BmpTempLen, offset;//,buf_offset;//, time;
        UCHAR TempBuf[ONE28_KB];//,Temp[100];
        HANDLE hFlash = NULL;
        char cnt=0;//index=0;
        //UINT32 count=0;

        OALLog(L"Flashing BMP...\r\n");
         memset(filename, 0, 15);
        wcscpy(filename, L"Logo.bmp");
        BmpLen=BLSDImageDownload(filename);
        BmpTempLen = BmpLen;
        if((!BmpLen) || (BmpLen == BL_ERROR))
        {
            OALLog(L"File not found\r\n");
            return ;
        }
        OALLog(L"BMP len...:0x%x\r\n",BmpLen);
        hFlash = OALFlashStoreOpen(g_ulFlashBase);
        if (hFlash == NULL)
        {
        OALMSG(OAL_ERROR, (L"ERROR: OEMWriteFlash: "
            L"OALFlashStoreOpen call failed!\r\n"
            ));
        }
        offset = IMAGE_BOOTLOADER_BITMAP_START;


    #if 1
        //128K - 131072
        //300K - 307200
        OALLog(L"Read BMP file\r\n");
        for(cnt=0;BmpLen>0;cnt++)
        {
            OALLog(L"#");
            memset(TempBuf, 0x0, ONE28_KB);
            BLSDCardReadData(ONE28_KB,(UCHAR *)TempBuf);
            BmpLen-=ONE28_KB;
            
            
            if (!OALFlashStoreWrite(
                hFlash, offset, TempBuf, (ONE28_KB), FALSE, FALSE
                ))
            {
            OALMSG(OAL_ERROR, (L"ERROR: OEMWriteFlash: "
                L"OALFlashStoreWrite at relative address 0x%08x failed\r\n", offset
                ));
            }
            
            offset += ONE28_KB;
        }
        OALLog(L"\r\n");
    #endif

    return;
    }

    This function will copy boot logo called "Logo.bmp" from SDcard to nand flash into a reserved region ...

    Then you need to have a function which shall read the boot logo from flash and display into the screen during booting ...

    in the eboot main.c you need to call this function ...

    The function to read logo from flash and display onto the screen shall look like this ...

    VOID ShowLogo(UINT32 flashAddr, UINT32 offset)
    {
        HANDLE  hFlash = NULL;
        DWORD  framebuffer;
        DWORD  framebufferPA;
        PUCHAR  pChar;
        ULONG   x, y;
        WORD    wSignature = 0;
        DWORD   dwOffset = 0;
        DWORD   dwLcdWidth,
                dwLcdHeight;
        DWORD   dwLength;


        //  Get the LCD width and height
        LcdPdd_LCD_GetMode( NULL, &dwLcdWidth, &dwLcdHeight, NULL );

        dwLength = BYTES_PER_PIXEL * LOGO_WIDTH * LOGO_HEIGHT;

        //  Get the video memory
        LcdPdd_GetMemory( NULL, &framebufferPA );
        framebuffer = (DWORD) OALPAtoUA(framebufferPA);
        pChar = (PUCHAR)framebuffer;

        if (flashAddr != -1)
        {
            // Open flash storage
            hFlash = OALFlashStoreOpen(flashAddr);
            if( hFlash != NULL )
            {
                //  The LOGO reserved NAND flash region contains the BMP file
                OALFlashStoreBufferedRead( hFlash, offset, (UCHAR*) &wSignature, sizeof(wSignature), FALSE );

                //  Check for 'BM' signature
                if( wSignature == 0x4D42 )
                {
                    //  Read the offset to the pixel data
                    OALFlashStoreBufferedRead( hFlash, offset + 10, (UCHAR*) &dwOffset, sizeof(dwOffset), FALSE );

                    //  Read the pixel data with the given offset
                    OALFlashStoreBufferedRead( hFlash, offset + dwOffset, pChar, dwLength, FALSE );
                }

                //  Close store
                OALFlashStoreClose(hFlash);

                //  Compute position and size of logo image
                g_dwLogoPosX   = (dwLcdWidth - LOGO_WIDTH)/2;
                g_dwLogoPosY   = (dwLcdHeight - LOGO_HEIGHT)/2;
                g_dwLogoWidth  = LOGO_WIDTH;
                g_dwLogoHeight = LOGO_HEIGHT;

                //As BMP are stored upside down, we need to flip the frame buffer's content
                FlipFrameBuffer((PUCHAR)framebuffer,LOGO_HEIGHT,LOGO_WIDTH*BYTES_PER_PIXEL,(PUCHAR)framebuffer + dwLength);
            }
        }

        //  If bitmap signature is valid, display the logo, otherwise fill screen with pattern
        if( wSignature != 0x4D42 )
        {
            //  Adjust color bars to LCD size
            g_dwLogoPosX   = 0;
            g_dwLogoPosY   = 0;
            g_dwLogoWidth  = dwLcdWidth;
            g_dwLogoHeight = dwLcdHeight;

            for (y= 0; y < dwLcdHeight; y++)
            {
                for( x = 0; x < dwLcdWidth; x++ )
                {
                    if( y < dwLcdHeight/2 )
                    {
                        if( x < dwLcdWidth/2 )
                        {
                            *pChar++ = 0x00;    //  Blue
                            *pChar++ = 0x00;    //  Green
                            *pChar++ = 0xFF;    //  Red
                        }
                        else
                        {
                            *pChar++ = 0x00;    //  Blue
                            *pChar++ = 0xFF;    //  Green
                            *pChar++ = 0x00;    //  Red
                        }
                    }
                    else
                    {
                        if( x < dwLcdWidth/2 )
                        {
                            *pChar++ = 0xFF;    //  Blue
                            *pChar++ = 0x00;    //  Green
                            *pChar++ = 0x00;    //  Red
                        }
                        else
                        {
                            *pChar++ = 0x00;    //  Blue
                            *pChar++ = 0xFF;    //  Green
                            *pChar++ = 0xFF;    //  Red
                        }
                    }
                }
            }
        }

        //  Fire up the LCD
        lcd_config(framebufferPA);
    }

    Hope this may help ...

    ---- Misbah


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    Friday, April 26, 2013 5:15 AM
  • Hi,

    maybe my question was not that good, I have this code from Adeneo embedded ( i use bsp from texas for AM3517 ).

    I know how to show image and how to load if from flash, but my customer wants to be able to change image without rewriting bootloader ie-> he will copy image to internal flash of my device, and I have to read if from there.

    So if i understand right I have to copy image to "flashAddr" in the code above? I dont fully understand how can i do that from windows.

    Regards,

    Luka

    Tuesday, April 30, 2013 7:23 AM
  • Maybe you're a bit in over your head... Misbah pretty much presented the solution in full source code. Don't take this wrong, but if you can't apply that to your BSP my advice would be to hire an expert.

    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Tuesday, April 30, 2013 8:32 AM
    Moderator
  • I know how to show image and how to load if from flash, but my customer wants to be able to change image without rewriting bootloader ie-> he will copy image to internal flash of my device, and I have to read if from there.

    You have solution to read from flash while booting.. 

    What you want now?

    Whether you want to write the image present in flash (file system) to raw space of flash??

    --Keshava G N


    Keshava G N ( keshavagn@iwavesystems.com ), Member - Technical, iWave Systems ( http://iwavesystems.com )

    Tuesday, April 30, 2013 9:14 AM