Adding a lot of files, spread across multiple directories, to a SeggerStudio project is annoying, so I was looking for a faster way. Fortunately the project file is simple XML, so I can use unix tools to automate this a bit. The find tool is extremely powerful, and allow me to generate all the references in one go:
find .. \( -name *.c -o -name *.h \) -printf ' <file file_name="%p" />\n'
- the group with the two
-name
patterns allows me to select all C header and source files. It must be grouped so that the printf applies to everything found. - the
-printf
then prints them out in exactly the form to paste them into the emProject file