How do I repair the cannon in Ancient Gardens?
These cannons act as a fast travel system for when you come back to World 1 after beating it. Specifically, after you beat World 1, you will unlock the ability to push certain blocks around with Beepo.
If you come back to World 1, you will find these blocks. Some of them will enable you to access new "islands" that have the canon. Taking the cannon will shoot you forward in the level. When you land on the new "island", there will typically be a return cannon, as well as something that you can activate to connect the island to the main path.
The easiest way to locate these all is to re-walk the world, starting at the beginning, and looking for blocks to push. Periodically you will find one that lets you access a cannon. Take the cannon, unlock it from the other end, then take the return cannon and keep walking.
There are approximately 3 cannon sets per World.