Library compilation error in previously working code

Hi
I just tried to recompile some code after a few days of inactivity and I am getting a compile error from one of the lower level libraries.

Here is the trace-back in PlatformIO:

Building .pio/build/wiscore_rak4631/firmware.hex
Building .pio/build/wiscore_rak4631/firmware.zip
Traceback (most recent call last):
File “/home/alan/.local/bin/adafruit-nrfutil”, line 8, in
sys.exit(cli())
File “/home/alan/.platformio/penv/lib/python3.8/site-packages/click/core.py”, line 1137, in call
return self.main(*args, **kwargs)
File “/home/alan/.platformio/penv/lib/python3.8/site-packages/click/core.py”, line 1062, in main
rv = self.invoke(ctx)
File “/home/alan/.platformio/penv/lib/python3.8/site-packages/click/core.py”, line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/alan/.platformio/penv/lib/python3.8/site-packages/click/core.py”, line 1666, in invoke
sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
File “/home/alan/.platformio/penv/lib/python3.8/site-packages/click/core.py”, line 923, in make_context
self.parse_args(ctx, args)
File “/home/alan/.platformio/penv/lib/python3.8/site-packages/click/core.py”, line 1379, in parse_args
value, args = param.handle_parse_result(ctx, opts, args)
File “/home/alan/.platformio/penv/lib/python3.8/site-packages/click/core.py”, line 2364, in handle_parse_result
value = self.process_value(ctx, value)
File “/home/alan/.platformio/penv/lib/python3.8/site-packages/click/core.py”, line 2320, in process_value
value = self.type_cast_value(ctx, value)
File “/home/alan/.platformio/penv/lib/python3.8/site-packages/click/core.py”, line 2307, in type_cast_value
return convert(value)
File “/home/alan/.platformio/penv/lib/python3.8/site-packages/click/types.py”, line 75, in call
return self.convert(value, param, ctx)
File “/home/alan/.local/lib/python3.8/site-packages/nordicsemi/main.py”, line 64, in convert
if value.lower() == ‘none’:
AttributeError: ‘int’ object has no attribute ‘lower’
*** [.pio/build/wiscore_rak4631/firmware.zip] Error 1
========================================== [FAILED] Took 25.20 seconds ==========================================
The terminal process “platformio ‘run’” terminated with exit code: 1.

This is not a compile error, the build is finished as you can see it created the .hex and the .zip file.

The error comes from the call to adafruit-nrfutil to flash the device.
Did you update the nRF52 BSP in PlatformIO?

Hi Bernd,
I had only pressed the compile ‘button’ so I’m confused as to why it was trying to flash the device (which wasn’t even connected). I’ve had problems in the past where I have tried to flash the device when it wasn’t connected and it just came up with serial connection errors. Visual code has recently been updated in my Ubuntu system and maybe PlatformIO as well.
I’ll try again with the device connected

Thanks,
Alan

For me, PlatformIO sometimes acts up strangely on older projects.
What I usually do is to delete the complete .pio folder of the project and then try again to compile.

1 Like

I’m still getting the same problem. I have tried connecting the device; I have tried to install the build and I have deleted the .pio directory.
I also checked my libraries were up to date and upgraded 2: SX126x-Arduino to 2.0.5 and Sparkfun u-blox GNSS to 2.0.15.
I know this is not really your problem as it is an issue with the IDE, but I’m hoping you might give me some pointers as to what to try next.

The Visual Code version I am using is:

Version: 1.60.2
Commit: 7f6ab5485bbc008386c4386d08766667e155244e
Date: 2021-09-22T12:01:43.795Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 5.11.0-36-generic

Thanks
Alan

Another thing I have just noticed.
The compiler has produced the .elf and .hex files , but not the .zip file. So it looks like it might failing during that process?

Alan

Hi @Alangward
I am using the same version of Visual Code, but on Windows 10.

What is the version number of PlatformIO?
image
And what is the version of the nRF52 BSP?

It looks like adafruit-nrfutil fails to create the ZIP file. But this Python error output is confusing. I have no idea why it fails with

File “/home/alan/.local/lib/python3.8/site-packages/nordicsemi/main.py”, line 64, in convert
if value.lower() == ‘none’:
AttributeError: ‘int’ object has no attribute ‘lower’

Can you try to compile the same code for adafruit_feather_nrf52840 instead of wiscore_rak4631. That would show if the problem is within the BSP extension for WisBlock.

My PlatformIO version is the same as yours.
My Nordic nRF52 version is 8.1.0
I have now upgraded it to 8.3.0, but it can no longer find wiscore_rak4631

Processing wiscore_rak4631 (platform: nordicnrf52; board: wiscore_rak4631; framework: arduino)

Error: Unknown board ID ‘wiscore_rak4631’
The terminal process “platformio ‘run’” terminated with exit code: 1.

This is my platformio.ini file:

[env:wiscore_rak4631]
platform = nordicnrf52
board = wiscore_rak4631
framework = arduino
lib_deps =
mikalhart/TinyGPSPlus@^1.0.2
beegee-tokyo/SX126x-Arduino@^2.0.1
sparkfun/SparkFun LIS3DH Arduino Library@^1.0.3
beegee-tokyo/nRF52_OLED@^1.0.0
sparkfun/SparkFun u-blox GNSS Arduino Library@^2.0.12

If I search in PlatformIO for the board it can’t find it any more

I have now updated the versions in platformio.ini with no effect.

I changed the board as you suggested, but got this when I tried to compile it:

command ‘platformio-ide.clean’ not found

I restarted Code with the same result.

Thanks
Alan

Try this tutorial to get RAK4631 back on PlatformIO.

The error you get can happen directly after you open VC. Sometimes PIO plug in needs some time before all works.

Problem solved.
This fixed my original problem as well.
Thanks very much.

Alan

Sigh…
I’ve now lost the DEFINES for the WB_I01 etc pin definitions.
No idea where they were defined before.

Alan

They are in the variants.h file

Path on Windows C:\Users\<<USER>>\.platformio\packages\framework-arduinoadafruitnrf52\variants\WisCore_RAK4631_Board

Should be included automatically when you select board = wiscore_rak4631 in platformio.ini

Thanks for this.
It is apparently some weirdness in Code. It is complaining in the buzzer.cpp file that WB_I03 is undefined, but it compiles fine and the buzzer works (apart from drawing 300mA).

Thanks
Alan

The standard library does compile, I can tell you that much. So either your project configuration is wrong, or clicker counter something in your code … The most common cause of compilation errors is a Sntax error . Syntax errors are errors in the form of the raw source code, usually caused by some violation of the computer language’s principles.