Skip to content

CMake program target .elf path is wrong #1253

@JeyRunner

Description

@JeyRunner

Hi,
I am trying to setup a new modm project with CMake as build script generator. When calling the programming target with make program I get the following error:

** Programming Started **
Error: couldn't open PATH_TO_PROJECT_FOLDER/app/build/src/rot_encoder.elf
embedded:startup.tcl:1516: Error: ** Programming Failed **
in procedure 'modm_program' 
in procedure 'program' called at file "modm/openocd.cfg", line 13
in procedure 'program_error' called at file "embedded:startup.tcl", line 1581
at file "embedded:startup.tcl", line 1516
Built target program

I have the following file structure

├── app
│   ├── build
│   │   ├── rot_encoder.bin
│   │   ├── rot_encoder.elf
│   ├── CMakeLists.txt
│   ├── modm
│   ├── project.xml
│   ├── scripts
│   │   └── prog.cfg
│   └── src
│       └── main.cpp
└── ext
    └── modm

The problem comes from

${PROJECT_BINARY_DIR}/src/${project_name}.elf

When I change the line to the following it just works:

        ${PROJECT_BINARY_DIR}/${project_name}.elf   # removed src/

So my question is, am I doing something wrong? And why the .elf file is expected to be in a sub build/src/ folder and not directly in the build folder?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions