diff options
| author | QMK Bot <hello@qmk.fm> | 2025-04-19 22:10:27 +0000 |
|---|---|---|
| committer | QMK Bot <hello@qmk.fm> | 2025-04-19 22:10:27 +0000 |
| commit | c8763c9fdb488cf53364096acfa936190f18c981 (patch) | |
| tree | 0083e8b49fd781481f9505295e23e140cb70ab84 /lib/python/qmk | |
| parent | ce8b8414d96e9d9ecb2e001fc5844a8fa9b7addc (diff) | |
| parent | edf34315affe4427f862ccd70ff2aa9143ee1966 (diff) | |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'lib/python/qmk')
| -rw-r--r-- | lib/python/qmk/cli/doctor/check.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/python/qmk/cli/doctor/check.py b/lib/python/qmk/cli/doctor/check.py index 2804a1d7df..51b0f0c80a 100644 --- a/lib/python/qmk/cli/doctor/check.py +++ b/lib/python/qmk/cli/doctor/check.py | |||
| @@ -54,10 +54,13 @@ def _check_arm_gcc_installation(): | |||
| 54 | """Returns OK if the arm-none-eabi-gcc is fully installed and can produce binaries. | 54 | """Returns OK if the arm-none-eabi-gcc is fully installed and can produce binaries. |
| 55 | """ | 55 | """ |
| 56 | with TemporaryDirectory() as temp_dir: | 56 | with TemporaryDirectory() as temp_dir: |
| 57 | temp_file = Path(temp_dir) / 'test.elf' | 57 | temp_in = Path(temp_dir) / 'test.c' |
| 58 | temp_out = Path(temp_dir) / 'test.elf' | ||
| 58 | 59 | ||
| 59 | args = ['arm-none-eabi-gcc', '-mcpu=cortex-m0', '-mthumb', '-mno-thumb-interwork', '--specs=nosys.specs', '--specs=nano.specs', '-x', 'c', '-o', str(temp_file), '-'] | 60 | temp_in.write_text('#include <newlib.h>\nint main() { return __NEWLIB__ * __NEWLIB_MINOR__ * __NEWLIB_PATCHLEVEL__; }', encoding='utf-8') |
| 60 | result = cli.run(args, stdin=None, stdout=None, stderr=None, input='#include <newlib.h>\nint main() { return __NEWLIB__ * __NEWLIB_MINOR__ * __NEWLIB_PATCHLEVEL__; }') | 61 | |
| 62 | args = ['arm-none-eabi-gcc', '-mcpu=cortex-m0', '-mthumb', '-mno-thumb-interwork', '--specs=nosys.specs', '--specs=nano.specs', '-x', 'c', '-o', str(temp_out), str(temp_in)] | ||
| 63 | result = cli.run(args, stdout=None, stderr=None) | ||
| 61 | if result.returncode == 0: | 64 | if result.returncode == 0: |
| 62 | cli.log.info('Successfully compiled using arm-none-eabi-gcc') | 65 | cli.log.info('Successfully compiled using arm-none-eabi-gcc') |
| 63 | else: | 66 | else: |
| @@ -65,8 +68,8 @@ def _check_arm_gcc_installation(): | |||
| 65 | cli.log.error(f'Command: {" ".join(args)}') | 68 | cli.log.error(f'Command: {" ".join(args)}') |
| 66 | return CheckStatus.ERROR | 69 | return CheckStatus.ERROR |
| 67 | 70 | ||
| 68 | args = ['arm-none-eabi-size', str(temp_file)] | 71 | args = ['arm-none-eabi-size', str(temp_out)] |
| 69 | result = cli.run(args, stdin=None, stdout=None, stderr=None) | 72 | result = cli.run(args, stdout=None, stderr=None) |
| 70 | if result.returncode == 0: | 73 | if result.returncode == 0: |
| 71 | cli.log.info('Successfully tested arm-none-eabi-binutils using arm-none-eabi-size') | 74 | cli.log.info('Successfully tested arm-none-eabi-binutils using arm-none-eabi-size') |
| 72 | else: | 75 | else: |
| @@ -91,10 +94,13 @@ def _check_avr_gcc_installation(): | |||
| 91 | """Returns OK if the avr-gcc is fully installed and can produce binaries. | 94 | """Returns OK if the avr-gcc is fully installed and can produce binaries. |
| 92 | """ | 95 | """ |
| 93 | with TemporaryDirectory() as temp_dir: | 96 | with TemporaryDirectory() as temp_dir: |
| 94 | temp_file = Path(temp_dir) / 'test.elf' | 97 | temp_in = Path(temp_dir) / 'test.c' |
| 98 | temp_out = Path(temp_dir) / 'test.elf' | ||
| 99 | |||
| 100 | temp_in.write_text('int main() { return 0; }', encoding='utf-8') | ||
| 95 | 101 | ||
| 96 | args = ['avr-gcc', '-mmcu=atmega32u4', '-x', 'c', '-o', str(temp_file), '-'] | 102 | args = ['avr-gcc', '-mmcu=atmega32u4', '-x', 'c', '-o', str(temp_out), str(temp_in)] |
| 97 | result = cli.run(args, stdin=None, stdout=None, stderr=None, input='int main() { return 0; }') | 103 | result = cli.run(args, stdout=None, stderr=None) |
| 98 | if result.returncode == 0: | 104 | if result.returncode == 0: |
| 99 | cli.log.info('Successfully compiled using avr-gcc') | 105 | cli.log.info('Successfully compiled using avr-gcc') |
| 100 | else: | 106 | else: |
| @@ -102,8 +108,8 @@ def _check_avr_gcc_installation(): | |||
| 102 | cli.log.error(f'Command: {" ".join(args)}') | 108 | cli.log.error(f'Command: {" ".join(args)}') |
| 103 | return CheckStatus.ERROR | 109 | return CheckStatus.ERROR |
| 104 | 110 | ||
| 105 | args = ['avr-size', str(temp_file)] | 111 | args = ['avr-size', str(temp_out)] |
| 106 | result = cli.run(args, stdin=None, stdout=None, stderr=None) | 112 | result = cli.run(args, stdout=None, stderr=None) |
| 107 | if result.returncode == 0: | 113 | if result.returncode == 0: |
| 108 | cli.log.info('Successfully tested avr-binutils using avr-size') | 114 | cli.log.info('Successfully tested avr-binutils using avr-size') |
| 109 | else: | 115 | else: |
