S7 Bootloader question

Hi,

I am working on this basic bootloader application: renesasrulz.com/.../3223 and I am trying to upload the "S7SK_HMI_MMF" project. In this case, I have to copy on a USB stick the two binaries: flash.bin and qspi_flash.bin. My question is: what are they referred to? Is the first related to the executable and the second to the GUIX resources?

In particular, I would like to try to load my own GUIX HMI project application using the bootloader: how can I generate the two .bin files to copy on the USB stick? I saw there is a .bat file that should do the work, but it seems it doesn't work. Any help?

Thanks,

regards.

  • Hi Laser,

    As you may see in S7SK_HMI_MMF\src\gui\TimeAndTemp_resources.c, there are definitions with __attribute__ ((section(".qspi_flash"))) - all these resource will be placed in the QSPI Flash memory. I think you're right: the flash.bin is related to the exectuable and the qspi_flash.bin to the GUIX resources, in this case.

    I tested this batch file and it created flash.bin and qspi_flash.bin, I opened a console, changed directory to the S7SK_HMI_MMF and run the script:
    C:\PATH_TO_PROJECT\BootLoader\S7SK_BLv2.3\S7SK_HMI_MMF>bootloader_flash_qspi.bat Debug\S7SK_HMI_MMF.srec

    Do you see any errors?

    Regards,
    adboc
  • In reply to adboc:

    Hi adboc,
    yes, now I successful create the two .bin files by the execution of the batch file.
    I took a HMI SK-S7G2 example file and, as described in the notes,:


    -  I added the pre-build command (AddSectionAttribute.py) in the project property (the .py script that add the "__attribute__ ((section(".qspi_flash")))" to the resources)
    -  I replaced the S7G2.ld file from the bootloader example with the original one present in my project (this step should addresses correctly the application)
    -  I run the batch file and copy the two generated .bin on a USB stick

    The bootloader on the S7 seems to perform the updating (the onboard LEDs should blink as expected), but at the end , when I reset the board, I cannot see anything on the LCD!

    Perhaps are there any other steps ore configurations to do to the original project?
    In order to place the GUIX resources onto the QSPI, is sufficient to perform the first step described above?

  • In reply to Laser:

    Hi Laser,

    I succesfully run the bootloader with S7SK_HMI_MMF application. Please note that erasing and programming QSPI takes a long time, as the document suggests. When I run the application it took about one minute. Are you sure that these operations are completed? Is the green LED blinking? The board should reset automatically when the USB device is ejected.

    If you've made any modifications to S7SK_HMI_MMF, maybe try with the prebuilt flash.bin and qspi_flash.bin first.

    Adding a section attribute should be sufficient to place GUIX resources onto the QSPI.

    Regards,
    adboc
  • In reply to adboc:

    Hi adboc,
    the prebuilt flash.bin and qspi_flash.bin are loaded successfully by the bootloader.
    I tryied the following:
    I took the S7SK_HMI_MMF application, and I added a Text Button in the first screen. I generated the flash.bin and qspi_flash.bin and copied them onto a USB stick. When the bootloader has finished to load the new application (green LED blinking), I can see the original appication on the LCD, the newly added button appears but without its text inside.
    Then, I added a second button to the same screen. Now, when I load the flash.bin and qspi_flash.bin in the board with the boot loader, I cannot see anything on the LCD now!
    What is happening?
    1) In the first case, why the string doesn't appear?
    2) In the second case: why adding a button (or prompt or whatelse) to that GUIX project the screen becomes blank?
    Thank you!
  • In reply to Laser:

    Hello Laser,

    Have you verified that the command specified in pre-build steps runs successfully? If python script was provided with invalid path for resources, it will fail to add the necessary attribute and GUIX resources will be linked into code flash on the device instead. You can verify that by searching for "0x60000000" in the .map file to check if there are any references to symbols at that address.

    Regards
  • In reply to Renesas Karol:

    Hi,

    the python script seems to refer to the correct path. By the way, I can't understand why the resource file is called twice:

    C:\Python27\python.exe ${workspace_loc}/${ProjName}/AddSectionAttribute.py ${workspace_loc}/${ProjName}/src/gui/TimeAndTemp_resources.c ${workspace_loc}/${ProjName}/src/gui/TimeAndTemp_resources.c

    Perhaps are there any other resources to call when I modify the GUIX project?

    Is that script called automatically at every build or I have to run it explicitly?

    Looking for "0x60000000" in the .map file gives the following:

    Memory Configuration

    Name             Origin             Length             Attributes
    FLASH            0x02000000         0x00400000         xr
    RAM              0x1ffe0000         0x000a0000         xrw
    DATA_FLASH       0x40100000         0x00010000         xr
    QSPI_FLASH       0x60000000         0x04000000         xr
    SDRAM            0x90000000         0x02000000         xrw
    *default*        0x00000000         0xffffffff

    [...]

    .qspi_retentive
                    0x60000000        0x0
                    0x60000000                __qspi_retentive_start__ = .
     *(.qspi_retentive*)
                    0x60000000                __qspi_retentive_end__ = .
                    0x00000000                __qspi_retentive_size__ = (__qspi_retentive_end__ - __qspi_retentive_start__)

    .qspi_flash     0x60000000    0xc7eb0
                    0x60000000                __qspi_flash_start__ = .

    .qspi_flash     0x60000000    0xc7eb0
                    0x60000000                __qspi_flash_start__ = .
     *(.qspi_flash*)
     .qspi_flash    0x60000000    0xc7eb0 ./src/gui/TimeAndTemp_resources.o
                    0x60000000                display_1_theme_1_color_table
                    [...]
                    0x60000000                __qspi_region_start_address__ = __qspi_flash_start__
                    0x64000000                __qspi_region_end_address__ = (__qspi_flash_start__ + __qspi_region_max_size__)

    Could you see something wrong?

    I think it is only a probkem about visualization: in fact, the screen in blank, but the LED blinks correctly at every touch.

  • In reply to Laser:

    Hello Laser,

    Does your application use SPI with DTC to configure the display? By default DTC is automatically added to every SPI instance and in the standard project (linked into code flash) it works perfectly fine. When using MMF, address translation is performed only for the CPU access (that's why GUIX resources which are used by JPEG and D/AVE2D engines need to be placed in QSPI) - DTC tries to access MMF region directly when writing data through SPI that was originally placed in code flash (and is now linked to MMF). You'll need to remove DTC from SPI instance used for display config in order for your HMI application to work properly.

    Regards
  • In reply to Renesas Karol:

    Hello Karol,

    My project is generated from an import of the S7SK_HMI_MMF in the Bootloader folder from Renesas, so the configuration may be correct; in practise is exactly the same application, in which I only added a prompt text and a text button in the GUIX "main_window". The DTC seems to be not present, as shown in the following screenshot:

    Do you confirm that the pre build python command to give in the C/C++ Build properties must be the following? Is this the "TimeAndTemp_resources.c" the only resource file to add?

    C:\Python27\python.exe ${workspace_loc}/${ProjName}/AddSectionAttribute.py ${workspace_loc}/${ProjName}/src/gui/TimeAndTemp_resources.c ${workspace_loc}/${ProjName}/src/gui/TimeAndTemp_resources.c

     

    Thank you.

  • In reply to Laser:

    Hi Laser,

    Yes, this is the only file to add. Do you have Python 2.7 installed under C:\Python27? Please verify, that you're able to run C:\Python27\python.exe or change the path as needed. If you don't have it installed, the latest 2.7.x version for Windows is available at www.python.org/.../

    Regards,
    adboc
  • In reply to adboc:

    adboc,

    Yes, I have. Infact, the attributes seems they are added to the resource file:

    The problems seems to come out when I make some changes to the project (e.g. add a prompt to a window). When I do these changes, I guess the resources.c file would be updated. Does it make sense to verify in some way if the "updated resource" are correctly sent to QSPI?

  • In reply to Laser:

    Hello Laser,

    We looked into this problem and observed similar behaviour after simply adding the prompt or text button widget - the application would freeze as soon as it came to rendering the first glyph. This is because by default, these widgets use built-in GUIX fonts which aren't part of generated resources (and hence are not moved to QSPI). Changing your widget to use PROMPT_EXT (or any other user-defined font) solves the problem.

    Regards
  • In reply to Renesas Karol:

    Karol,
    thanks, that was the reason for that malfunctioning!

    I would like to point out another behaviour.
    I start with the SK-S7G2 programmed only with the Renesas Bootloader. I have a first USB stick containing the original S7SK_HMI_MMF app and another USB stick containing MY_APP, which is derived from the S7SK_HMI_MMF with the prompt addition as described in the posts above. Consider these two situations:
    1) I program the first time using the USB stick containing the S7SK_HMI_MMF, obviously it loads succesfully. I power off the board, insert the 2nd key with the MY_APP and power on the board. I'm expecting the bootloader to load MY_APP, but it seems to do nothing: no LEDs blinking, even if I wait for a long time.
    2) the first app to be loaded on the bootloader is MY_APP. It loads succesfully, but, after that, if I power off the board, insert the MY_APP key another time, it does not load the app (no LEDs blinking).
    Which can be the reason for that behaviour? Why the app is not loaded by the bootloader? It seems an addresses problem, but the S7G2.ld file are the same for both applications. Any ideas?
    Regards
  • In reply to Laser:

    Hi,
    Just had a look and indeed there is an error in the "erase" part of the bootloader. After a new image has been programmed, the old image area is erased. I noticed that I was only erasing 1 block, rather than that entire area of 62 blocks. Therefore, if your application is >32k and requires more than 1 block, when you try to re-use the area you get the flash write error.
    Thankfully it's a very simple fix.
    In the file main_thread_entry.c of the project S7SK_BLv2, in the main processing thread, find the case statement

    case ERASE_USER_FLASH:

    change the erase api calls so that it uses the length parameter to IMAGE_SIZE_BLOCK_COUNT, so it looks like this:

    /* Now erase the previous image */
    if( A == image_info.image_location)
    {
    ThreadsAndInterrups( DISABLE );
    ssp_err = g_flash.p_api->erase( g_flash.p_ctrl,
    IMAGE_B_START_BLOCK,
    IMAGE_SIZE_BLOCK_COUNT );
    ThreadsAndInterrups( RE_ENABLE );
    }
    else
    {
    ThreadsAndInterrups( DISABLE );
    ssp_err = g_flash.p_api->erase( g_flash.p_ctrl,
    IMAGE_A_START_BLOCK,
    IMAGE_SIZE_BLOCK_COUNT );
    ThreadsAndInterrups( RE_ENABLE );
    }

    I've just tried it and I can now do multiple program cycles.
  • In reply to Richard:

    Richard,

    thanks, it was the solution.

    Now I am trying to modify your Bootloader project to make it suitable for a PE-HMI1  based hardware platform. Obviously, in the configurator.xml, I choose "S7G2 PE-HMI1" in the BSP tab and added ThreadX as RTOS being used.

    Building the project, I get some errors in the qspi driver code. In the Pins -> Peripherals section, I enabled the QSPI. Perhaps is it due to the change of hardware from SK to PE? Any idea on how to fix them?

    Thanks

  • In reply to Laser:

    Have you mounted a QSPI memory in your PE-HMI1 kit? I think it doesn't have any.