From ef12f4526a3e09f333df5b2e79ffca11fb74b171 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:57:38 +0000 Subject: [PATCH 1/4] Initial plan From 9593751a3815ec556cb727c4a85d87a19c058124 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 12:00:51 +0000 Subject: [PATCH 2/4] Add --config and --config-dest options to dmf-get for single module downloads Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com> --- tools/system/dmf-get/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/system/dmf-get/main.c b/tools/system/dmf-get/main.c index 2f45306..818d486 100644 --- a/tools/system/dmf-get/main.c +++ b/tools/system/dmf-get/main.c @@ -1927,6 +1927,8 @@ static void PrintUsage(const char* app_name) { Dmod_Printf(" -m, --manifest Path or URL to manifest file\n"); Dmod_Printf(" -o, --output-dir Output directory for downloaded modules\n"); Dmod_Printf(" --config-dir Directory where configuration files should be copied\n"); + Dmod_Printf(" --config Configuration file to copy (for single module only)\n"); + Dmod_Printf(" --config-dest Custom destination filename for config file\n"); Dmod_Printf(" -D, --define Define variable for config path substitution\n"); Dmod_Printf(" -t, --tools-name Tools name for variable substitution\n"); Dmod_Printf(" -a, --arch-name Architecture name for variable substitution\n"); @@ -1963,6 +1965,8 @@ static void PrintUsage(const char* app_name) { Dmod_Printf(" %s -d deps.dmd # Download all modules from deps.dmd\n", app_name); Dmod_Printf(" %s -d deps.dmd --config-dir ./config # Download modules and copy configs to ./config\n", app_name); Dmod_Printf(" %s -d deps.dmd --config-dir ./config -D BOARD=stm32f7 # Use variable substitution in config paths\n", app_name); + Dmod_Printf(" %s dmclk@0.4 --config board/stm32f746g-disco.ini --config-dir ./config # Download module with config\n", app_name); + Dmod_Printf(" %s mymodule --config mcu/config.ini --config-dir ./cfg --config-dest my.ini # Custom config destination\n", app_name); Dmod_Printf(" %s -m http://... module # Use custom manifest\n", app_name); Dmod_Printf(" %s --type dmfc module # Prefer dmfc files\n", app_name); Dmod_Printf(" %s -a armv7-cortex-m7 module # Use arch name directly\n", app_name); @@ -2332,6 +2336,8 @@ int main(int argc, char* argv[]) { const char* manifest_path = NULL; const char* output_dir = NULL; const char* config_dir = NULL; + const char* config_file = NULL; // Configuration file to copy for single module + const char* config_dest_name = NULL; // Custom destination name for config file const char* tools_name = NULL; const char* arch_name = NULL; const char* cpu_name = NULL; @@ -2385,6 +2391,20 @@ int main(int argc, char* argv[]) { } config_dir = argv[i]; } + else if (strcmp(argv[i], "--config") == 0) { + if (++i >= argc) { + DMOD_LOG_ERROR("Error: %s requires an argument\n", argv[i-1]); + return 1; + } + config_file = argv[i]; + } + else if (strcmp(argv[i], "--config-dest") == 0) { + if (++i >= argc) { + DMOD_LOG_ERROR("Error: %s requires an argument\n", argv[i-1]); + return 1; + } + config_dest_name = argv[i]; + } else if (strcmp(argv[i], "-D") == 0 || strcmp(argv[i], "--define") == 0) { if (++i >= argc) { DMOD_LOG_ERROR("Error: %s requires an argument\n", argv[i-1]); @@ -2930,6 +2950,12 @@ int main(int argc, char* argv[]) { if (result != 0) { counts.failed_count++; + } else if (config_file && config_dir) { + // If configuration file is specified via command line, copy it + DMOD_LOG_INFO("Configuration file specified: %s\n", config_file); + if (!CopyConfigurationFile(module_name, config_file, output_dir, config_dir, config_dest_name)) { + DMOD_LOG_WARN("Failed to copy configuration file (module was installed successfully)\n"); + } } // Print installation summary From 88329bbde2360a39ce894181a18cf6843108b023 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 12:03:09 +0000 Subject: [PATCH 3/4] Update documentation with --config option examples and usage Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com> --- tools/system/dmf-get/README.md | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tools/system/dmf-get/README.md b/tools/system/dmf-get/README.md index f3875b8..2d2768f 100644 --- a/tools/system/dmf-get/README.md +++ b/tools/system/dmf-get/README.md @@ -51,6 +51,15 @@ dmf-get -o /path/to/output mymodule # Specify tools name for variable substitution dmf-get -t arch/armv7/cortex-m7 mymodule + +# Download module and copy configuration file +dmf-get mymodule@1.0 --config board/config.ini --config-dir ./config + +# Example: Download module with specific config (as requested in issue) +dmf-get dmclk@0.4 --config board/stm32f746g-disco.ini --config-dir ./config + +# Download with custom config destination name +dmf-get mymodule --config mcu/default.ini --config-dir ./cfg --config-dest my.ini ``` #### Multiple Modules with Dependencies File (.dmd) @@ -97,11 +106,50 @@ dmf-man -d /path/to/docs mymodule For more information about viewing documentation, see the [dmf-man tool documentation](../dmf-man/README.md). +#### Copying Configuration Files from Modules + +When downloading a single module from the command line, you can specify a configuration file to copy from the module package using the `--config` option. This feature is similar to the configuration file support in `.dmd` files. + +```bash +# Copy a configuration file from the module to a destination directory +dmf-get dmclk@0.4 --config board/stm32f746g-disco.ini --config-dir ./config + +# This will: +# 1. Download and install the dmclk@0.4 module +# 2. Look for board/stm32f746g-disco.ini in the module's config directory +# 3. Copy it to ./config/dmclk/stm32f746g-disco.ini + +# Specify a custom destination filename (without module subdirectory) +dmf-get mymodule --config mcu/default.ini --config-dir ./cfg --config-dest my.ini +# Copies to: ./cfg/my.ini (instead of ./cfg/mymodule/default.ini) + +# Use with variable substitution +dmf-get mymodule --config boards/${BOARD}/config.ini --config-dir ./config -D BOARD=stm32f7 +# Substitutes ${BOARD} with stm32f7 in the config path +``` + +**Configuration File Lookup:** +1. The configuration file is searched in the module's config directory as specified in the `.dmr` file +2. If not found in `.dmr`, the default location `//config/` is used + +**Destination Naming:** +- **Default behavior**: Configuration file is copied to `//` +- **With --config-dest**: Configuration file is copied to `/` + +**Requirements:** +- Both `--config` and `--config-dir` must be specified together +- The module must be successfully installed before the configuration file is copied +- If configuration file copying fails, the module installation still succeeds (with a warning) + ### Command-Line Options - `-d, --dependencies ` - Path or URL to dependencies (.dmd) file - `-m, --manifest ` - Path or URL to manifest file - `-o, --output-dir ` - Output directory for downloaded modules +- `--config ` - Configuration file to copy from module (for single module only) +- `--config-dir ` - Directory where configuration files should be copied +- `--config-dest ` - Custom destination filename for configuration file +- `-D, --define ` - Define variable for configuration path substitution - `-t, --tools-name ` - Tools name for variable substitution - `-a, --arch-name ` - Architecture name for variable substitution - `--type ` - Prefer dmf or dmfc file type @@ -166,6 +214,9 @@ dmf-get -t arch/armv7/cortex-m7 mymodule@1.0 # Download to specific directory dmf-get -o ./my_modules mymodule +# Download module with configuration file (as requested in issue) +dmf-get dmclk@0.4 --config board/stm32f746g-disco.ini --config-dir ./config + # Non-interactive mode (automatically accept licenses) dmf-get -y mymodule ``` From 2214ada6cfb63780e89eacee5fe1fbf9ef657950 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 12:04:10 +0000 Subject: [PATCH 4/4] Add validation for --config and --config-dest options Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com> --- tools/system/dmf-get/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/system/dmf-get/main.c b/tools/system/dmf-get/main.c index 818d486..529649a 100644 --- a/tools/system/dmf-get/main.c +++ b/tools/system/dmf-get/main.c @@ -2552,6 +2552,32 @@ int main(int argc, char* argv[]) { return 1; } + // Validate --config option usage + if (config_file) { + if (!config_dir) { + DMOD_LOG_ERROR("Error: --config requires --config-dir to be specified\n"); + PrintUsage(argv[0]); + return 1; + } + if (dependencies_path) { + DMOD_LOG_ERROR("Error: --config cannot be used with -d/--dependencies\n"); + DMOD_LOG_ERROR(" Use configuration syntax in .dmd file instead\n"); + PrintUsage(argv[0]); + return 1; + } + if (command && (strcmp(command, "headers") == 0 || strcmp(command, "docs") == 0)) { + DMOD_LOG_ERROR("Error: --config cannot be used with %s command\n", command); + PrintUsage(argv[0]); + return 1; + } + } + + if (config_dest_name && !config_file) { + DMOD_LOG_ERROR("Error: --config-dest requires --config to be specified\n"); + PrintUsage(argv[0]); + return 1; + } + // Initialize curl curl_global_init(CURL_GLOBAL_DEFAULT);