This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Modify DEVICE_NAME

Hello.

I use nrf51822 chip.

I want modify Device_name as below.

1EA product "CoCoNut - 001"

other 1EA product "CoCoNut - 002"

other 1EA product "CoCoNut - 003" .....

So, 001,002,003 numbering is storage from flash memory.

I want modify only one source code.

but, I don't know add device_name.

How can I modify source code?

please confirm it.

Parents
  • You could use a script to modify your binary for each device you upload to.

    e.g. In your code define a constant array with the text "CoCoNut - 001"

    In the binary there were be a the text "CoCoNut - 001", so you just need to get your script to change this to "CoCoNut - 002" etc before you upload

    You'd need to keep track of the index number somehow, e.g. some sort of database (or even just a text file)

  • I don't know of any example code that will do this for you.

    You'll need to split the task into smaller parts and find code to do each part e.g.

    Open and read a binary file into memory Open your database (possibly text file) and read in the current index number Search and replace the file in memory with the number from the database Write out the new binary file as a temporary file for upload

    Write your index number back to your database Use the JLink SDK to connect to the JLink and upload the temporary file If no error, increment your index number and save back to your database file. Potentially loop back around based on user feeback

    Note you may be able to skip the step where you save the temporary binary file and instead send it straight to the JLink SDK API.

    BTW. Someone may post an alternative solution.i.e give you some code or script they already wrote.

Reply
  • I don't know of any example code that will do this for you.

    You'll need to split the task into smaller parts and find code to do each part e.g.

    Open and read a binary file into memory Open your database (possibly text file) and read in the current index number Search and replace the file in memory with the number from the database Write out the new binary file as a temporary file for upload

    Write your index number back to your database Use the JLink SDK to connect to the JLink and upload the temporary file If no error, increment your index number and save back to your database file. Potentially loop back around based on user feeback

    Note you may be able to skip the step where you save the temporary binary file and instead send it straight to the JLink SDK API.

    BTW. Someone may post an alternative solution.i.e give you some code or script they already wrote.

Children
No Data
Related