Open-CMSIS-Pack / generator-bridge

Reference examples of a generator bridge. E.g. STCubeMX_Bridge
Apache License 2.0
2 stars 6 forks source link

[cbridge] processing of `*.cbuild-gen.yml` fails when a `define:` node contains a key value pair #54

Closed DavidLesnjak closed 5 months ago

DavidLesnjak commented 5 months ago

Is there an existing issue for this?

Current Behavior

In CMSIS-Toolbox.2.4.0 command "csolution run -g " fails when a symbol with a value is defined under define section in cproject/clayer file.

Expected Behavior

Command "csolution run -g" should execute also when define with a value is used.

Steps To Reproduce

  1. Create a csolution project

  2. In cproject file add a define with a value Example:

    define:                       # Start a list of define statements
    - TestValue: 12            # add symbol 'TestValue' with value 12
  3. Execute command: csolution <solution>.csolution.yml run -g CubeMX -c <context>

  4. Reported error:

    
    Unmarshal: yaml: unmarshal errors:
    line 42: cannot unmarshal !!map into string
    Error : yaml: unmarshal errors:
    line 42: cannot unmarshal !!map into string

error csolution: executing generator 'CubeMX' for context 'test.Debug+device' failed



### Affected tools

- [ ] cbuild
- [ ] cbuild-gen
- [ ] cpackget
- [ ] csolution
- [ ] packchk
- [ ] svdconv

### Affected operating systems

- [x] Windows amd64
- [ ] Windows arm64
- [ ] Linux amd64
- [ ] Linux arm64
- [ ] MacOS amd64
- [ ] MacOS arm64

### Environment

_No response_
jkrech commented 5 months ago

@DavidLesnjak, would you agree that this error message comes from cbridge? It looks like a define with value assignment is "breaking" the YAML parser in cbridge. Note that running cbuild works correctly.

brondani commented 5 months ago

It looks like cbridge tries to parse the define as a string even when it can be a key/value pair. https://github.com/Open-CMSIS-Pack/generator-bridge/blob/v0.9.5/internal/cbuild/cbuild.go#L89 FYI @bgn42 @thorstendb-ARM