Get CPU device from code (build defines)

Sysprogs forums Forums VisualGDB Get CPU device from code (build defines)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26717
    MrZANE
    Participant

    Hi

    I have a device connecting to a cloud server and would like to report the CPU device type (Fex. STM32L431CC) selected in the Project->VisualGDB Project Properties->Embedded Project to the cloud (As we might change the CPU at a later time).
    Is there a way to get the selected CPU device in code (Preferably as a string)?

    I tried to enable the verbos build output (tools->Options->VisualGDB->General->Output->Enabled verbose = true) to see what kind buildtime defines there were but I couldn’t get it to output any more info than the filenames as they compiled.
    Is that the right way to enable complete build commands?

    Kind regards

    Jimmy

    #26718
    support
    Keymaster

    Hi,

    If you are using MSBuild, the output verbosity is controlled by Visual Studio itself and can be configured via Tools->Options->Projects and Solutions->Build and Run.

    You can also find the preprocessor macros in the .rsp files inside your build directory (search for -D<macro> strings).

    Normally, something like this would work:

    #ifdef STM32L431CC
    Report.DeviceType = MyIDForSTM32L431CC;
    #elif defined (...)
    Report.DeviceType = MyIDForSomethingElse;
    #else
    #error Unknown device. Add a check for it above.
    #endif
    #26762
    MrZANE
    Participant

    That works just fine.

    Thanks for your help.

    Kind regards

    Jimmy

     

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.