User avatar
nick.mccloud
Posts: 1280
Joined: Sat Feb 04, 2012 4:18 pm

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 11:36 am

hippy wrote:
Wed Jul 28, 2021 11:23 am
Here's the $64K question; should users bear the inconvenience of making things easier for the vendor or should the vendor bear the inconvenience of making things easier for the users ?
I'm sure the vendor will happily make things easier if you fund it.

Making another one to
hippy wrote:
Wed Jul 28, 2021 11:03 am
avoid reputational damage and get whinging customers off my back.
may well be tempting for James & Co. But I suspect "whinging customers" don't sway things in their favour, certainly don't for me.
Pico/RP2040 ≠ Arduino
Pico = hot rod kit car, Arduino = hot rod kit car wrapped in cotton wool with buoyancy aids & parachute

hippy
Posts: 10550
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 11:49 am

nick.mccloud wrote:
Wed Jul 28, 2021 11:36 am
But I suspect "whinging customers" don't sway things in their favour, certainly don't for me.
They way I see it; if I have provided customers with something and it doesn't do what I said it would do, stops doing what I said it would do, my customers have complete legitimacy in whinging about that.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 29342
Joined: Sat Jul 30, 2011 7:41 pm

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 11:53 am

hippy wrote:
Wed Jul 28, 2021 11:23 am
nick.mccloud wrote:
Wed Jul 28, 2021 9:11 am
jamesh wrote:
Wed Jul 28, 2021 8:50 am


We did consider this, but there are downsides which meant we were not happy with it as the main install process.
Just in case anyone is wondering, there is nothing like the joy of having TWO update mechanisms to document and support. And a Git Pull is almost test free, whereas packaging for a .deb would really need testing as well.
Here's the $64K question; should users bear the inconvenience of making things easier for the vendor or should the vendor bear the inconvenience of making things easier for the users ?
This comes at a cost. Would you be willing to pay more for the Pico to make it easier for the user*? Lets say $6 instead of $4, so they we can employ someone to do the extra work? Now multiply that up by the number of people who would be have to be happy at $6 in order to pay the entire salary. e.g $150k salary, lets guess at profit per Pico of $0.75 , that's 200k sales needed just to pay the salary of the person needed to support this extra development. How on earth can we be sure that there are that many sales available at the higher price to make that cost effective? These are the sort of tradeoffs we have to make every single day when deciding what to do what not to do, what to make, what prices we can charge etc. It's not as simple as a 64k question binary question.


* in this case, a small subset of users who don't seem to be able to get to grips with it for reasons that elude me
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 29342
Joined: Sat Jul 30, 2011 7:41 pm

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 11:56 am

hippy wrote:
Wed Jul 28, 2021 11:49 am
nick.mccloud wrote:
Wed Jul 28, 2021 11:36 am
But I suspect "whinging customers" don't sway things in their favour, certainly don't for me.
They way I see it; if I have provided customers with something and it doesn't do what I said it would do, stops doing what I said it would do, my customers have complete legitimacy in whinging about that.
Which is not the case here, of course, so not sure why you imply it is.

TBH, its getting to the point where I am thinking we should just remove the Windows instructions from the docs completely and say its only available for Linux and Mac. Seriously, more trouble than it is worth dealing with those Windows users who are unable to deal with the slightest complexity.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

hippy
Posts: 10550
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 12:05 pm

jamesh wrote:
Wed Jul 28, 2021 11:56 am
hippy wrote:
Wed Jul 28, 2021 11:49 am
nick.mccloud wrote:
Wed Jul 28, 2021 11:36 am
But I suspect "whinging customers" don't sway things in their favour, certainly don't for me.
They way I see it; if I have provided customers with something and it doesn't do what I said it would do, stops doing what I said it would do, my customers have complete legitimacy in whinging about that.
Which is not the case here, of course, so not sure why you imply it is.
I am not implying that at all. It was nick.mccloud who moved my comment out of context. I was merely explaining why there is good reason for Arduino not to have used 'cmake', 'make' or anything else. Detailing a situation I had found myself in when it came to unexpected changes in dependencies.
jamesh wrote:
Wed Jul 28, 2021 11:56 am
TBH, its getting to the point where I am thinking we should just remove the Windows instructions from the docs completely and say its only available for Linux and Mac. Seriously, more trouble than it is worth dealing with those Windows users who are unable to deal with the slightest complexity.
I believe that would cause more criticism than it removes but it is not my decision to make.

lurk101
Posts: 902
Joined: Mon Jan 27, 2020 2:35 pm
Location: Cumming, GA (US)

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 12:12 pm

jamesh wrote:
Wed Jul 28, 2021 11:56 am
TBH, its getting to the point where I am thinking we should just remove the Windows instructions from the docs completely and say its only available for Linux and Mac. Seriously, more trouble than it is worth dealing with those Windows users who are unable to deal with the slightest complexity.
Or, WSL only Windows support...

User avatar
nick.mccloud
Posts: 1280
Joined: Sat Feb 04, 2012 4:18 pm

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 12:54 pm

hippy wrote:
Wed Jul 28, 2021 11:49 am
nick.mccloud wrote:
Wed Jul 28, 2021 11:36 am
But I suspect "whinging customers" don't sway things in their favour, certainly don't for me.
They way I see it; if I have provided customers with something and it doesn't do what I said it would do, stops doing what I said it would do, my customers have complete legitimacy in whinging about that.
If circumstances outside of my control change a working environment in such a way that a product is unable to function, then I look at the situation in a commercial context. I certainly don't jump because some people are feeling outraged that the universe has moved against them.

If I've screwed up, I do my utmost to fix it.

BTW, I was highlighting the delicious irony of you having whinging customers ...
Pico/RP2040 ≠ Arduino
Pico = hot rod kit car, Arduino = hot rod kit car wrapped in cotton wool with buoyancy aids & parachute

hippy
Posts: 10550
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 2:07 pm

nick.mccloud wrote:
Wed Jul 28, 2021 12:54 pm
hippy wrote:
Wed Jul 28, 2021 11:49 am
nick.mccloud wrote:
Wed Jul 28, 2021 11:36 am
But I suspect "whinging customers" don't sway things in their favour, certainly don't for me.
They way I see it; if I have provided customers with something and it doesn't do what I said it would do, stops doing what I said it would do, my customers have complete legitimacy in whinging about that.
If circumstances outside of my control change a working environment in such a way that a product is unable to function, then I look at the situation in a commercial context. I certainly don't jump because some people are feeling outraged that the universe has moved against them.

If I've screwed up, I do my utmost to fix it.

BTW, I was highlighting the delicious irony of you having whinging customers ...
Not sure what "irony" you see. But I don't really care.

ejolson
Posts: 8063
Joined: Tue Mar 18, 2014 11:47 am

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 5:09 pm

hippy wrote:
Wed Jul 28, 2021 2:07 pm
nick.mccloud wrote:
Wed Jul 28, 2021 12:54 pm
hippy wrote:
Wed Jul 28, 2021 11:49 am

They way I see it; if I have provided customers with something and it doesn't do what I said it would do, stops doing what I said it would do, my customers have complete legitimacy in whinging about that.
If circumstances outside of my control change a working environment in such a way that a product is unable to function, then I look at the situation in a commercial context. I certainly don't jump because some people are feeling outraged that the universe has moved against them.

If I've screwed up, I do my utmost to fix it.

BTW, I was highlighting the delicious irony of you having whinging customers ...
Not sure what "irony" you see. But I don't really care.
Is it possible to install the Pico SDK on Windows so a path like

/usr/local/pico-sdk

specified in CMakeLists.txt works without any changes?

asu
Posts: 59
Joined: Sun Jul 18, 2021 8:19 am

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 5:11 pm

ejolson wrote:
Wed Jul 28, 2021 5:09 pm
Is it possible to install the Pico SDK on Windows so a path like

/usr/local/pico-sdk

specified in CMakeLists.txt works without any changes?
The only way I can think of is using WSL and installing the SDK/using CMake there.

ejolson
Posts: 8063
Joined: Tue Mar 18, 2014 11:47 am

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 5:13 pm

asu wrote:
Wed Jul 28, 2021 5:11 pm
ejolson wrote:
Wed Jul 28, 2021 5:09 pm
Is it possible to install the Pico SDK on Windows so a path like

/usr/local/pico-sdk

specified in CMakeLists.txt works without any changes?
The only way I can think of is using WSL and installing the SDK/using CMake there.
So cmake doesn't automatically translate forward to backslashes in Windows?

asu
Posts: 59
Joined: Sun Jul 18, 2021 8:19 am

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 5:15 pm

ejolson wrote:
Wed Jul 28, 2021 5:13 pm
asu wrote:
Wed Jul 28, 2021 5:11 pm
ejolson wrote:
Wed Jul 28, 2021 5:09 pm
Is it possible to install the Pico SDK on Windows so a path like

/usr/local/pico-sdk

specified in CMakeLists.txt works without any changes?
The only way I can think of is using WSL and installing the SDK/using CMake there.
So cmake doesn't automatically translate forward slashes to backslashes?
Windows can deal with forward slashes most of the time just fine AFAIK.
I'm assuming you mean exactly the /usr/local/pico-sdk path, in which case I'm not sure how you would get it to work since the drive letter is missing.

ejolson
Posts: 8063
Joined: Tue Mar 18, 2014 11:47 am

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 5:20 pm

asu wrote:
Wed Jul 28, 2021 5:15 pm
ejolson wrote:
Wed Jul 28, 2021 5:13 pm
asu wrote:
Wed Jul 28, 2021 5:11 pm


The only way I can think of is using WSL and installing the SDK/using CMake there.
So cmake doesn't automatically translate forward slashes to backslashes?
Windows can deal with forward slashes most of the time just fine AFAIK.
I'm assuming you mean exactly the /usr/local/pico-sdk path, in which case I'm not sure how you would get it to work since the drive letter is missing.
I see what you mean. I think there used to be a notion of working drive in MS-DOS, but maybe that got lost with Windows.

dbrion06
Posts: 644
Joined: Tue May 28, 2019 11:57 am

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Wed Jul 28, 2021 5:45 pm

TBH, its getting to the point where I am thinking we should just remove the Windows instructions from the docs completely and say its only available for Linux and Mac. Seriously, more trouble than it is worth dealing with those Windows users who are unable to deal with the slightest complexity.
When Windows fully gets married with UBUlinux (they are at the wedding parade stade) problem will be solved.... and world will be less complex (Windows developpers will be happy with DNNs, users will have a wandroid or a wubuntu system, and tell it is innovating -the funny apple way-; everyone will be happy, M$ shareholders will realize DNNs bring more good dollars/euros/roubles/lubnanyeliras than making OSes)...

hippy
Posts: 10550
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Thu Jul 29, 2021 10:22 am

ejolson wrote:
Wed Jul 28, 2021 5:20 pm
I think there used to be a notion of working drive in MS-DOS, but maybe that got lost with Windows.
AFAICT it's still there. The question would be whether 'cmake' takes "/usr/local/pico-sdk' and prepends the drive letter of the directory where 'cmake' was launched from or the drive letter of where the 'cmake' executable is held.

Whatever it does shouldn't be problematic because one can create a 'cmake' wrapper which sets things up correctly before invoking the 'genuine original cmake'; batch file, Python script, program.

I have done that already so I don't have to remember to add -G "NMake Makefiles" or whatever it is now I'm using MinGW, can just type a simple 'cmake ..' as I would on Linux.

hippy
Posts: 10550
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Thu Jul 29, 2021 11:11 am

As noted earlier, my reason for including a hard-wired path in CMakeLists.txt was to avoid needing to have a copy of 'pico_sdk_import.cmake' in every project directory. And to achieve that goal I ended up with -

Code: Select all

set(PICO_SDK_PATH ~/pico/pico-sdk)
include(${PICO_SDK_PATH}/external/pico_sdk_import.cmake)
I didn't like doing that but it was a means to an end. I could entirely agree with those who said that wasn't the way it should be done but, given they weren't providing any solution as to how it could otherwise be achieved, and not having the time or resources to expend on figuring out a better solution for myself; that was the way it was staying.

I have found some time to look for that alternative and it turns out it was quite simple -

Code: Select all

set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
include(${PICO_SDK_PATH}/external/pico_sdk_import.cmake)
In fact it can be even simpler -

Code: Select all

include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
Which leaves me wondering why it wasn't this way to start with, why there was ever that requirement to copy 'pico_sdk_import.cmake' into every project directory, why those who know more about 'cmake' than me never proffered this as a solution to avoid having to do so.

Maybe there are issues with doing it this way but, so far, it works for me and I will be updating my project files to reflect this way of doing things - No more hard-wired Pico SDK paths in my project.

hippy
Posts: 10550
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Thu Jul 29, 2021 11:52 am

If it helps others; this is what my 'CMakeLists.txt' now looks like for my out of tree build for the 'hello_usb' example. The same, except first line edited, for other projects -

Code: Select all

set(PROJECT hello_usb)
cmake_minimum_required(VERSION 3.12)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
project(${PROJECT} C CXX)
pico_sdk_init()
add_executable(${PROJECT} ${PROJECT}.c)
target_link_libraries(${PROJECT} pico_stdlib)
target_compile_options(${PROJECT} PRIVATE -Wall -Werror)
pico_add_extra_outputs(${PROJECT})
pico_enable_stdio_usb(${PROJECT} 1)
pico_enable_stdio_uart(${PROJECT} 0)

set_source_files_properties(
    ${PICO_SDK_PATH}/lib/tinyusb/src/common/tusb_fifo.c
    PROPERTIES COMPILE_OPTIONS "-Wno-error=strict-overflow"
)
set_source_files_properties(
    ${PICO_SDK_PATH}/lib/tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c
    PROPERTIES COMPILE_OPTIONS "-Wno-error=unused-but-set-variable"
)
set_source_files_properties(
    ${PICO_SDK_PATH}/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c
    PROPERTIES COMPILE_OPTIONS "-Wno-error=unused-but-set-variable"
)

pidd
Posts: 2509
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Thu Jul 29, 2021 12:24 pm

I definitely agree with you using the SDK's pico_sdk_import.cmake instead of a local project copy. I came very unstuck because a local copy was out of date not long after I started with pico.

I can see the argument that the build directory should have copies of everything used at the last build but pico_sdk_import.cmake can kill the next build if it is treated as a project file instead of being part of the SDK.

kilograham
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 876
Joined: Fri Apr 12, 2019 11:00 am
Location: austin tx

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Thu Jul 29, 2021 12:59 pm

hippy wrote:
Thu Jul 29, 2021 11:11 am
As noted earlier, my reason for including a hard-wired path in CMakeLists.txt was to avoid needing to have a copy of 'pico_sdk_import.cmake' in every project directory. And to achieve that goal I ended up with -

Code: Select all

set(PICO_SDK_PATH ~/pico/pico-sdk)
include(${PICO_SDK_PATH}/external/pico_sdk_import.cmake)
I didn't like doing that but it was a means to an end. I could entirely agree with those who said that wasn't the way it should be done but, given they weren't providing any solution as to how it could otherwise be achieved, and not having the time or resources to expend on figuring out a better solution for myself; that was the way it was staying.
As mentioned before the instructions are right there in the README.md in the pico-sdk
I have found some time to look for that alternative and it turns out it was quite simple -

Code: Select all

set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
include(${PICO_SDK_PATH}/external/pico_sdk_import.cmake)
In fact it can be even simpler -

Code: Select all

include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
Which leaves me wondering why it wasn't this way to start with, why there was ever that requirement to copy 'pico_sdk_import.cmake' into every project directory, why those who know more about 'cmake' than me never proffered this as a solution to avoid having to do so.

Maybe there are issues with doing it this way but, so far, it works for me and I will be updating my project files to reflect this way of doing things - No more hard-wired Pico SDK paths in my project.
That is a fine way to do it, but you just get a less friendly "can't find /external/pico_sdk_import.cmake" or maybe wore if PICO_SDK_PATH is not set. It also doesn't allow you to set the PICO_SDK_PATH on the cmake command line.

Additionally pico_sdk_import also supports finding pico_sdk as a submodule, or pulling it from git for you.

Copying the pico_sdk_imoprt.cmake remains the recommended way. It provides a bridge between the users' environment and the SDK in a way that you don't have to worry about.

kilograham
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 876
Joined: Fri Apr 12, 2019 11:00 am
Location: austin tx

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Thu Jul 29, 2021 1:00 pm

pidd wrote:
Thu Jul 29, 2021 12:24 pm
I definitely agree with you using the SDK's pico_sdk_import.cmake instead of a local project copy. I came very unstuck because a local copy was out of date not long after I started with pico.

I can see the argument that the build directory should have copies of everything used at the last build but pico_sdk_import.cmake can kill the next build if it is treated as a project file instead of being part of the SDK.
I am not aware of any breaking change or forwards compatibility problem ever in pico_sdk_import.cmake (edit: indeed i jut checked and it has not changed since initial release except for a textual output change... we are aware that changing it would be a problem!)

hippy
Posts: 10550
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Thu Jul 29, 2021 1:19 pm

kilograham wrote:
Thu Jul 29, 2021 12:59 pm
As mentioned before the instructions are right there in the README.md in the pico-sdk
Just saying they are there isn't much of a help. I couldn't see them, and still can't, no mention of "$ENV" that I can find.
kilograham wrote:
Thu Jul 29, 2021 12:59 pm
That is a fine way to do it, but you just get a less friendly "can't find /external/pico_sdk_import.cmake" or maybe wore if PICO_SDK_PATH is not set. It also doesn't allow you to set the PICO_SDK_PATH on the cmake command line.

Additionally pico_sdk_import also supports finding pico_sdk as a submodule, or pulling it from git for you.
None or those going to be issues I anticipate running into. If I do I can adjust the CMakeLists.txt file for projects which require it.
Last edited by hippy on Thu Jul 29, 2021 1:26 pm, edited 1 time in total.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 29342
Joined: Sat Jul 30, 2011 7:41 pm

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Thu Jul 29, 2021 1:25 pm

hippy wrote:
Thu Jul 29, 2021 1:19 pm
kilograham wrote:
Thu Jul 29, 2021 12:59 pm
As mentioned before the instructions are right there in the README.md in the pico-sdk
Just saying they are there isn't much of a help. I couldn't see them, and still can't, no mention of "$ENV" that I can find.
Seems to be in here? (ie instructions on what to do, rather than your specific mechanism)

https://github.com/raspberrypi/pico-sdk ... /README.md
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

hippy
Posts: 10550
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Thu Jul 29, 2021 1:37 pm

jamesh wrote:
Thu Jul 29, 2021 1:25 pm
(ie instructions on what to do, rather than your specific mechanism)
Your addition is my point. The recommended instructions are there, but not instructions for what I wanted to achieve.

It seemed to me that kilograham was saying the instructions for doing what I wanted were there, but perhaps I misunderstood -
kilograham wrote:
Thu Jul 29, 2021 12:59 pm
hippy wrote:
Thu Jul 29, 2021 11:11 am
I didn't like doing that but it was a means to an end. I could entirely agree with those who said that wasn't the way it should be done but, given they weren't providing any solution as to how it could otherwise be achieved, and not having the time or resources to expend on figuring out a better solution for myself; that was the way it was staying.
As mentioned before the instructions are right there in the README.md in the pico-sdk

kilograham
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 876
Joined: Fri Apr 12, 2019 11:00 am
Location: austin tx

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Thu Jul 29, 2021 1:39 pm

no the instructions in the README.md only tell you how to do it in the way we recommend

dbrion06
Posts: 644
Joined: Tue May 28, 2019 11:57 am

Re: Setting PICO_SDK_PATH in your CMakeLists.txt (hint: dont)

Thu Jul 29, 2021 2:05 pm

Suppose you have two SDK (say, 1.0.2 and 3.4.56 - if one does not trust git and the newest -before testing- , that is doable) I suppose the newest one has less bugs and more nice features than the oldesst one.
I suppose that, at install, .bashrc is modified to generate env variable pointing to the latest and greatest.
If you modify a CMakelist.txt, it will "only" point to the oldest one (and what happens if the oldest is deleted)

Return to “SDK”