raspberrypi / pico-sdk

BSD 3-Clause "New" or "Revised" License
3.66k stars 911 forks source link

Multipe versions of vgaboard.h #755

Open Memotech-Bill opened 2 years ago

Memotech-Bill commented 2 years ago

It would be useful if there were three different versions of the vgaboard,h board definition file for the Pimoroni VGA Demo board:

This would make it easier to write code which has to be able to compile for any of these configurations.

lurch commented 2 years ago

I believe the vgaboard.h was added to reflect the VGA Demo Board example design in https://datasheets.raspberrypi.com/rp2040/hardware-design-with-rp2040.pdf

If the Pimoroni VGA Demo board works differently, then it's up to them to provide appropriate board-definition files. ping @ZodiusInfuser (who added many of the previous Pimoroni board definition files)

ZodiusInfuser commented 2 years ago

It has been a while since I've looked at the VGA Demo board but my understanding is that our VGA Demo board uses the reference design of the example you link to above?

kilograham commented 2 years ago

You can create your own board header files.

Just set the PICO_BOARD_HEADER_DIRS to point to the directory where you keep them, either in your environment, on the cmake command line or at the top of your CMakeLists.txt

Memotech-Bill commented 2 years ago

With the reference board design, there are at least two hardware configurations, GPIO 20 & 21 (J7) links-in or links-out. If the links are in (or on the Pimoroni board the links are not cut) the user has to decide whether their design will use the SD card, or use the serial port as it is not possible to use both in this configuration. Hence the three board definitions.

I know that I can create my own board definitions, but ideally I would like to create a repository containing a CMake file that will compile for any user selected board. This would require being able to specify a search path for the board files, i.e. first look for any custom board definitions, and if not found there look in the standard board definitions.

Memotech-Bill commented 2 years ago

I have just re-read the relevant section of the documentation and discovered that PICO_BOARD_HEADER_DIRS is a search path, not a single folder so I can create my own board definition files and have either these or the standard ones used.

I still think that my argument that there should be three different files is valid.

lurch commented 3 months ago

I still think that my argument that there should be three different files is valid.

Wouldn't it be simpler to just have a bunch of #if / #elif / #endif directives in the existing vgaboard.h ? :thinking:

Memotech-Bill commented 3 months ago

I still think that my argument that there should be three different files is valid.

Wouldn't it be simpler to just have a bunch of #if / #elif / #endif directives in the existing vgaboard.h ? 🤔

That would work. I don't know whether it would be simpler.