Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update STM32_gen_PeripheralPins.py for #212 #217

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Update STM32_gen_PeripheralPins.py for #212 #217

merged 1 commit into from
Jan 19, 2024

Conversation

JohnK1987
Copy link
Member

@JohnK1987 JohnK1987 commented Jan 19, 2024

In this PR I did small update of STM32_gen_PeripheralPins.py for protection against using python version older than python3+ and should be solution for #212

Before this PR:

D:\Mbed\MbedCE\MbedCE_test\mbed-os\targets\TARGET_STM\tools>STM32_gen_PeripheralPins.py -m "STM32U575RGTx.xml"

Script version 1.20.5

Checking STM32_open_pin_data repo...
*** git clone https://github.com/STMicroelectronics/STM32_open_pin_data.git ***
*** git clone done

STM32_open_pin_data DB version STM32CubeMX-DB.6.0.90

 * Output directory: D:\Mbed\MbedCE\MbedCE_test\mbed-os\targets\TARGET_STM\tools\TARGET_CUSTOM\TARGET_STM\TARGET_STM32U5\TARGET_STM32U575xG\TARGET_STM32U575RGT
 * Generating PeripheralPins.c and PinNames.h with 'STM32_open_pin_data\mcu\STM32U575RGTx.xml'
 * GPIO file: STM32_open_pin_data\mcu\IP\GPIO-STM32U5x_gpio_v1_0_Modes.xml
Traceback (most recent call last):
  File "D:\Mbed\MbedCE\MbedCE_test\mbed-os\targets\TARGET_STM\tools\STM32_gen_PeripheralPins.py", line 1934, in <module>
    parse_pins()
  File "D:\Mbed\MbedCE\MbedCE_test\mbed-os\targets\TARGET_STM\tools\STM32_gen_PeripheralPins.py", line 1400, in parse_pins
    if "Variant" in s.attributes:
  File "C:\Python27\lib\xml\dom\minidom.py", line 523, in __getitem__
    return self._attrs[attname_or_tuple]
KeyError: 0

After this PR

D:\Mbed\MbedCE\MbedCE_test\mbed-os\targets\TARGET_STM\tools>STM32_gen_PeripheralPins.py -m "STM32U575RGTx.xml"
Traceback (most recent call last):
  File "D:\Mbed\MbedCE\MbedCE_test\mbed-os\targets\TARGET_STM\tools\STM32_gen_PeripheralPins.py", line 30, in <module>
    if sys.version_info[0] < 3: raise Exception("Python 3+ is required (recommended latest one).")
Exception: Python 3+ is required (recommended latest one).

I did real test with Python 2.7

Summary of changes

Impact of changes

Migration actions required

N/A

Documentation

N/A


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[x] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@multiplemonomials


Protection against using python version older than python3+
@multiplemonomials multiplemonomials merged commit ca8b6cb into mbed-ce:master Jan 19, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants