-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to build on non Windows ? #7
Comments
Maybe someone can modify it for Linux, I can't. The VGA demo board cannot be used for 8-bit output, PIO requires a continuous pin sequence. |
Fair enough. I would like to give it a go, but at the moment I a beginner with the pico and struggling with the tools myself. I've got a linux virtual machine setup with the toolchain working. I can build the VGA demos for this board and have tested them.
Ok, not sure I fully understand. I can confirm this code does work on the VGA demo board. Are you saying that some aspect of the PIO code on your project requires a different pinout ? The VGA demo board is figure 24 (Page 22) from this document |
In Linux, you should just type 'make' (or 'make all') and the program should compile. But before that you may need to compile the PIO program using the 'pioasm' program (part of the Pico SDK for Linux). The VGA demo board cannot be used for PicoVGA, because PicoVGA uses the 8-bit output R3G3B2, while the VGA demo board uses the 16-bit output R5G5B5 - the software from kilograham can be used on it. As a test, you can run PicoVGA on the VGA demo board, it will work (the HSYNC and VSYNC pins need to be remapped to different pins) but colours will be distorted. |
The (PicoVGA) directory has no Makefile of its own. Each subdirectory has one, picking one at random (pacman)
OK, it needs to be re-mapped to most significant bits. IE the 3 bits of red need to be mapped to Red2, Red3, Red4 on the 5 bit VGA output, the unused red0 red1 should be forced low via gpio?. IE map Red2,Red3,Red4 in the PIO code and set gpios for the unused two bits to stay low, do you think that would work? I've no idea how to do that though. https://cdn.shopify.com/s/files/1/0174/1800/files/vgademobase_480x480.png?v=1617010535 |
Apparently in Linux there is a problem with referring to the "current directory" as it comes from the "home directory". The output color components cannot be remapped to different pins, because all 8 outputs must form a continuous sequence of GPIO outputs (this is a PIO limitation). If you remap the top 3 bits to red2..4, the red0 red1 will have top 2 bits of the green component. |
I've made some progress. Managed to get vga.pio.h built. The pioasm utility is a bit crap as the Linux version does not tolerate the dos style CRLF line terminators.
|
Ah ok. If this cant be fixed in software then all I can do is to make a bodge board to sit between the Pico module and the VGA base with patch wires, nasty though, I would rather modify the code if possible as a couple of hundred of these demo boards have already been sold and other people would probably also like to play your games. |
Ok, got it built. First I needed to build the sdk version of elf2uf2
Then in your Makefile.inc I changed:
Now I can build pacman CC ../_tinyusb/portable/raspberrypi/rp2040/rp2040_usb.c
CC ../_tinyusb/tusb.c
C++ src/data.cpp
C++ src/game.cpp
C++ src/main.cpp
C++ src/open.cpp
C++ img/logo.cpp
C++ img/tiles.cpp
C++ img/sprites.cpp
C++ img/status.cpp
C++ snd/startsnd.cpp
C++ snd/siren.cpp
C++ snd/wakka.cpp
C++ snd/frighten.cpp
C++ snd/eatghost.cpp
C++ snd/eatfruit.cpp
C++ snd/death.cpp
C++ snd/extrapac.cpp
C++ snd/intermission.cpp
C++ ../_picovga/vga.cpp
C++ ../_picovga/vga_layer.cpp
C++ ../_picovga/vga_pal.cpp
C++ ../_picovga/vga_screen.cpp
C++ ../_picovga/vga_util.cpp
C++ ../_picovga/vga_vmode.cpp
C++ ../_picovga/util/canvas.cpp
C++ ../_picovga/util/mat2d.cpp
C++ ../_picovga/util/overclock.cpp
C++ ../_picovga/util/print.cpp
C++ ../_picovga/util/rand.cpp
C++ ../_picovga/util/pwmsnd.cpp
C++ ../_picovga/font/font_bold_8x8.cpp
C++ ../_picovga/font/font_bold_8x14.cpp
C++ ../_picovga/font/font_bold_8x16.cpp
C++ ../_picovga/font/font_boldB_8x14.cpp
C++ ../_picovga/font/font_boldB_8x16.cpp
C++ ../_picovga/font/font_game_8x8.cpp
C++ ../_picovga/font/font_ibm_8x8.cpp
C++ ../_picovga/font/font_ibm_8x14.cpp
C++ ../_picovga/font/font_ibm_8x16.cpp
C++ ../_picovga/font/font_ibmtiny_8x8.cpp
C++ ../_picovga/font/font_italic_8x8.cpp
C++ ../_picovga/font/font_thin_8x8.cpp
C++ ../_sdk/new_delete.cpp
ld build/program.elf
bin program.bin
hex program.hex
lst program.lst
sym program.sym
siz program.siz
uf2 program.uf2
$ ls -l program*
-rwxrwxr-x 1 jon jon 452760 Apr 29 18:28 program.bin
-rw-rw-r-- 1 jon jon 1273560 Apr 29 18:28 program.hex
-rw-rw-r-- 1 jon jon 1567404 Apr 29 18:28 program.lst
-rw-rw-r-- 1 jon jon 1576749 Apr 29 18:28 program.map
-rw-rw-r-- 1 jon jon 107 Apr 29 18:28 program.siz
-rw-rw-r-- 1 jon jon 23153 Apr 29 18:28 program.sym
-rw-rw-r-- 1 jon jon 905728 Apr 29 18:28 program.uf2 It is going to take some more work to make the Linux build smoother but the changes are minor. |
I've tried the executable. The UART is active and prompts me so the game is running. The monitor is black but thinks it has some sort of sync. I will have a go at hacking the PIO code around, not sure I understand anything much at the moment. I will read up, where does "pins" come from, at some point something must map the byte or bits to the GPIO pins - where should I look? I'f I can make the changes minor and write a README.linux file can you import the build changes back into your project or would you rather I fork it. It needs a README and maybe a different Makefile for Linux ? |
PicoVGA (in the basic unmodified version) uses only the combined CSYNC (HSYNC) synchronization, which connects to the monitor's HSYNC signal. The VSYNC monitor signal must remain unconnected. Most monitors support this mode, but some older monitors do not. Furthermore, PicoVGA assumes that the HSYNC signal follows immediately after the color signals on the GPIO. It is possible to remap it to another GPIO, but it is not ready without code modifications. You have to define VGA_GPIO_SYNC in vga_config.h and then do some more code correction in the VgaPioInit() function in the vga.cpp file. |
Interesting you should mention that, I was reading the description on your web page for the project (nice writreup, thanks) and scratching my head. I've done some dirty things with video in the past, but nothing in the specs say that VGA supports composite sync at all. I don't quite follow the schematic and description, not sure what the connection between audio and V-SYNC is about - it isn't labelled as such, does that mean no sound in VGA mode or that audio has a 60Hz hum and video breaks up if the audio data gets towards DC levels, i'm very confused by it. You did a good demo video so clearly it works. Some suggestions: I have a lot of pico specific reading to do before I can make a stab at any constructive changes, thanks for publishing the project, looks great. Do you have your own hardware available?
The GPIO DAC is steady state, not sure what you are telling me here, the state of the analog video lines does not matter during line or frame sync but is typically black, I don't think sync on green was ever a requirement for VGA. |
The original design used the VSYNC pin of the VGA connector as the audio output. This allowed a SCART connector to be connected to the TV without the need for a special connector. Plugging in the audio jack disconnected the audio output to the VGA connector. I used this design mainly with the ATpad game console. http://www.breatharian.eu/hw/atpad/index.html All of the 8 or so monitors I tried supported CSYNC composite sync, I found this specification in the description of the VGA connector signals. With the PicoVGA project, some users have occasionally reported that their monitor does not support composite CSYNC. In these cases, the PicoVGA library needs to be modified to support separate sync signals - the modification is described here: https://forums.raspberrypi.com/viewtopic.php?t=313634&p=1878457#p1878457 I am using PicoVGA on my mini-computer, but it is not finished yet. https://www.oldcomp.cz/download/file.php?id=12823 |
Do you have evidence for this, I've never seen even a tiny sniff of evidence that VGA devices are expected to support composite sync? I tried to trace out the front end from the simplest VGA CRT monitor I could find, I gave up in the end as it seems the sync section is quite complicated, but best I can tell it is a pair of XOR gates with the CMOS Hsync/VSync signal pulled up to +5 via 27k, coupled into one half of the XOR via 330R. The arrangement between the HSync processor (MC1391) and the main defection logic and PLL (TDA1170N) is above my pay grade. I suspect the fact that most monitors worked with composite sync was just pure luck that they all chose to copy the same front end design and not use the sync arrangement documented in the TDA application notes. See schematic page 33 Personally I would not ship something with VGA output that relied on the monitor supporting composite sync, to do so is to confuse luck with specification, also I suspect the older and more vintage the monitor the less likely it may be to work, but that is only a guess.
That is very very impressive.
As is this, nice work :-) You are doing great work, your software is fantastic, but we may just have to agree to differ on the wisdom of composite sync for VGA outputs ! When it comes to specification vs "what works" I found a very similar thing with VGA driving SCART. I came up with a simple way to drive RGB SCART from a Raspberry Pi board using a VGA adapter, works perfectly but the sync arrangement is way outside of what should work, looks great on every TV I tried it on, but again due to luck of implementation rather than meeting the specification. |
I only use current LCDs, not CRTs. Maybe that's the difference. With this project, I've encountered more backlash than not supporting older CRTs - rather, HDMI is already required, and current TVs no longer support SCART, so this project is on the wane and I didn't want to improve it further. |
Fair enough. I don't think you get backlash, just a bit of confusion and a little technical disagreement at some of the choices you made, but much respect for the work, it is very impressive. Thanks for the great work and the very useful and comprehensive web pages and demos you have produced, that will keep me reading and learning for many hours. Do you want me to fork this project and add Linux build files or do you want me to Make changes and a Linux specific README and feed those changes back to you ? |
Unfortunately I don't know how to use GitHub (it's too "Linux approach" which I cannot handle), my maximum was to figure out how to push a project to GitHub, but I can't make changes to it. :-( I didn't want to update the code for the separate synchronization signals yet, because I don't have the ability to verify the code at the moment (I'm working on other projects now). |
I was in much the same situation last year. I am still a git/github novice. I just try and remember to zip the project up before I try and use git in cause I get it wrong. 15 people have already forked your project, but best I can tell none have modified it to build on Linux, or if they did they did not change the description/readme. See Forks under "about" on the right hand side of your github project page. |
I have create a fork of PicoVGA that builds on Linux: https://github.com/codaris/picovga-cmake I created this fork so that I could use the latest Pico SDK and compile PicoVGA for the Pico W (for Wifi support). In this fork, I've modified all the examples and updated the documentation accordingly. If anyone tries this fork and has an issue, please leave a ticket in that project. |
Well done, nice work. I am not setup for a project like this at the moment but I will try and remember to circle back and give your fork a go when I have free time. |
This looks great as a project.
The build system seems very Windows specific, will this build with the Linux pico gcc tools ?
I have a "VGA demo base" for the Pico, how does the pinout compare, how do I configure it ?
Thanks.
The text was updated successfully, but these errors were encountered: