bojanpotocnik / cmake-uvision-syncer

CMake ⇄ µVision project file synchronizer
MIT License
37 stars 19 forks source link

Problem converting stm32f103c8 Keil project (bluepill) #3

Open podkiva opened 4 years ago

podkiva commented 4 years ago

Hi,

First of all, thanks for a great tool, I think it would be great to have an option of converting Keil project to cmake. There are many options to convert CubeMX projects but for Keil that is the only one I found, I hope some work on this would continue.

I am trying to convert the following proj.zip.

At first, I had problems like:

Traceback (most recent call last):
  File "/stm32/cmake-uvision-syncer/main.py", line 883, in <module>
    main()
  File "/stm32/cmake-uvision-syncer/main.py", line 856, in main
    uvp = UVisionProject.new(project_path)
  File "/stm32/cmake-uvision-syncer/main.py", line 459, in new
    ) for target in xproj.xpath("Targets/Target")
  File "/stm32/cmake-uvision-syncer/main.py", line 459, in <listcomp>
    ) for target in xproj.xpath("Targets/Target")
  File "/stm32/cmake-uvision-syncer/main.py", line 441, in <genexpr>
    ) for to_taa in target.xpath("TargetOption/TargetArmAds")
  File "/stm32/cmake-uvision-syncer/main.py", line 413, in <genexpr>
    ) for to_taa_c in to_taa.xpath("Cads")
  File "/stm32/cmake-uvision-syncer/main.py", line 295, in strict_bool
    value = text(element, name, nullable=nullable)
  File "/stm32/cmake-uvision-syncer/main.py", line 285, in text
    raise ValueError(f"Only one '{name}' tag per tree is supported, {len(value)}  found")
ValueError: Only one 'uGnu' tag per tree is supported, 0  found

which I have solved by manually adding <uGnu>0</uGnu> to "Cads" section in .uvprojx file.

Then I got:

Traceback (most recent call last):
  File "/stm32/cmake-uvision-syncer/main.py", line 883, in <module>
    main()
  File "/stm32/cmake-uvision-syncer/main.py", line 856, in main
    uvp = UVisionProject.new(project_path)
  File "/stm32/cmake-uvision-syncer/main.py", line 459, in new
    ) for target in xproj.xpath("Targets/Target")
  File "/stm32/cmake-uvision-syncer/main.py", line 459, in <listcomp>
    ) for target in xproj.xpath("Targets/Target")
  File "/stm32/cmake-uvision-syncer/main.py", line 441, in <genexpr>
    ) for to_taa in target.xpath("TargetOption/TargetArmAds")
  File "/stm32/cmake-uvision-syncer/main.py", line 413, in <genexpr>
    ) for to_taa_c in to_taa.xpath("Cads")
AttributeError: 'NoneType' object has no attribute 'split'

which I solved by adding

if value[0].text is None:
    return ""

return value[0].text

to line 283 (text(..) function) in main.py.

Finally, now I am having:

Traceback (most recent call last):
  File "/stm32/cmake-uvision-syncer/main.py", line 883, in <module>
    main()
  File "/stm32/cmake-uvision-syncer/main.py", line 856, in main
    uvp = UVisionProject.new(project_path)
  File "/stm32/cmake-uvision-syncer/main.py", line 532, in new
    ) for file in xproj.xpath("RTE/files/file")
  File "/stm32/cmake-uvision-syncer/main.py", line 532, in <listcomp>
    ) for file in xproj.xpath("RTE/files/file")
  File "/usr/lib/python3.6/enum.py", line 293, in __call__
    return cls.__new__(cls, value)
  File "/usr/lib/python3.6/enum.py", line 535, in __new__
    return cls._missing_(value)
  File "/usr/lib/python3.6/enum.py", line 548, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 'header' is not a valid Category

What would be the problem and how I can approach to solving it?

enversultanov commented 2 years ago

Hi! Thanks for sharing this tool! I'm having same issues as podkiva, any updates on this?