If you’re going into production with your RL78-based design—or even running several different prototypes of it—you may well want to keep track of each different board. Using the Renesas Flash Programmer (RFP) tool you can program multiple codes that will each be incremented with for each new chip you flash. In this way you can keep track, for example, of the board number, the firmware version, even the place of origin. The latter might help you track down a manufacturing defect to a specific assembly line should one occur. I can also see its being useful as an anti-piracy tool, though we’re only talking about flash memory and not encrypted, secure NVM.

The unique code embedding function embeds a unique code in the specified area in the loaded program file. The RFP reads a unique code file that you have to first create; this file can specify one specific area and multiple unique codes. Each unique code has an index. When the [Program] command or [Autoprocedure] command finishes normally, the index is updated to the next index.

A unique code file is an ASCII text file with the extension ‘.ruc’. The format is:

The first line :format
The second line :area
The third line :address
The fourth line :size
The fifth line :index data
The sixth line and after :index number and unique code
The lines starting with // are comment lines and will be skipped.

For example:

//Sample unique code file
format hex
area user flash
address 0xf000
size 6
index data
000001 abcdef000001
000002 abcdef000002
000003 abcdef000003

To enable this function, start the RFP and select Unique Code Setting from the Tools menu. Click on Enable. Select the .ruc file you created and the start location for the code. If you’re just embedding one code, leave the default at Restart on Session; for further codes select Continue from Previous, in which case you need to indicate the Start and End positions for the code. Select Overwrite and OK. You can then program the chip and your unique code will be embedded in it.

For further information check the Renesas Flash Programmer User’s Manual.