Reputation: 614
I've written some embedded code (using VS-Code as my IDE) that is ready for deployment to many different devices.
The code contains a file config.h
that defines a unique device_id
that needs to change for each device.
I have a file unique_ids.csv
that contains all of the unique ids that I need to use.
VS-Code can automatically build my project and creates a file called project_name.bin
.
How can I set up a script that automatically takes the uniqe ids from my CSV file and builds a specific device_id.bin
file for each one?
I suspect this may require utilizing Visual Studio Tasks in some way. Here is my current tasks.json
:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"name": "make",
"isShellCommand": true,
"showOutput": "always",
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}/mbed-os"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
},
"args": ["-j"],
"linux": {
"command": "make"
},
"osx": {
"command": "make"
},
"windows": {
"command": "make.exe"
}
}
Upvotes: 1
Views: 84
Reputation: 2336
Thinking of an alternative approach, I might not be answering directly.
If you are using the csv for release and not for debug, why would you build the release inside VS? I would rather build my debug inside VS and build my different releases using command line with a batch script.
Something like this batch pseudo code
set id_list=unique_ids.csv
set id=
for %%a in (%id_list%) do (
set "id=%%~na"
replace in config.h device_id by device_%id%
make your_project
)
Upvotes: 1