Id code + custom bootloader flashing



I have a custom bootloader wich works without idcode.

When i set the idcode, i cannot flash the application.


I am guessing there is an flash authentification that i might do in the bootloader to enable writing



  • What do you mean by "When i set the idcode, i cannot flash the application"?
    Are you talking about the bootloader programming the code flash, or the debugger programming the code flash?

    Are you using an S5 device and IAR Embedded Workbench (if so, which version)?

  • In reply to Jeremy:

    Hi Jeremy-
    I believe Ajith has his own bootloader and it can flash the application without the ID Code (the one that locks out the debugger) being set for a "password". Once he sets the password the bootloader doesn't flash the application. Is there a way for him to (or does he need to) "Unlock" the ID Code prior to flashing his application? If he needs to unlock, how is this done?
  • In reply to WarrenM:

    If he is using IAR EW with an S5 device, and programming the ID code, and is using the version of IAR EW that has the issue with the flashloader, he might trigger the issue where the Flash Access window is set when programming the ID bytes. In which case, upgrading the version of IAR EW should fix the issue.
  • In reply to Jeremy:

    Hi Jeremy,

    1) The MCU is an S7G2 with a custom board, IAR EW 8.2?? (i am at home i cannot verify)

    2) I have made my own bootloader which is placed in 0x000000 - 0x1FFFFF.
    And my application which is located between 0x200000 - 0x3FFFFF
    My bootloader works with no issue, i can upgrade my application as well.

    4) The bootloader is flashed with RFP or jlink
    The application is flashed with a proprietary software which dialogue with the bootloader

    5) I wanted to protect the flash memory of reading by someone.
    So i tried to set the ID CODE PROTECTION (pwd and erase all), into the bootloader.
    Since, my bootloader weren't able to flash the application.

    What i am guessing, maybe the bootloader has to deactivate the ID CODE PROTECTION before writing.
    I don't have any information, i don't want to make an error and lock the MCU

    6) Another help
    I weren't able to unlock the mcu with jlink with my password (id code) and even with "eraseall" code
    I were able to unlock the mcu with RFP with the "eraseall" code, but with my password (id code) i can't

  • In reply to Ajith:

    With the attached IAR project for S7G2-SK board and SSP 1.6.0, I have set the ID Bytes in the configuration :-



    There is no need to alter any linker scripts or any of the SSP code when using SSP 1.6.0 to use the ID Code.


    The first time I down this project it downloads ok as the ID bytes in the configuration area of flash were all FF when the device was reset. Subsequently, if the device is reset (e.g. by the debugger or the user), or the board is power cycled, then the ID bytes now programmed into the flash will now be used. So, if I stop the debug session, power cycle the board, and try to debug the same project again, the JLink ID code verification window pops up :-


    If I enter the ID code :-



    then the debug session starts successfully.


    In RFP, the format of the ID code is different (annoyingly). During the setup of an RFP project connecting to an S7G2-SK board that has the above project programmed in to it (and has been power cycled), I have to set the ID bytes :-



    Then the setup of the RFP project is sucessful.



    Using the ALeRASE command via the debugger is not as simple as just entering the ID bytes as "ALeRASE", please use the attached batch file (inside the zip file, also please check the path to the JLink.exe is correct in the batch file), this should allow you to erase the S7G2 flash using the ALeRASE command using the JLink debugger :-


     The project also programs and erases the top block of code flash with the ID bytes set.


  • In reply to Jeremy:

    Hi jeremy and Warren

    What abt the id code proction and selfprogramming the app by the bootloader

    thanks for your help
  • In reply to Ajith:

    Setting of the ID code does not effect the ability of the bootloader to self program program the flash.
  • In reply to Jeremy:

    when the id code protection is set, my bootloader cannot self programme the application.

    When the id code protection is NOT set, my bootloader CAN self programme the application.

    How do you explain that, i don't understand
  • In reply to Ajith:

    Can you provide an project that displays the issue you are seeing. I have created a simple application, and I can program and erase the code flash with the ID bytes set.
  • In reply to Jeremy:

    i cannot give you the bootloader i need to have the authorizartion
    i will investigate more and comeback to you
  • In reply to Ajith:

    Is your bootloader based on the Renesas flashloader?
  • In reply to Ajith:

    Hi Ajith-
    Did your issue get resolved?

  • In reply to WarrenM:

    we were short in time for our delivery, so we left id protection because it doesn't work