Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6121

SDK • Re: Pico SDK compilation question re placement of preprocessor directives

$
0
0
Yup; the reason the pico-examples do a compile time warning, is we don't want to fail the build (of all examples) if you a re building for a PICO_BOARD which doesn't have I2C
Isn't it possible to add a check for whether being 'bulk built' versus individually ... ?

Code:

if !defined(i2c_default) || !defined(PICO_DEFAULT_I2C_SDA_PIN) || !defined(PICO_DEFAULT_I2C_SCL_PIN)    #if defined(BUILDING_ALL_PICO_EXAMPLES)        #warning i2c/bus_scan example requires a board with I2C pins    #else        #error   i2c/bus_scan example requires a board with I2C pins  #endif#endif
I have similar in my code to handle when my code is being built for the Pi command line, Pico, or Pico W, whether I am building for the command line with GCC, Clang, TCC, or ELLCC, whether using 'CMake' or some other means to build the code.

And, to climb aboard my hobby horse, using the specific "Pico" product name when dealing with generic RP2 boards has always been wrong to me; "Pico SDK" should IMO be "RP2 SDK" or similar. Likewise I believe 'pico-examples' should just be 'examples' if they are intended for non-Pico boards, and "PICO_DEFAULT_I2C_SDA_PIN" should be "BOARD_DEFAULT_I2C_SDA_PIN".

The notion of "PICO_BOARD" being assignable is particularly nonsensical to me, should just be "BOARD" or "RP2_BOARD" and "#if PICO" should similarly be '#if RP2", and "#if PICO_*" should be "#if BOARD_*". Otherwise it becomes difficult to tell when a specific Pico board or generic RP2 products are meant.

People who describe their bards as "Pico" rightly get flak for using the name of a specific board, and I feel the same way about using "Pico" to describe generic stuff within Raspberry Pi.

Statistics: Posted by hippy — Wed Feb 07, 2024 12:51 pm



Viewing all articles
Browse latest Browse all 6121

Latest Images

Trending Articles



Latest Images