Implementing Flash Read Out Protection on s7g2 using Renesas Flash Programmer

I wanted to implement the Flash read out protection(Purpose: Flash Erase on possible attempt of read) in our projects. We are using s7g2 and flashing the code from Renesas Flash Programmer. I researched a bit and found out that the latest Renesas Flash Programmer V3.08.01 has the option of various Flash protection settings, including the said Flash read protection. PFA attached screenshot of the user manual. However when I installed this latest version, I do not find the tab of "Flash Options" itself. Why is this?. Moreover I found threads of implementing ID Setting, but we have to do this without using e2 studio.
Kindly request anyone to help me out here.
Himanshu M.
  • Dear jeremy, 

    I checked the memory locations 0x40120050-0x4012005F , they are not programmed with the id code. Am i missing any step?. Ther are all F's

  • It sounds like you have not actually programmed the binary containing the ID code that is not all 0xFF, into the device.

  • ok.But what am i missing? Any step?

  • Dear jeremy my project 's board selection is DKs7G2. Is that a problem?

  • The ID is programmed into the S7G2 device, the board selection makes no difference.

    The proceedure to set an ID code is :-

    1) Create an SSP project, set an ID code in the BSP tab of the project, make sure the ID code is not disabled.

    2) Confirm the generated source code contains the ID code you configured in the file synergy_cfg/ssp_cfg/bsp/bsp_cfg.h, also confirm the output of the compiler contains the ID code by looking at the srecord file generated by the compilation process :-

    S31540120050FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF58 (this is a blank ID code, but it is located at address 0x40120050, so it is at the correct location)

    The ID code location in memory can also be confirmed by looking in the .map file, e.g. for a project based on SSP 1.7.8 :-

    .id_code_1      0x40120050       0x10
                    0x40120050                __ID_Codes_Start = .
     .id_code_1     0x40120050       0x10 ./synergy/ssp/src/bsp/mcu/s7g2/bsp_rom_registers.o
                    0x40120060                __ID_Codes_End = .

    3) Debug the project, and confirm the ID code has been programmed into the OSIS regsters 0x40120050-0x4012005F.

    Some early versions of the SSP did not support the generation of an ID code (I think it was SSP 1.4.0 that was the first version of the SSP to properly support the ID code). If a project has been upgraded from a version of the SSP that did not fully support ID codes, the linker script file might need updating to place the ID code at the correct location in the memory map. The linker script should have a entry for the .id_code section, e.g. the GCC linker script, at the top defines the memory regions, there is a region for the ID_CDOES :-

      FLASH (rx)         : ORIGIN = 0x00000000, LENGTH = 0x0400000  /*   4M */
      RAM (rwx)          : ORIGIN = 0x1FFE0000, LENGTH = 0x00A0000  /* 640K */
      DATA_FLASH (rx)    : ORIGIN = 0x40100000, LENGTH = 0x0010000  /*  64K */
      QSPI_FLASH (rx)    : ORIGIN = 0x60000000, LENGTH = 0x4000000  /*  64M, Change in QSPI section below also */
      SDRAM (rwx)        : ORIGIN = 0x90000000, LENGTH = 0x2000000  /*  32M */
      ID_CODES (rx)      : ORIGIN = 0x40120050, LENGTH = 0x10       /* 16 bytes */    

    and at the end of the GCC linker script is the .id_code section :-

        .id_code_1 :
            __ID_Codes_Start = .;
            __ID_Codes_End = .;
        } > ID_CODES

  • Dear jeremy,

    It seems i did not have the .id_code section in my project. I added the above two code parts manually in the linker script and it worked.

    However now I am facing a strange thing. I would explain it with example 

    When I kept 

    BSP ID CODE as 3322110077665544BBAA9988FFEEDDCC, I could successfully debug by E2studio by giving the generated id code  3322110077665544BBAA9988FFEEDDcc and by RFP through ccDDEEFF8899AABB445566770112233.

    However when i kept the BSP ID CODE as 17170707191996961717070719199696, I could only debug by E2studio by giving the generated id code 171707071919969617170707191996d6 and not by RFP. I gave 6d699191707071716969919107071717. why is this happening? I get 

    [W0000005] : Mismatch of ID Code.  &
    Error(E1000007): An authentication code error occurred in the device. (Command: 30, Response: DB)
    Operation failed

    errors respectively. Please help.

  • Try the ID d6961919070717179696191907071717 with RFP

  • It did not work. Same error Mismatch of id code.

  • I just tried setting the ID code in the configurator as :- 17170707191996961717070719199696 with ID Code mode as "Locked with all erase support".

    In bsp_cfg.h the ID code is :-

    /* ID CODE: 171707071919969617170707191996d6 */
    #define BSP_CFG_ID_CODE_LONG_1 (0x07071717)
    #define BSP_CFG_ID_CODE_LONG_2 (0x96961919)
    #define BSP_CFG_ID_CODE_LONG_3 (0x07071717)
    #define BSP_CFG_ID_CODE_LONG_4 (0xd6961919)

    In the srecord file that is generated the ID code is :-


    I use the ID code 171707071919969617170707191996d6 in e2studio debug configuration to connect.

    In RFP I use the ID code d6961919070717179696191907071717 to connect.

    It all works as expected.

  • Dear jeremy,

    I found out the problem was that the .srec contained the old id code(I had programmed before), i had not programmed the new id code into the MCU and was trying to connect with the new one on RFP. Thankyou for helping me out with minute details for this task. The support I get here on forum is immense.

    Warm regards & Thankyou,

    Himanshu M