Fix macOS locale env for adafruit-nrfutil invocations
Arduino IDE v2 invokes tools in an environment where `LANG=""` and `LC_ALL=` are not set to a specific encoding, as described in: https://github.com/arduino/arduino-ide/issues/1513#issuecomment-1293383639 The bundled adafruit-nrfutil binary is a PyInstaller-frozen app using Click, which expects the encoding to be set to UTF-8, and throws the following error on macOS: Traceback (most recent call last): File "__main__.py", line 317, in <module> File "click/core.py", line 1134, in __call__ File "click/core.py", line 1040, in main File "click/_unicodefun.py", line 100, in _verify_python_env RuntimeError: Click will abort further execution because Python was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/unicode-support/ for mitigation steps. This system supports the C.UTF-8 locale which is recommended. You might be able to resolve your issue by exporting the following environment variables: export LC_ALL=C.UTF-8 export LANG=C.UTF-8 So, prepends `env LANG=C.UTF-8 LC_ALL=C.UTF-8` to each invokation in macOS, via a `.macosx` override, to force a valid locale. To avoid duplication, the tool arguments have been moved into a `.args` variable that is included in the normal call and the `.macosx` override.
This commit is contained in:
1 parent
4a2d8dd5be
commit
7ce71f4c8d
2 files changed
+9
-3
No files matched your search
+6
-2
@@ -106,7 +106,9 @@ recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}"
|
||||
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
|
||||
|
||||
## Create dfu package zip file
|
||||
recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip"
|
||||
recipe.objcopy.zip.args=dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip"
|
||||
recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" {recipe.objcopy.zip.args}
|
||||
recipe.objcopy.zip.pattern.macosx=env LANG=C.UTF-8 LC_ALL=C.UTF-8 "{tools.nrfutil.cmd}" {recipe.objcopy.zip.args}
|
||||
|
||||
## Create uf2 file
|
||||
#recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f {build.uf2_family} -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex"
|
||||
@@ -139,7 +141,9 @@ tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/ad
|
||||
|
||||
tools.nrfutil.upload.params.verbose=--verbose
|
||||
tools.nrfutil.upload.params.quiet=
|
||||
tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank
|
||||
tools.nrfutil.upload.args={upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank
|
||||
tools.nrfutil.upload.pattern="{cmd}" {tools.nrfutil.upload.args}
|
||||
tools.nrfutil.upload.pattern.macosx=env LANG=C.UTF-8 LC_ALL=C.UTF-8 "{tools.nrfutil.cmd}" {tools.nrfutil.upload.args}
|
||||
|
||||
# ---------------------------------------------------
|
||||
# Burning bootloader with either jlink or nrfutil
|
||||
|
||||
Reference in new issue
Block a user