jondurrant / RP2040PIO-DS18B20

Raspberry Pi PICO or RP2040 PIO Lib for DS18B20 Temperature Sensor
MIT License
4 stars 1 forks source link

Problems building example #1

Closed dborrett closed 1 year ago

dborrett commented 1 year ago

Hello, I'm having a couple of problems trying to build your example code for the RPi pico. I'm using Debian 11 and VS Code and am new to using CMake. So, I've made a folder under ~/pico/projects/ds1820 and copied your code (unmodified) to it. VS Code seems to do the configuration OK, but fails on the build with:-

[build] .../pico/projects/ds1820/src/main.cxx:4:10: fatal error: DS1820.pio.h: No such file or directory [build] #include "DS1820.pio.h"

If I run build just on 'ds18p20pio_DS1820_pio_h' I can see that this missing header file has been generated in the 'build' subdir, but is obviously not being found by the main build. If I copy that header file (DS1820.pio.h) to the 'src' directory, then I get much further. It looks like all the compilation gets done, but then fails on linking:-

[build] [ 94%] Linking CXX executable DS18B20.elf [build] /usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: cannot find -lds20b18pio [build] collect2: error: ld returned 1 exit status

So 'ds20b18pio' doesn't seem to get created (I can't find this in any other location) but I'm struggling to find out why this is. Any pointers on how to track down the problem would be much appreciated. Rgds, DB

jondurrant commented 1 year ago

Hi DB,

I don't use VSCode. It sounds to me like two problems are going on. One the library isn't correctly being recognised by VSCode so you are not linking properly. Secondly the build doesn't seem to understand the assembly build and include.

My advice would be to start using CMake and Make for building, and just using VSCode for editing and debuging.

Sorry not a great deal of help.

jondurrant commented 1 year ago

Closing as a VSCode configuration issue.

dborrett commented 1 year ago

I believe there is still a problem in /src/CMakeLists.txt. The 'target_link_libraries' line still refers to 'ds20b18pio' instead of 'ds18p20pio' even though this was apparently corrected back in March 2022. This was the reason my build was failing. The readme also has the wrong reference.

jondurrant commented 1 year ago

I think you are right. I will fix this. Thank you for finding it.

jondurrant commented 1 year ago

Fixed my dyslexia by mixing up ds18b20 with ds20b18!

Now builds cleanly.